|
Plutonium framework API 1.0.0
Easy-to-use, SDL2-based UI framework for Nintendo Switch homebrew
|
Class that represents a layout, the core UI container in the library. More...
#include <ui_Layout.hpp>
Public Types | |
| using | OnInputCallback = std::function<void(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos)> |
| Callback type used for input handling. | |
| using | RenderCallback = std::function<void()> |
| Callback type used for rendering. | |
Public Member Functions | |
| Layout () | |
| Creates a new Layout with the default background (white-ish). | |
| virtual | ~Layout () |
| bool | HasChildren () |
| Checks whether the Layout has any children. | |
| void | SetOnInput (OnInputCallback on_ipt_cb) |
| Sets the input callback for the Layout. | |
| OnInputCallback | GetOnInput () |
| Gets the input callback for the Layout. | |
| void | AddRenderCallback (RenderCallback render_cb) |
| Adds a render callback to the Layout. | |
| std::vector< RenderCallback > & | GetRenderCallbacks () |
| Gets all render callbacks from the Layout. | |
| bool | HasBackgroundImage () |
| Checks whether the Layout has a background image. | |
| sdl2::TextureHandle::Ref & | GetBackgroundImageTexture () |
| Gets the background image texture of the Layout. | |
| Color | GetBackgroundColor () |
| Gets the background color of the Layout. | |
| void | SetBackgroundImage (sdl2::TextureHandle::Ref bg_tex) |
| Sets the background image of the Layout. | |
| void | ResetBackgroundImage () |
| Resets the background image of the Layout. | |
| void | SetBackgroundColor (const Color clr) |
| Sets the background color of the Layout. | |
| void | SimulateTouchPosition (const TouchPoint sim_touch_pos) |
| Simulates a (fake) touch for the Layout. | |
| TouchPoint | ConsumeSimulatedTouchPosition () |
| Consumes (gets and then resets) the simulated touch position. | |
Public Member Functions inherited from pu::ui::Container | |
| Container (const i32 x, const i32 y, const i32 width, const i32 height) | |
| Creates a new Container with the specified position and size. | |
| void | Add (elm::Element::Ref elem) |
| Adds an Element to the Container. | |
| std::vector< elm::Element::Ref > & | GetElements () |
| Gets the list of Elements in the Container. | |
| bool | Has (elm::Element::Ref &elem) |
| Gets whether the Container has the specified Element. | |
| void | Clear () |
| Removes all elements from the Container. | |
| void | PreRender () |
| Function to be invoked before rendering the Container. | |
Static Public Attributes | |
| static constexpr Color | DefaultBackgroundColor = { 0xE1, 0xE1, 0xE1, 0xFF } |
| Default background color for Layouts (white-ish). | |
Additional Inherited Members | |
Protected Attributes inherited from pu::ui::Container | |
| i32 | x |
| i32 | y |
| i32 | w |
| i32 | h |
| std::vector< elm::Element::Ref > | elems |
Class that represents a layout, the core UI container in the library.
| using pu::ui::Layout::OnInputCallback = std::function<void(const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos)> |
Callback type used for input handling.
| keys_down | Keys that were pressed in this frame. |
| keys_up | Keys that were released in this frame. |
| keys_held | Keys that are being held in this frame. |
| touch_pos | Touch position in this frame. |
| using pu::ui::Layout::RenderCallback = std::function<void()> |
Callback type used for rendering.
|
inline |
Creates a new Layout with the default background (white-ish).
|
virtual |
|
inline |
Adds a render callback to the Layout.
| render_cb | Render callback to add. |
| TouchPoint pu::ui::Layout::ConsumeSimulatedTouchPosition | ( | ) |
Consumes (gets and then resets) the simulated touch position.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void pu::ui::Layout::ResetBackgroundImage | ( | ) |
| void pu::ui::Layout::SetBackgroundColor | ( | const Color | clr | ) |
Sets the background color of the Layout.
| clr | Background color to set. |
| void pu::ui::Layout::SetBackgroundImage | ( | sdl2::TextureHandle::Ref | bg_tex | ) |
Sets the background image of the Layout.
| bg_tex | Background image texture to set. |
|
inline |
Sets the input callback for the Layout.
| on_ipt_cb | Input callback to set. |
|
inline |
Simulates a (fake) touch for the Layout.
| sim_touch_pos | Touch position to simulate. |
|
staticconstexpr |
Default background color for Layouts (white-ish).