An abstract class meant to be extended with specific implementations for different renderers. It also provides basic methods called on update to manage navigation in the vertical axis. All overrideable methods on this class are meant to provide ways to implement a simple immediate GUI, not a stateful GUI.
More...
#include <AbstractGUI.h>
|
| GUIElementId | GetNextId () |
| | Use this method withing selectable elements to provide them a unique id while the UI layout remains the same. If called deterministically, the same selectable elements should always have the same IDs if the layout didn't change.
|
|
virtual void | OnUpdate () |
| | Override this if the new system requires additional data processed each frame.
|
An abstract class meant to be extended with specific implementations for different renderers. It also provides basic methods called on update to manage navigation in the vertical axis. All overrideable methods on this class are meant to provide ways to implement a simple immediate GUI, not a stateful GUI.
Guarantees:
- When implemented, UI shows each frame it is shown.
- State of the currently selected UI element is the same while the UI layout don't change and GetNextId is called when needed.
Not responsible:
- GetNextId should be called inside of the implementation when a element is selectable.
◆ AbstractGUI()
- Parameters
-
| catalog | Catalog from which to get the UI sprites. |
| renderer | Renderer used to draw the images. |
| actionManager | Action manager, used to interact with interactable UI elements, like buttons. |
◆ Button()
Shows a button with a text. It should be able to be navigated and pressed with the mouse.
- Parameters
-
| options | Options for the button. Check GUIButtonOptions. |
| label | Text that the button will show. Use an empty string if you don't want text. |
| textOptions | Options for the text. Check GUITextOptions. |
- Returns
- The state of the button in this frame, including if it is focused, pressed and released.
Reimplemented in Mochi::Graphics::SDLGUI.
◆ GetNextId()
| GUIElementId Mochi::Graphics::AbstractGUI::GetNextId |
( |
| ) |
|
|
protected |
Use this method withing selectable elements to provide them a unique id while the UI layout remains the same. If called deterministically, the same selectable elements should always have the same IDs if the layout didn't change.
- Returns
- The id of the element.
◆ Sprite()
Shows a sprite.
- Parameters
-
- Returns
- Space occupied by the UI, to be used as parent of other UIs.
Reimplemented in Mochi::Graphics::SDLGUI.
◆ Text()
Shows a text.
- Parameters
-
| label | The text to show. |
| options | Options for the text. Check GUITextOptions. |
- Returns
- Space occupied by the UI, to be used as parent of other UIs.
Reimplemented in Mochi::Graphics::SDLGUI.
◆ Update()
| void Mochi::Graphics::AbstractGUI::Update |
( |
const float & | dt | ) |
|
Resets the current selectable element count for elements to use GetNextId again this frame. Also checks vertical axis input to move the selected element.
- Parameters
-
The documentation for this class was generated from the following files: