Go to the source code of this file.
|
|
typedef std::function< void()> | ui::callback_t |
| | A callback function that takes no arguments and returns nothing.
|
| |
◆ getWidgetById()
| Widget * ui::getWidgetById |
( |
id_t |
id | ) |
|
|
noexcept |
Get the first widget (root or any children) that has the given ID.
An ID is expected to be a unique, typically non-zero value. To generate an id, you can either call ui::id("some text"), or (for constant strings only), "some text"_id.
- Parameters
-
| id | The unique identifier of the widget. |
- Returns
- A pointer to the widget, or
nullptr if not found.
◆ render()
| void ui::render |
( |
bool |
block = true | ) |
|
Update all UI elements and re-render any areas that need it.
- Parameters
-
| block | If true, save CPU usage by blocking until it's time to render the screen. If false, return immediately if it's not time to render yet. |
◆ setRoot()
| void ui::setRoot |
( |
Widget *const |
root | ) |
|
Set the root widget for the UI to render.
- Parameters
-
| root | The topmost widget where rendering starts. |
◆ setTimeout()
| void ui::setTimeout |
( |
callback_t |
callback, |
|
|
time_t |
timeout |
|
) |
| |
Schedule a function to run after a delay.
Callback functions will be postponed for at least the number of milliseconds specified, but may wait slightly longer, depending on refresh rate.
- Parameters
-
| callback | The function to run. |
| timeout | The number of milliseconds to wait. |
◆ showBoundingBoxes()
| void ui::showBoundingBoxes |
( |
bool |
enable | ) |
|
Toggle whether bounding boxes are displayed for all widgets.
- Parameters
-
| enable | If true, show bounding boxes. If false, hide bounding boxes. |
- Note
- This function is only available in debug builds.