Plutonium framework API 0.3.0
UI framework libraries for libnx
elm_Image.hpp
Go to the documentation of this file.
1
2/*
3
4 Plutonium library
5
6 @file Image.hpp
7 @brief An Image is an Element showing a picture. (JPEG, PNG, TGA, BMP)
8 @author XorTroll
9
10 @copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
11
12*/
13
14#pragma once
16
17namespace pu::ui::elm {
18
19 class Image : public Element {
20 private:
21 std::string img_path;
22 sdl2::Texture img_tex;
24 i32 x;
25 i32 y;
26
27 public:
28 Image(const i32 x, const i32 y, const std::string &image_path);
31
32 inline i32 GetX() override {
33 return this->x;
34 }
35
36 inline void SetX(const i32 x) {
37 this->x = x;
38 }
39
40 inline i32 GetY() override {
41 return this->y;
42 }
43
44 inline void SetY(const i32 y) {
45 this->y = y;
46 }
47
48 inline i32 GetWidth() override {
49 return this->rend_opts.width;
50 }
51
52 inline void SetWidth(const i32 width) {
53 this->rend_opts.width = width;
54 }
55
56 inline i32 GetHeight() override {
57 return this->rend_opts.height;
58 }
59
60 inline void SetHeight(const i32 height) {
61 this->rend_opts.height = height;
62 }
63
64 inline float GetRotationAngle() {
65 return this->rend_opts.rot_angle;
66 }
67
68 inline void SetRotationAngle(const float angle) {
69 this->rend_opts.rot_angle = angle;
70 }
71
72 inline std::string GetImagePath() {
73 return this->img_path;
74 }
75
76 void SetImage(const std::string &image_path);
77
78 inline bool IsImageValid() {
79 return this->img_tex != nullptr;
80 }
81
82 void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override;
83 void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override {}
84 };
85
86}
Definition: elm_Element.hpp:37
Definition: elm_Image.hpp:19
void SetX(const i32 x)
Definition: elm_Image.hpp:36
void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override
i32 GetHeight() override
Definition: elm_Image.hpp:56
bool IsImageValid()
Definition: elm_Image.hpp:78
std::string GetImagePath()
Definition: elm_Image.hpp:72
i32 GetWidth() override
Definition: elm_Image.hpp:48
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override
Definition: elm_Image.hpp:83
float GetRotationAngle()
Definition: elm_Image.hpp:64
void SetImage(const std::string &image_path)
Image(const i32 x, const i32 y, const std::string &image_path)
void SetWidth(const i32 width)
Definition: elm_Image.hpp:52
void SetY(const i32 y)
Definition: elm_Image.hpp:44
void SetHeight(const i32 height)
Definition: elm_Image.hpp:60
i32 GetX() override
Definition: elm_Image.hpp:32
void SetRotationAngle(const float angle)
Definition: elm_Image.hpp:68
i32 GetY() override
Definition: elm_Image.hpp:40
SDL_Texture * Texture
Definition: sdl2_Types.hpp:11
Definition: elm_Button.hpp:18
s32 i32
Definition: pu_Include.hpp:28
#define PU_SMART_CTOR(type)
Definition: pu_Include.hpp:19
Definition: ui_Types.hpp:62
Definition: render_Renderer.hpp:77
float rot_angle
Definition: render_Renderer.hpp:81
i32 width
Definition: render_Renderer.hpp:79
i32 height
Definition: render_Renderer.hpp:80