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
20
typedef
void (*
ButtonOnPressedFunc
)(void);
21
25
typedef
bool (*
ButtonCanBePressedFunc
)(void);
26
30
typedef
struct
31
{
32
// Using u8 for the palette indices to make sure they don't overflow pal_bg_mem
33
37
u8
border_pal_idx
;
38
43
u8
button_pal_idx
;
44
50
ButtonOnPressedFunc
on_pressed
;
51
56
ButtonCanBePressedFunc
can_be_pressed
;
57
}
Button
;
58
64
void
button_set_highlight
(
Button
* button,
bool
highlight);
65
75
void
button_press
(
Button
* button);
76
77
#endif
// BUTTON_H
button_press
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
ButtonCanBePressedFunc
bool(* ButtonCanBePressedFunc)(void)
Returns true if the button should be activated when pressed.
Definition
button.h:25
ButtonOnPressedFunc
void(* ButtonOnPressedFunc)(void)
The function to be called when the button is pressed.
Definition
button.h:20
button_set_highlight
void button_set_highlight(Button *button, bool highlight)
Set the button highlight on or off.
Definition
button.c:8
Button
A button representation.
Definition
button.h:31
Button::on_pressed
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
Button::button_pal_idx
u8 button_pal_idx
Palette index of the color of the button itself, used for the border when not highlighted.
Definition
button.h:43
Button::border_pal_idx
u8 border_pal_idx
Palette index of the button border whose color is updated depending on highlight.
Definition
button.h:37
Button::can_be_pressed
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
include
button.h
Generated by
1.9.8