cmdfx 0.2.1
Lightweight game engine for your terminal
Loading...
Searching...
No Matches
switch.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <stdbool.h>
14
15#include "cmdfx/ui/button.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
28#define CMDFX_BUTTON_TYPE_SWITCH 1
29
41
56CmdFX_Button* Button_createSwitchWith(char** on, char** off, char*** ansiOn, char*** ansiOff, CmdFX_ButtonCallback callback, bool state);
57
68
79int Switch_setState(CmdFX_Button* button, bool state);
80
91
92#ifdef __cplusplus
93}
94#endif
Button declarations for the CmdFX UI Library.
void(* CmdFX_ButtonCallback)(void *button, CmdFX_MouseEvent *event, unsigned long long time)
The callback function to be called when the button is clicked.
Definition button.h:33
Represents a CmdFX button.
Definition button.h:42
Represents a sprite that can be drawn to the terminal.
Definition sprites.h:30
bool Switch_getState(CmdFX_Button *button)
Gets the state of the switch button.
CmdFX_Button * Button_createSwitch(CmdFX_Sprite *sprite, CmdFX_ButtonCallback callback, bool state)
Creates a 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.
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.