Plutonium framework API 0.3.0
UI framework libraries for libnx
extras_Toast.hpp
Go to the documentation of this file.
1
2/*
3
4 Plutonium library
5
6 @file extras_Toast.hpp
7 @brief An Overlay similar to Android's toast notifications
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_Overlay.hpp>
17
18namespace pu::ui::extras {
19
20 class Toast final : public Overlay {
21 public:
22 static constexpr i32 DefaultY = 550;
23 static constexpr i32 HeightAndTextHeightFactor = 3;
24 static constexpr i32 HorizontalMargin = 50;
25 static constexpr u8 BaseAlpha = 200;
26
27 private:
28 pu::ui::elm::TextBlock::Ref text;
29
30 void AdjustDimensions();
31
32 public:
33 Toast(const std::string &text, const std::string &font_name, const Color text_clr, const Color bg_clr);
35
36 void SetText(const std::string &text);
37 void OnPreRender(render::Renderer::Ref &drawer) override;
38 void OnPostRender(render::Renderer::Ref &drawer) override;
39 };
40
41}
Definition: ui_Overlay.hpp:19
Definition: extras_Toast.hpp:20
static constexpr i32 DefaultY
Definition: extras_Toast.hpp:22
static constexpr i32 HeightAndTextHeightFactor
Definition: extras_Toast.hpp:23
Toast(const std::string &text, const std::string &font_name, const Color text_clr, const Color bg_clr)
static constexpr i32 HorizontalMargin
Definition: extras_Toast.hpp:24
void SetText(const std::string &text)
void OnPostRender(render::Renderer::Ref &drawer) override
static constexpr u8 BaseAlpha
Definition: extras_Toast.hpp:25
void OnPreRender(render::Renderer::Ref &drawer) override
SDL_Renderer * Renderer
Definition: sdl2_Types.hpp:13
Definition: extras_Toast.hpp:18
s32 i32
Definition: pu_Include.hpp:28
#define PU_SMART_CTOR(type)
Definition: pu_Include.hpp:19
Definition: ui_Types.hpp:44