# Plutonium framework API: Plutonium/include/pu/ui/extras/extras_Toast.hpp Source File

extras_Toast.hpp
Go to the documentation of this file.
/*
Plutonium library
@file extras_Toast.hpp
@brief An Overlay similar to Android's toast notifications
@author XorTroll
@copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
*/
#pragma once
#include <pu/ui/ui_Overlay.hpp>
#include <pu/ui/elm/elm_TextBlock.hpp>
namespace pu::ui::extras {
class Toast final : public Overlay {
public:
static constexpr i32 DefaultY = 550;
static constexpr i32 HeightAndTextHeightFactor = 3;
static constexpr i32 HorizontalMargin = 50;
static constexpr u8 BaseAlpha = 200;
private:
pu::ui::elm::TextBlock::Ref text;
void AdjustDimensions();
public:
Toast(const std::string &text, const std::string &font_name, const Color text_clr, const Color bg_clr);
PU_SMART_CTOR(Toast)
void SetText(const std::string &text);
void OnPreRender(render::Renderer::Ref &drawer) override;
void OnPostRender(render::Renderer::Ref &drawer) override;
};
}
pu::ui::Overlay
Definition: ui_Overlay.hpp:19
pu::ui::extras::Toast
Definition: extras_Toast.hpp:20
pu::ui::extras::Toast::DefaultY
static constexpr i32 DefaultY
Definition: extras_Toast.hpp:22
pu::ui::extras::Toast::HeightAndTextHeightFactor
static constexpr i32 HeightAndTextHeightFactor
Definition: extras_Toast.hpp:23
pu::ui::extras::Toast::Toast
Toast(const std::string &text, const std::string &font_name, const Color text_clr, const Color bg_clr)
pu::ui::extras::Toast::HorizontalMargin
static constexpr i32 HorizontalMargin
Definition: extras_Toast.hpp:24
pu::ui::extras::Toast::SetText
void SetText(const std::string &text)
pu::ui::extras::Toast::OnPostRender
void OnPostRender(render::Renderer::Ref &drawer) override
pu::ui::extras::Toast::BaseAlpha
static constexpr u8 BaseAlpha
Definition: extras_Toast.hpp:25
pu::ui::extras::Toast::OnPreRender
void OnPreRender(render::Renderer::Ref &drawer) override
elm_TextBlock.hpp
pu::sdl2::Renderer
SDL_Renderer * Renderer
Definition: sdl2_Types.hpp:13
pu::ui::extras
Definition: extras_Toast.hpp:18
pu::i32
s32 i32
Definition: pu_Include.hpp:28
PU_SMART_CTOR
#define PU_SMART_CTOR(type)
Definition: pu_Include.hpp:19
pu::ui::Color
Definition: ui_Types.hpp:44
ui_Overlay.hpp