summaryrefslogtreecommitdiffstats
path: root/src/gba-buttons.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gba-buttons.c')
-rw-r--r--src/gba-buttons.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/gba-buttons.c b/src/gba-buttons.c
index ee6458d..de62212 100644
--- a/src/gba-buttons.c
+++ b/src/gba-buttons.c
@@ -228,26 +228,23 @@ u32 gba_btn_b_data[112][8] = {
228 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 228 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
229}; 229};
230 230
231typedef enum {GBA_BTN_STATE_IDLE, GBA_BTN_STATE_PRESSED} GbaBtnState;
232typedef struct SpriteAnimation { 231typedef struct SpriteAnimation {
233 size_t *tile_offsets; 232 size_t *tile_offsets;
234 size_t n_frames; 233 size_t n_frames;
235} SpriteAnimation; 234} SpriteAnimation;
236 235
237static size_t gba_btn_state_idle[] = {0}; 236typedef enum {BTN_STATE_IDLE, BTN_STATE_PRESSED} BtnState;
238static size_t gba_btn_state_pressed[] = {0, 16, 16, 32, 32, 48, 48, 64, 64, 80, 96};
239 237
240SpriteAnimation anim_idle = { 238static size_t btn_state_idle[] = {0};
241 .tile_offsets = &gba_btn_state_idle, 239static size_t btn_state_pressed[] = {16, 16, 32, 32, 48, 48, 64, 64, 80, 96};
242 .n_frames = sizeof(gba_btn_state_idle) / sizeof(size_t),
243};
244
245SpriteAnimation anim_pressed = {
246 .tile_offsets = &gba_btn_state_pressed,
247 .n_frames = sizeof(gba_btn_state_pressed) / sizeof(size_t),
248};
249 240
250SpriteAnimation *animation_states[] = { 241static SpriteAnimation *animation_states[] = {
251 &anim_idle, 242 &(SpriteAnimation){
252 &anim_pressed, 243 .tile_offsets = &btn_state_idle,
244 .n_frames = sizeof(btn_state_idle) / sizeof(size_t),
245 },
246 &(SpriteAnimation){
247 .tile_offsets = &btn_state_pressed,
248 .n_frames = sizeof(btn_state_pressed) / sizeof(size_t),
249 },
253}; 250};