GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
button.h
Go to the documentation of this file.
1
8#ifndef BUTTON_H
9#define BUTTON_H
10
11#include <tonc_types.h>
12
13#define BTN_HIGHLIGHT_COLOR 0xFFFF
14
15#define BUTTON_SFX_VOLUME 154 // 60% of MM_SFX_FULL_VOLUME
16
20typedef void (*ButtonOnPressedFunc)(void);
21
25typedef bool (*ButtonCanBePressedFunc)(void);
26
30typedef struct
31{
32 // Using u8 for the palette indices to make sure they don't overflow pal_bg_mem
33
38
44
51
57} Button;
58
64void button_set_highlight(Button* button, bool highlight);
65
75void button_press(Button* button);
76
77#endif // BUTTON_H
void button_press(Button *button)
Execute a button press, by calling the button's on_pressed function. This checks the button's can_be_...
Definition button.c:18
bool(* ButtonCanBePressedFunc)(void)
Returns true if the button should be activated when pressed.
Definition button.h:25
void(* ButtonOnPressedFunc)(void)
The function to be called when the button is pressed.
Definition button.h:20
void button_set_highlight(Button *button, bool highlight)
Set the button highlight on or off.
Definition button.c:8
A button representation.
Definition button.h:31
ButtonOnPressedFunc on_pressed
Called when the button is pressed if can_be_pressed, don't call this directly, call button_press() in...
Definition button.h:50
u8 button_pal_idx
Palette index of the color of the button itself, used for the border when not highlighted.
Definition button.h:43
u8 border_pal_idx
Palette index of the button border whose color is updated depending on highlight.
Definition button.h:37
ButtonCanBePressedFunc can_be_pressed
Returns true if the button should be activated when pressed. Can be NULL if button can always be pres...
Definition button.h:56