cmdfx 0.3.2
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
42 CmdFX_Sprite* sprite, CmdFX_ButtonCallback callback, bool state
43);
44
60 char** on, char** off, char*** ansiOn, char*** ansiOff,
61 CmdFX_ButtonCallback callback, bool state
62);
63
74
85int Switch_setState(CmdFX_Button* button, bool state);
86
97
98#ifdef __cplusplus
99}
100#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:45
Represents a sprite that can be drawn to the terminal.
Definition sprites.h:31
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.