3
4
5
6
7
8
9
10
11
12
15#include <pu/ui/ui_Dialog.hpp>
16#include <pu/ui/ui_Layout.hpp>
17#include <pu/ui/ui_Overlay.hpp>
24 using DialogPrepareCallback = std::function<
void(
Dialog::Ref&)>;
25 using OnInputCallback = std::function<
void(
const u64,
const u64,
const u64,
const TouchPoint)>;
26 using RenderCallback = std::function<
void()>;
61 static_assert(std::is_base_of_v<ui::
Layout, L>);
62 return std::static_pointer_cast<L>(
this->lyt);
71 this->render_cbs.push_back(render_cb);
75 this->on_ipt_cb = on_ipt_cb;
79 return dialog->Show(
this);
82 i32 CreateShowDialog(
const std::string &title,
const std::string &content,
const std::vector<std::string> &opts,
const bool use_last_opt_as_cancel,
sdl2::
TextureHandle::Ref icon = {}, DialogPrepareCallback prepare_cb =
nullptr);
85 if(
this->ovl ==
nullptr) {
104 return this->loaded && (
this->lyt !=
nullptr);
111 rmutexLock(&
this->render_lock);
115 rmutexUnlock(&
this->render_lock);
122 return this->fade_alpha > 0;
126 this->fade_alpha_increment_steps = fade_alpha_increment_steps;
133 return this->fade_bg_tex;
137 return this->fade_bg_tex !=
nullptr;
143 void Close(
const bool do_exit =
false);
151 return this->renderer->GetButtonsDown();
155 return this->renderer->GetButtonsUp();
159 return this->renderer->GetButtonsHeld();
163 HidTouchScreenState state = {};
164 hidGetTouchScreenStates(&state, 1);
Definition sdl2_Types.hpp:18
Definition ui_Application.hpp:22
bool IsShown()
Definition ui_Application.hpp:99
bool is_shown
Definition ui_Application.hpp:35
sdl2::TextureHandle::Ref fade_bg_tex
Definition ui_Application.hpp:39
std::vector< RenderCallback > render_cbs
Definition ui_Application.hpp:45
HidTouchScreenState GetTouchState()
Definition ui_Application.hpp:162
OnInputCallback on_ipt_cb
Definition ui_Application.hpp:46
Application(render::Renderer::Ref renderer)
static constexpr u8 DefaultFadeAlphaIncrementSteps
Definition ui_Application.hpp:29
SigmoidIncrementer< i32 > fade_alpha_incr
Definition ui_Application.hpp:37
u8 fade_alpha_increment_steps
Definition ui_Application.hpp:36
Layout::Ref lyt
Definition ui_Application.hpp:41
void StartOverlay(Overlay::Ref ovl)
Definition ui_Application.hpp:84
void SetFadeBackgroundColor(const Color clr)
void StartOverlayWithTimeout(Overlay::Ref ovl, const u64 ms)
u64 GetButtonsDown()
Definition ui_Application.hpp:150
void LockRender()
Definition ui_Application.hpp:110
u64 GetButtonsUp()
Definition ui_Application.hpp:154
u64 GetButtonsHeld()
Definition ui_Application.hpp:158
bool CanBeShown()
Definition ui_Application.hpp:103
void AddRenderCallback(RenderCallback render_cb)
Definition ui_Application.hpp:70
void ShowWithFadeIn()
Definition ui_Application.hpp:94
void CloseWithFadeOut(const bool do_exit=false)
Definition ui_Application.hpp:145
void SetFadeBackgroundImage(sdl2::TextureHandle::Ref bg_tex)
bool in_render_over
Definition ui_Application.hpp:33
i32 fade_alpha
Definition ui_Application.hpp:38
bool HasFadeBackgroundImage()
Definition ui_Application.hpp:136
void ResetFadeBackgroundImage()
void SetOnInput(OnInputCallback on_ipt_cb)
Definition ui_Application.hpp:74
RMutex render_lock
Definition ui_Application.hpp:48
bool loaded
Definition ui_Application.hpp:32
void SetFadeAlphaIncrementStepCount(const u8 fade_alpha_increment_steps)
Definition ui_Application.hpp:125
std::shared_ptr< L > GetLayout()
Definition ui_Application.hpp:60
Color fade_bg_clr
Definition ui_Application.hpp:40
void Close(const bool do_exit=false)
bool IsFadedIn()
Definition ui_Application.hpp:121
Overlay::Ref ovl
Definition ui_Application.hpp:42
RenderOverFunction render_over_fn
Definition ui_Application.hpp:34
u64 ovl_timeout_ms
Definition ui_Application.hpp:43
i32 CreateShowDialog(const std::string &title, const std::string &content, const std::vector< std::string > &opts, const bool use_last_opt_as_cancel, sdl2::TextureHandle::Ref icon={}, DialogPrepareCallback prepare_cb=nullptr)
bool CallForRenderWithRenderOver(RenderOverFunction render_over_fn)
render::Renderer::Ref renderer
Definition ui_Application.hpp:47
sdl2::TextureHandle::Ref & GetFadeBackgroundImageTexture()
Definition ui_Application.hpp:132
void LoadLayout(Layout::Ref lyt)
Definition ui_Application.hpp:55
i32 ShowDialog(Dialog::Ref &dialog)
Definition ui_Application.hpp:78
void UnlockRender()
Definition ui_Application.hpp:114
std::chrono::steady_clock::time_point ovl_start_time
Definition ui_Application.hpp:44
Definition ui_Dialog.hpp:22
Definition ui_Layout.hpp:20
Definition ui_Overlay.hpp:19
Definition render_Renderer.hpp:127
Definition sdl2_Types.hpp:10
Definition render_Renderer.hpp:20
#define PU_SMART_CTOR(type)
Definition pu_Include.hpp:20
Definition ui_Types.hpp:44
Definition ui_Types.hpp:67