Plutonium framework API 0.3.0
UI framework libraries for libnx
Loading...
Searching...
No Matches
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
15#include <pu/ui/elm/elm_Element.hpp>
16
17namespace pu::ui::elm {
18
19 class Image : public Element {
20 private:
21 std::string img_path;
22 sdl2::TextureHandle::Ref img_tex;
24 i32 x;
25 i32 y;
26
27 public:
28 Image(const i32 x, const i32 y, sdl2::TextureHandle::Ref image);
30
31 inline i32 GetX() override {
32 return this->x;
33 }
34
35 inline void SetX(const i32 x) {
36 this->x = x;
37 }
38
39 inline i32 GetY() override {
40 return this->y;
41 }
42
43 inline void SetY(const i32 y) {
44 this->y = y;
45 }
46
47 inline i32 GetWidth() override {
48 return this->rend_opts.width;
49 }
50
51 inline void SetWidth(const i32 width) {
52 this->rend_opts.width = width;
53 }
54
55 inline i32 GetHeight() override {
56 return this->rend_opts.height;
57 }
58
59 inline void SetHeight(const i32 height) {
60 this->rend_opts.height = height;
61 }
62
63 PU_CLASS_POD_GETSET(RotationAngle, rend_opts.rot_angle, float)
64
65 void SetImage(sdl2::TextureHandle::Ref image);
66
67 inline bool IsImageValid() {
68 return this->img_tex != nullptr;
69 }
70
71 void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override;
72 void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override {}
73 };
74
75}
Definition sdl2_Types.hpp:18
Definition elm_Element.hpp:37
Definition elm_Image.hpp:19
void SetX(const i32 x)
Definition elm_Image.hpp:35
void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override
i32 GetHeight() override
Definition elm_Image.hpp:55
bool IsImageValid()
Definition elm_Image.hpp:67
i32 GetWidth() override
Definition elm_Image.hpp:47
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override
Definition elm_Image.hpp:72
void SetWidth(const i32 width)
Definition elm_Image.hpp:51
void SetY(const i32 y)
Definition elm_Image.hpp:43
void SetImage(sdl2::TextureHandle::Ref image)
void SetHeight(const i32 height)
Definition elm_Image.hpp:59
i32 GetX() override
Definition elm_Image.hpp:31
Image(const i32 x, const i32 y, sdl2::TextureHandle::Ref image)
i32 GetY() override
Definition elm_Image.hpp:39
Definition render_Renderer.hpp:127
Definition sdl2_Types.hpp:10
Definition render_Renderer.hpp:20
Definition elm_Button.hpp:18
#define PU_SMART_CTOR(type)
Definition pu_Include.hpp:20
#define PU_CLASS_POD_GETSET(fn_name, var_name, type)
Definition pu_Include.hpp:37
Definition ui_Types.hpp:67
Definition render_Renderer.hpp:99