3
4
5
6
7
8
9
10
11
12
16#include <pu/ui/elm/elm_Element.hpp>
18namespace pu::ui::
elm {
22 using OnClickCallback = std::function<
void()>;
39 sdl2::Texture cnt_tex;
40 OnClickCallback on_click_cb;
43 SigmoidIncrementer<i32> hover_alpha_incr;
44 u8 darker_color_factor;
45 u8 hover_alpha_incr_steps;
47 inline Color MakeHoverBackgroundColor(
const i32 alpha) {
48 i32 base_r =
this->bg_clr.r -
this->darker_color_factor;
52 i32 base_g =
this->bg_clr.g -
this->darker_color_factor;
56 i32 base_b =
this->bg_clr.b -
this->darker_color_factor;
61 auto base_a =
this->bg_clr.a;
63 base_a =
static_cast<u8>(alpha);
66 return {
static_cast<u8>(base_r),
static_cast<u8>(base_g),
static_cast<u8>(base_b), base_a };
70 Button(
const i32 x,
const i32 y,
const i32 width,
const i32 height,
const std::string &content,
const Color content_clr,
const Color bg_clr);
78 inline void SetX(
const i32 x) {
86 inline void SetY(
const i32 y) {
121 this->on_click_cb = on_click_cb;
125 void OnInput(
const u64 keys_down,
const u64 keys_up,
const u64 keys_held,
const TouchPoint touch_pos)
override;
Definition elm_Element.hpp:37
Definition render_Renderer.hpp:127
Definition sdl2_Types.hpp:10
Definition render_Renderer.hpp:20
Definition elm_Button.hpp:18
DefaultFontSize
Definition ui_Types.hpp:21
#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
#define PU_CLASS_POD_GET(fn_name, var_name, type)
Definition pu_Include.hpp:27
Definition ui_Types.hpp:44
Definition ui_Types.hpp:67