Plutonium framework API 0.3.0
UI framework libraries for libnx
Loading...
Searching...
No Matches
pu::ui::Application Class Referenceabstract

#include <ui_Application.hpp>

Public Types

using DialogPrepareCallback = std::function<void(Dialog::Ref&)>
 
using OnInputCallback = std::function<void(const u64, const u64, const u64, const TouchPoint)>
 
using RenderCallback = std::function<void()>
 
using RenderOverFunction = std::function<bool(render::Renderer::Ref&)>
 

Public Member Functions

 Application (render::Renderer::Ref renderer)
 
virtual ~Application ()
 
void LoadLayout (Layout::Ref lyt)
 
template<typename L >
std::shared_ptr< L > GetLayout ()
 
void Prepare ()
 
virtual void OnLoad ()=0
 
void AddRenderCallback (RenderCallback render_cb)
 
void SetOnInput (OnInputCallback on_ipt_cb)
 
i32 ShowDialog (Dialog::Ref &dialog)
 
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)
 
void StartOverlay (Overlay::Ref ovl)
 
void StartOverlayWithTimeout (Overlay::Ref ovl, const u64 ms)
 
void EndOverlay ()
 
void Show ()
 
void ShowWithFadeIn ()
 
bool IsShown ()
 
bool CanBeShown ()
 
bool CallForRender ()
 
bool CallForRenderWithRenderOver (RenderOverFunction render_over_fn)
 
void LockRender ()
 
void UnlockRender ()
 
void FadeIn ()
 
void FadeOut ()
 
bool IsFadedIn ()
 
void SetFadeAlphaIncrementStepCount (const u8 fade_alpha_increment_steps)
 
void SetFadeBackgroundImage (sdl2::TextureHandle::Ref bg_tex)
 
void ResetFadeBackgroundImage ()
 
sdl2::TextureHandle::Ref & GetFadeBackgroundImageTexture ()
 
bool HasFadeBackgroundImage ()
 
void SetFadeBackgroundColor (const Color clr)
 
void OnRender ()
 
void Close (const bool do_exit=false)
 
void CloseWithFadeOut (const bool do_exit=false)
 
u64 GetButtonsDown ()
 
u64 GetButtonsUp ()
 
u64 GetButtonsHeld ()
 
HidTouchScreenState GetTouchState ()
 

Static Public Attributes

static constexpr u8 DefaultFadeAlphaIncrementSteps = 20
 

Protected Attributes

bool loaded
 
bool in_render_over
 
RenderOverFunction render_over_fn
 
bool is_shown
 
u8 fade_alpha_increment_steps
 
SigmoidIncrementer< i32fade_alpha_incr
 
i32 fade_alpha
 
sdl2::TextureHandle::Ref fade_bg_tex
 
Color fade_bg_clr
 
Layout::Ref lyt
 
Overlay::Ref ovl
 
u64 ovl_timeout_ms
 
std::chrono::steady_clock::time_point ovl_start_time
 
std::vector< RenderCallbackrender_cbs
 
OnInputCallback on_ipt_cb
 
render::Renderer::Ref renderer
 
RMutex render_lock
 

Member Typedef Documentation

◆ DialogPrepareCallback

using pu::ui::Application::DialogPrepareCallback = std::function<void(Dialog::Ref&)>

◆ OnInputCallback

using pu::ui::Application::OnInputCallback = std::function<void(const u64, const u64, const u64, const TouchPoint)>

◆ RenderCallback

using pu::ui::Application::RenderCallback = std::function<void()>

◆ RenderOverFunction

using pu::ui::Application::RenderOverFunction = std::function<bool(render::Renderer::Ref&)>

Constructor & Destructor Documentation

◆ Application()

pu::ui::Application::Application ( render::Renderer::Ref renderer)

◆ ~Application()

virtual pu::ui::Application::~Application ( )
virtual

Member Function Documentation

◆ AddRenderCallback()

void pu::ui::Application::AddRenderCallback ( RenderCallback render_cb)
inline

◆ CallForRender()

bool pu::ui::Application::CallForRender ( )

◆ CallForRenderWithRenderOver()

bool pu::ui::Application::CallForRenderWithRenderOver ( RenderOverFunction render_over_fn)

◆ CanBeShown()

bool pu::ui::Application::CanBeShown ( )
inline

◆ Close()

void pu::ui::Application::Close ( const bool do_exit = false)

◆ CloseWithFadeOut()

void pu::ui::Application::CloseWithFadeOut ( const bool do_exit = false)
inline

◆ CreateShowDialog()

i32 pu::ui::Application::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 )

◆ EndOverlay()

void pu::ui::Application::EndOverlay ( )

