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

elm_Rectangle.hpp
Go to the documentation of this file.
/*
Plutonium library
@file Rectangle.hpp
@brief A Rectangle is an Element which simply draws a filled rectangle.
@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 Rectangle : public Element
{
private:
i32 x;
i32 y;
i32 w;
i32 h;
Color clr;
i32 border_radius;
public:
Rectangle(const i32 x, const i32 y, const i32 width, const i32 height, const Color clr, const i32 border_radius = 0) : Element(), x(x), y(y), w(width), h(height), clr(clr), border_radius(border_radius) {}
PU_SMART_CTOR(Rectangle)
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->w;
}
inline void SetWidth(const i32 width) {
this->w = width;
}
inline i32 GetHeight() override {
return this->h;
}
inline void SetHeight(const i32 height) {
this->h = height;
}
inline i32 GetBorderRadius() {
return this->border_radius;
}
inline void SetBorderRadius(const i32 border_radius) {
this->border_radius = border_radius;
}
inline Color GetColor() {
return this->clr;
}
inline void SetColor(const Color clr) {
this->clr = clr;
}
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::Rectangle
Definition: elm_Rectangle.hpp:20
pu::ui::elm::Rectangle::GetColor
Color GetColor()
Definition: elm_Rectangle.hpp:74
pu::ui::elm::Rectangle::SetBorderRadius
void SetBorderRadius(const i32 border_radius)
Definition: elm_Rectangle.hpp:69
pu::ui::elm::Rectangle::SetX
void SetX(const i32 x)
Definition: elm_Rectangle.hpp:37
pu::ui::elm::Rectangle::SetY
void SetY(const i32 y)
Definition: elm_Rectangle.hpp:45
pu::ui::elm::Rectangle::GetY
i32 GetY() override
Definition: elm_Rectangle.hpp:41
pu::ui::elm::Rectangle::GetBorderRadius
i32 GetBorderRadius()
Definition: elm_Rectangle.hpp:65
pu::ui::elm::Rectangle::GetX
i32 GetX() override
Definition: elm_Rectangle.hpp:33
pu::ui::elm::Rectangle::SetWidth
void SetWidth(const i32 width)
Definition: elm_Rectangle.hpp:53
pu::ui::elm::Rectangle::GetWidth
i32 GetWidth() override
Definition: elm_Rectangle.hpp:49
pu::ui::elm::Rectangle::OnInput
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override
Definition: elm_Rectangle.hpp:83
pu::ui::elm::Rectangle::SetColor
void SetColor(const Color clr)
Definition: elm_Rectangle.hpp:78
pu::ui::elm::Rectangle::SetHeight
void SetHeight(const i32 height)
Definition: elm_Rectangle.hpp:61
pu::ui::elm::Rectangle::OnRender
void OnRender(render::Renderer::Ref &drawer, const i32 x, const i32 y) override
pu::ui::elm::Rectangle::Rectangle
Rectangle(const i32 x, const i32 y, const i32 width, const i32 height, const Color clr, const i32 border_radius=0)
Definition: elm_Rectangle.hpp:30
pu::ui::elm::Rectangle::GetHeight
i32 GetHeight() override
Definition: elm_Rectangle.hpp:57
elm_Element.hpp
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::Color
Definition: ui_Types.hpp:44
pu::ui::TouchPoint
Definition: ui_Types.hpp:62