# Plutonium framework API: Plutonium/include/pu/ui/elm/elm_Image.hpp Source File

elm_Image.hpp
Go to the documentation of this file.
/*
Plutonium library
@file Image.hpp
@brief An Image is an Element showing a picture. (JPEG, PNG, TGA, BMP)
@author XorTroll
@copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
*/
#pragma once
#include <pu/ui/elm/elm_Element.hpp>
namespace pu::ui::elm {
class Image : public Element {
private:
std::string img_path;
sdl2::Texture img_tex;
render::TextureRenderOptions rend_opts;
i32 x;
i32 y;
public:
Image(const i32 x, const i32 y, const std::string &image_path);
PU_SMART_CTOR(Image)
~Image();
inline i32 GetX() override {
return this->x;
}
inline void SetX(const i32 x) {
this->x = x;
}
inline i32 GetY() override {
return this->y;
}
inline void SetY(const i32 y) {
this->y = y;
}
inline i32 GetWidth() override {
return this->rend_opts.width;
}
inline void SetWidth(const i32 width) {
this->rend_opts.width = width;
}
inline i32 GetHeight() override {
return this->rend_opts.height;
}
inline void SetHeight(const i32 height) {
this->rend_opts.height = height;
}
inline float GetRotationAngle() {
return this->rend_opts.rot_angle;
}
inline void SetRotationAngle(const float angle) {
this->rend_opts.rot_angle = angle;
}
inline std::string GetImagePath() {
return this->img_path;
}
void SetImage(const std::string &image_path);
inline bool IsImageValid() {
return this->img_tex != nullptr;
}
void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override;
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override {}
};
}
pu::ui::elm::Element
Definition: elm_Element.hpp:37
pu::ui::elm::Image
Definition: elm_Image.hpp:19
pu::ui::elm::Image::SetX
void SetX(const i32 x)
Definition: elm_Image.hpp:36
pu::ui::elm::Image::OnRender
void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override
pu::ui::elm::Image::GetHeight
i32 GetHeight() override
Definition: elm_Image.hpp:56
pu::ui::elm::Image::IsImageValid
bool IsImageValid()
Definition: elm_Image.hpp:78
pu::ui::elm::Image::GetImagePath
std::string GetImagePath()
Definition: elm_Image.hpp:72
pu::ui::elm::Image::GetWidth
i32 GetWidth() override
Definition: elm_Image.hpp:48
pu::ui::elm::Image::OnInput
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override
Definition: elm_Image.hpp:83
pu::ui::elm::Image::GetRotationAngle
float GetRotationAngle()
Definition: elm_Image.hpp:64
pu::ui::elm::Image::SetImage
void SetImage(const std::string &image_path)
pu::ui::elm::Image::Image
Image(const i32 x, const i32 y, const std::string &image_path)
pu::ui::elm::Image::SetWidth
void SetWidth(const i32 width)
Definition: elm_Image.hpp:52
pu::ui::elm::Image::SetY
void SetY(const i32 y)
Definition: elm_Image.hpp:44
pu::ui::elm::Image::~Image
~Image()
pu::ui::elm::Image::SetHeight
void SetHeight(const i32 height)
Definition: elm_Image.hpp:60
pu::ui::elm::Image::GetX
i32 GetX() override
Definition: elm_Image.hpp:32
pu::ui::elm::Image::SetRotationAngle
void SetRotationAngle(const float angle)
Definition: elm_Image.hpp:68
pu::ui::elm::Image::GetY
i32 GetY() override
Definition: elm_Image.hpp:40
elm_Element.hpp
pu::sdl2::Texture
SDL_Texture * Texture
Definition: sdl2_Types.hpp:11
pu::ui::elm
Definition: elm_Button.hpp:18
pu::i32
s32 i32
Definition: pu_Include.hpp:28
PU_SMART_CTOR
#define PU_SMART_CTOR(type)
Definition: pu_Include.hpp:19
pu::ui::TouchPoint
Definition: ui_Types.hpp:62
pu::ui::render::TextureRenderOptions
Definition: render_Renderer.hpp:77
pu::ui::render::TextureRenderOptions::rot_angle
float rot_angle
Definition: render_Renderer.hpp:81
pu::ui::render::TextureRenderOptions::width
i32 width
Definition: render_Renderer.hpp:79
pu::ui::render::TextureRenderOptions::height
i32 height
Definition: render_Renderer.hpp:80