GUI: SceneManager API.
More...
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
|
typedef void(* | AppSceneOnEnterCallback) (void *context) |
| Prototype for Scene on_enter handler.
|
|
typedef bool(* | AppSceneOnEventCallback) (void *context, SceneManagerEvent event) |
| Prototype for Scene on_event handler.
|
|
typedef void(* | AppSceneOnExitCallback) (void *context) |
| Prototype for Scene on_exit handler.
|
|
typedef struct SceneManager | SceneManager |
|
|
enum | SceneManagerEventType { SceneManagerEventTypeCustom
, SceneManagerEventTypeBack
, SceneManagerEventTypeTick
} |
| Scene Manager events type.
|
|
|
void | scene_manager_set_scene_state (SceneManager *scene_manager, uint32_t scene_id, uint32_t state) |
| Set Scene state.
|
|
uint32_t | scene_manager_get_scene_state (const SceneManager *scene_manager, uint32_t scene_id) |
| Get Scene state.
|
|
SceneManager * | scene_manager_alloc (const SceneManagerHandlers *app_scene_handlers, void *context) |
| Scene Manager allocation and configuration.
|
|
void | scene_manager_free (SceneManager *scene_manager) |
| Free Scene Manager with allocated Scenes.
|
|
bool | scene_manager_handle_custom_event (SceneManager *scene_manager, uint32_t custom_event) |
| Custom event handler.
|
|
bool | scene_manager_handle_back_event (SceneManager *scene_manager) |
| Back event handler.
|
|
void | scene_manager_handle_tick_event (SceneManager *scene_manager) |
| Tick event handler.
|
|
void | scene_manager_next_scene (SceneManager *scene_manager, uint32_t next_scene_id) |
| Add and run next Scene.
|
|
bool | scene_manager_previous_scene (SceneManager *scene_manager) |
| Run previous Scene.
|
|
bool | scene_manager_has_previous_scene (const SceneManager *scene_manager, uint32_t scene_id) |
| Search previous Scene.
|
|
bool | scene_manager_search_and_switch_to_previous_scene (SceneManager *scene_manager, uint32_t scene_id) |
| Search and switch to previous Scene.
|
|
bool | scene_manager_search_and_switch_to_previous_scene_one_of (SceneManager *scene_manager, const uint32_t *scene_ids, size_t scene_ids_size) |
| Search and switch to previous Scene, multiple choice.
|
|
bool | scene_manager_search_and_switch_to_another_scene (SceneManager *scene_manager, uint32_t scene_id) |
| Clear Scene stack and switch to another Scene.
|
|
void | scene_manager_stop (SceneManager *scene_manager) |
| Exit from current scene.
|
|
◆ scene_manager_alloc()
Scene Manager allocation and configuration.
Scene Manager allocates all scenes internally
- Parameters
-
app_scene_handlers | SceneManagerHandlers instance |
context | context to be set on Scene handlers calls |
- Returns
- SceneManager instance
◆ scene_manager_free()
Free Scene Manager with allocated Scenes.
- Parameters
-
scene_manager | SceneManager instance |
◆ scene_manager_get_scene_state()
uint32_t scene_manager_get_scene_state |
( |
const SceneManager * | scene_manager, |
|
|
uint32_t | scene_id ) |
Get Scene state.
- Parameters
-
scene_manager | SceneManager instance |
scene_id | Scene ID |
- Returns
- Scene state
◆ scene_manager_handle_back_event()
bool scene_manager_handle_back_event |
( |
SceneManager * | scene_manager | ) |
|
Back event handler.
Calls Scene event handler with Back event parameter
- Parameters
-
scene_manager | SceneManager instance |
- Returns
- true if event was consumed, false otherwise
◆ scene_manager_handle_custom_event()
bool scene_manager_handle_custom_event |
( |
SceneManager * | scene_manager, |
|
|
uint32_t | custom_event ) |
Custom event handler.
Calls Scene event handler with Custom event parameter
- Parameters
-
scene_manager | SceneManager instance |
custom_event | Custom event code |
- Returns
- true if event was consumed, false otherwise
◆ scene_manager_handle_tick_event()
void scene_manager_handle_tick_event |
( |
SceneManager * | scene_manager | ) |
|
Tick event handler.
Calls Scene event handler with Tick event parameter
- Parameters
-
scene_manager | SceneManager instance |
◆ scene_manager_has_previous_scene()
bool scene_manager_has_previous_scene |
( |
const SceneManager * | scene_manager, |
|
|
uint32_t | scene_id ) |
Search previous Scene.
- Parameters
-
scene_manager | SceneManager instance |
scene_id | Scene ID |
- Returns
- true if previous scene was found, false otherwise
◆ scene_manager_next_scene()
void scene_manager_next_scene |
( |
SceneManager * | scene_manager, |
|
|
uint32_t | next_scene_id ) |
Add and run next Scene.
- Parameters
-
scene_manager | SceneManager instance |
next_scene_id | next Scene ID |
◆ scene_manager_previous_scene()
bool scene_manager_previous_scene |
( |
SceneManager * | scene_manager | ) |
|
Run previous Scene.
- Parameters
-
scene_manager | SceneManager instance |
- Returns
- true if previous scene was found, false otherwise
◆ scene_manager_search_and_switch_to_another_scene()
bool scene_manager_search_and_switch_to_another_scene |
( |
SceneManager * | scene_manager, |
|
|
uint32_t | scene_id ) |
Clear Scene stack and switch to another Scene.
- Parameters
-
scene_manager | SceneManager instance |
scene_id | Scene ID |
- Returns
- true if previous scene was found, false otherwise
◆ scene_manager_search_and_switch_to_previous_scene()
bool scene_manager_search_and_switch_to_previous_scene |
( |
SceneManager * | scene_manager, |
|
|
uint32_t | scene_id ) |
Search and switch to previous Scene.
- Parameters
-
scene_manager | SceneManager instance |
scene_id | Scene ID |
- Returns
- true if previous scene was found, false otherwise
◆ scene_manager_search_and_switch_to_previous_scene_one_of()
bool scene_manager_search_and_switch_to_previous_scene_one_of |
( |
SceneManager * | scene_manager, |
|
|
const uint32_t * | scene_ids, |
|
|
size_t | scene_ids_size ) |
Search and switch to previous Scene, multiple choice.
- Parameters
-
scene_manager | SceneManager instance |
scene_ids | Array of scene IDs |
scene_ids_size | Array of scene IDs size |
- Returns
- true if one of previous scenes was found, false otherwise
◆ scene_manager_set_scene_state()
void scene_manager_set_scene_state |
( |
SceneManager * | scene_manager, |
|
|
uint32_t | scene_id, |
|
|
uint32_t | state ) |
Set Scene state.
- Parameters
-
scene_manager | SceneManager instance |
scene_id | Scene ID |
state | Scene new state |
◆ scene_manager_stop()
Exit from current scene.
- Parameters
-
scene_manager | SceneManager instance |