![]() |
cmdfx 0.2.1
Lightweight game engine for your terminal
|
UI extensions for Scenes in CmdFX. More...
Go to the source code of this file.
Macros | |
#define | MAX_BUTTONS_PER_SCENE 128 |
The maximum number of buttons per scene. | |
Functions | |
CmdFX_Button ** | Scene_getButtons (int uid) |
Gets the buttons of a scene. | |
int | Scene_getButtonsCount (int uid) |
Gets the number of buttons in a scene. | |
int * | Scene_getButtonCoordinates (int uid, CmdFX_Button *button) |
Gets the coordinates of a button in a scene. | |
int | Scene_addButton (int uid, CmdFX_Button *button, int x, int y) |
Adds a button to a scene. | |
int | Scene_removeButton (int uid, CmdFX_Button *button) |
Removes a button from a scene. | |
int | Scene_removeButtonAt (int uid, int x, int y) |
Removes a button from a scene at the specified coordinates. | |
int | Scene_removeAllButtons (int uid) |
Removes all buttons from a scene. | |
#define MAX_BUTTONS_PER_SCENE 128 |
The maximum number of buttons per scene.
This is the maximum number of buttons that can be added to a scene. If this limit is reached, no more buttons can be added to the scene.
int Scene_addButton | ( | int | uid, |
CmdFX_Button * | button, | ||
int | x, | ||
int | y ) |
Adds a button to a scene.
This function adds a button to a scene. The button is stored in the scene and can be used to interact with the scene. The scene must be registered in order to add buttons to it.
uid | The unique identifier of the scene. |
button | The button to add to the scene. |
x | The x-coordinate of the button. |
y | The y-coordinate of the button. |
0
if the button was added successfully, or -1
if an error occurred. int * Scene_getButtonCoordinates | ( | int | uid, |
CmdFX_Button * | button ) |
Gets the coordinates of a button in a scene.
This function gets the coordinates of a button in a scene. The coordinates are stored in the scene and can be used to interact with the scene.
The array returned is a pointer to an array of two integers, where X is the first element and Y is the second element. The coordinates are relative to the scene. The array will be freed when the scene is freed, so it should not be freed by the caller. If the button is not found, this function returns NULL
.
uid | The unique identifier of the scene. |
button | The button to get the coordinates of. |
CmdFX_Button ** Scene_getButtons | ( | int | uid | ) |
Gets the buttons of a scene.
This function gets the buttons of a scene. The buttons are stored in the scene and can be used to interact with the scene. The scene must be registered in order to add buttons to it.
uid | The unique identifier of the scene. |
int Scene_getButtonsCount | ( | int | uid | ) |
Gets the number of buttons in a scene.
This function gets the number of buttons in a scene. The buttons are stored in the scene and can be used to interact with the scene. The scene must be registered in order to add buttons to it.
uid | The unique identifier of the scene. |
int Scene_removeAllButtons | ( | int | uid | ) |
Removes all buttons from a scene.
This function removes all buttons from a scene. The buttons are removed from the scene and can no longer be used to interact with the scene, and the array of buttons is freed. The scene must be registered in order to remove buttons from it. The buttons are not freed, only the array of buttons.
uid | The unique identifier of the scene. |
0
if all buttons were removed successfully, or -1
if an error occurred. int Scene_removeButton | ( | int | uid, |
CmdFX_Button * | button ) |
Removes a button from a scene.
This function removes a button from a scene. The button is removed from the scene and can no longer be used to interact with the scene. The scene must be registered in order to remove buttons from it.
uid | The unique identifier of the scene. |
button | The button to remove from the scene. |
0
if the button was removed successfully, or -1
if an error occurred. int Scene_removeButtonAt | ( | int | uid, |
int | x, | ||
int | y ) |
Removes a button from a scene at the specified coordinates.
This function removes a button from a scene at the specified coordinates. The button is removed from the scene and can no longer be used to interact with the scene. The scene must be registered in order to remove buttons from it. The button is not freed, only the array of buttons is freed. The button is removed from the scene and can no longer be used to interact with the scene.
uid | The unique identifier of the scene. |
x | The x-coordinate of the button to remove. |
y | The y-coordinate of the button to remove. |
0
if the button was removed successfully, or -1
if an error occurred.