Plutonium framework API 0.3.0
UI framework libraries for libnx
Loading...
Searching...
No Matches
ui_Overlay.hpp
Go to the documentation of this file.
1
2/*
3
4 Plutonium library
5
6 @file ui_Overlay.hpp
7 @brief An overlay is some kind of "pop-up", like notification messages or similar items
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/ui_Container.hpp>
16
17namespace pu::ui {
18
19 class Overlay : public Container {
20 public:
21 static constexpr i32 DefaultRadius = 37;
22 static constexpr u8 DefaultMaxFadeAlpha = 200;
23 static constexpr u8 DefaultFadeAlphaVariation = 25;
24
25 private:
26 i32 fade_a;
27 Color bg_clr;
28 i32 rad;
29 bool is_ending;
30 u8 max_fade_alpha;
31 u8 fade_alpha_variation;
32
33 public:
34 Overlay(const i32 x, const i32 y, const i32 width, const i32 height, const Color bg_clr) : Container(x, y, width, height), fade_a(0), bg_clr(bg_clr), rad(DefaultRadius), is_ending(false), max_fade_alpha(DefaultMaxFadeAlpha), fade_alpha_variation(DefaultFadeAlphaVariation) {}
36
37 PU_CLASS_POD_GETSET(Radius, rad, i32)
38
39 inline bool HasRadius() {
40 return this->rad > 0;
41 }
42
43 PU_CLASS_POD_GETSET(BackgroundColor, bg_clr, Color)
44 PU_CLASS_POD_GETSET(MaxFadeAlpha, max_fade_alpha, u8)
45 PU_CLASS_POD_GETSET(FadeAlphaVariation, fade_alpha_variation, u8)
46
47 virtual void OnPreRender(render::Renderer::Ref &drawer) {}
48 virtual void OnPostRender(render::Renderer::Ref &drawer) {}
49 bool Render(render::Renderer::Ref &drawer);
50
51 inline void NotifyEnding(const bool ending) {
52 this->is_ending = ending;
53 }
54 };
55
56}
Definition ui_Container.hpp:21
Definition ui_Overlay.hpp:19
void NotifyEnding(const bool ending)
Definition ui_Overlay.hpp:51
virtual void OnPostRender(render::Renderer::Ref &drawer)
Definition ui_Overlay.hpp:48
bool Render(render::Renderer::Ref &drawer)
Overlay(const i32 x, const i32 y, const i32 width, const i32 height, const Color bg_clr)
Definition ui_Overlay.hpp:34
static constexpr i32 DefaultRadius
Definition ui_Overlay.hpp:21
bool HasRadius()
Definition ui_Overlay.hpp:39
static constexpr u8 DefaultFadeAlphaVariation
Definition ui_Overlay.hpp:23
static constexpr u8 DefaultMaxFadeAlpha
Definition ui_Overlay.hpp:22
virtual void OnPreRender(render::Renderer::Ref &drawer)
Definition ui_Overlay.hpp:47
Definition render_Renderer.hpp:127
Definition render_Renderer.hpp:20
#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:44