![]() |
cmdfx 0.2.1
Lightweight game engine for your terminal
|
Switch extensions for the CmdFX Button API. More...
Go to the source code of this file.
Macros | |
#define | CMDFX_BUTTON_TYPE_SWITCH 1 |
Represents a CmdFX switch button. | |
Functions | |
CmdFX_Button * | Button_createSwitch (CmdFX_Sprite *sprite, CmdFX_ButtonCallback callback, bool state) |
Creates a switch button. | |
CmdFX_Button * | Button_createSwitchWith (char **on, char **off, char ***ansiOn, char ***ansiOff, CmdFX_ButtonCallback callback, bool state) |
Creates a switch button with the given on and off states. | |
bool | Switch_getState (CmdFX_Button *button) |
Gets the state of the switch button. | |
int | Switch_setState (CmdFX_Button *button, bool state) |
Sets the state of the switch button. | |
int | Switch_toggleState (CmdFX_Button *button) |
Toggles the state of the switch button. | |
#define CMDFX_BUTTON_TYPE_SWITCH 1 |
Represents a CmdFX switch button.
Switch buttons are a type of button that can be toggled on and off. They also can change costumes based on their state. Their extra
field is a pointer to a boolean that indicates the state of the switch.
CmdFX_Button * Button_createSwitch | ( | CmdFX_Sprite * | sprite, |
CmdFX_ButtonCallback | callback, | ||
bool | state ) |
Creates a switch button.
This function creates a switch button with the given sprite and callback function.
sprite | |
callback | |
state |
CmdFX_Button * Button_createSwitchWith | ( | char ** | on, |
char ** | off, | ||
char *** | ansiOn, | ||
char *** | ansiOff, | ||
CmdFX_ButtonCallback | callback, | ||
bool | state ) |
Creates a switch button with the given on and off states.
This function creates a switch button with the given on and off states. The button will be created with the given sprite and callback function.
on | The string to display when the button is on. |
off | The string to display when the button is off. |
ansiOn | The ANSI codes to use when the button is on. |
ansiOff | The ANSI codes to use when the button is off. |
callback | The callback function to call when the button is clicked. |
state | The initial state of the button (0 = off, 1 = on). |
bool Switch_getState | ( | CmdFX_Button * | button | ) |
Gets the state of the switch button.
This function gets the state of the switch button. The state is stored in the extra
field of the button, which is a pointer to a boolean.
button | The button to get the state of. |
int Switch_setState | ( | CmdFX_Button * | button, |
bool | state ) |
Sets the state of the switch button.
This function sets the state of the switch button. The state is stored in the extra
field of the button, which is a pointer to a boolean.
button | The button to set the state of. |
state | The new state of the switch button (0 = off, 1 = on). |
int Switch_toggleState | ( | CmdFX_Button * | button | ) |
Toggles the state of the switch button.
This function toggles the state of the switch button. The state is stored in the extra
field of the button, which is a pointer to a boolean.
button | The button to toggle the state of. |