◆ FadeIn()

void pu::ui::Application::FadeIn ( )

◆ FadeOut()

void pu::ui::Application::FadeOut ( )

◆ GetButtonsDown()

u64 pu::ui::Application::GetButtonsDown ( )
inline

◆ GetButtonsHeld()

u64 pu::ui::Application::GetButtonsHeld ( )
inline

◆ GetButtonsUp()

u64 pu::ui::Application::GetButtonsUp ( )
inline

◆ GetFadeBackgroundImageTexture()

sdl2::TextureHandle::Ref & pu::ui::Application::GetFadeBackgroundImageTexture ( )
inline

◆ GetLayout()

template<typename L >
std::shared_ptr< L > pu::ui::Application::GetLayout ( )
inline

◆ GetTouchState()

HidTouchScreenState pu::ui::Application::GetTouchState ( )
inline

◆ HasFadeBackgroundImage()

bool pu::ui::Application::HasFadeBackgroundImage ( )
inline

◆ IsFadedIn()

bool pu::ui::Application::IsFadedIn ( )
inline

◆ IsShown()

bool pu::ui::Application::IsShown ( )
inline

◆ LoadLayout()

void pu::ui::Application::LoadLayout ( Layout::Ref lyt)
inline

◆ LockRender()

void pu::ui::Application::LockRender ( )
inline

◆ OnLoad()

virtual void pu::ui::Application::OnLoad ( )
pure virtual

◆ OnRender()

void pu::ui::Application::OnRender ( )

◆ Prepare()

void pu::ui::Application::Prepare ( )

◆ ResetFadeBackgroundImage()

void pu::ui::Application::ResetFadeBackgroundImage ( )

◆ SetFadeAlphaIncrementStepCount()

void pu::ui::Application::SetFadeAlphaIncrementStepCount ( const u8 fade_alpha_increment_steps)
inline

◆ SetFadeBackgroundColor()

void pu::ui::Application::SetFadeBackgroundColor ( const Color clr)

◆ SetFadeBackgroundImage()

void pu::ui::Application::SetFadeBackgroundImage ( sdl2::TextureHandle::Ref bg_tex)

◆ SetOnInput()

void pu::ui::Application::SetOnInput ( OnInputCallback on_ipt_cb)
inline

◆ Show()

void pu::ui::Application::Show ( )

◆ ShowDialog()

i32 pu::ui::Application::ShowDialog ( Dialog::Ref & dialog)
inline

◆ ShowWithFadeIn()

void pu::ui::Application::ShowWithFadeIn ( )
inline

◆ StartOverlay()

void pu::ui::Application::StartOverlay ( Overlay::Ref ovl)
inline

◆ StartOverlayWithTimeout()

void pu::ui::Application::StartOverlayWithTimeout ( Overlay::Ref ovl,
const u64 ms )

◆ UnlockRender()

void pu::ui::Application::UnlockRender ( )
inline

Member Data Documentation

◆ DefaultFadeAlphaIncrementSteps

u8 pu::ui::Application::DefaultFadeAlphaIncrementSteps = 20
staticconstexpr

◆ fade_alpha

i32 pu::ui::Application::fade_alpha
protected

◆ fade_alpha_incr

SigmoidIncrementer<i32> pu::ui::Application::fade_alpha_incr
protected

◆ fade_alpha_increment_steps

u8 pu::ui::Application::fade_alpha_increment_steps
protected

◆ fade_bg_clr

Color pu::ui::Application::fade_bg_clr
protected

◆ fade_bg_tex

sdl2::TextureHandle::Ref pu::ui::Application::fade_bg_tex
protected

◆ in_render_over

bool pu::ui::Application::in_render_over
protected

◆ is_shown

bool pu::ui::Application::is_shown
protected

◆ loaded

bool pu::ui::Application::loaded
protected

◆ lyt

Layout::Ref pu::ui::Application::lyt
protected

◆ on_ipt_cb

OnInputCallback pu::ui::Application::on_ipt_cb
protected

◆ ovl

Overlay::Ref pu::ui::Application::ovl
protected

◆ ovl_start_time

std::chrono::steady_clock::time_point pu::ui::Application::ovl_start_time
protected

◆ ovl_timeout_ms

u64 pu::ui::Application::ovl_timeout_ms
protected

◆ render_cbs

std::vector<RenderCallback> pu::ui::Application::render_cbs
protected

◆ render_lock

RMutex pu::ui::Application::render_lock
protected

◆ render_over_fn

RenderOverFunction pu::ui::Application::render_over_fn
protected

◆ renderer

render::Renderer::Ref pu::ui::Application::renderer
protected

The documentation for this class was generated from the following file: