diff options
Diffstat (limited to 'src/gba-buttons.c')
-rw-r--r-- | src/gba-buttons.c | 27 |
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 | ||
231 | typedef enum {GBA_BTN_STATE_IDLE, GBA_BTN_STATE_PRESSED} GbaBtnState; | ||
232 | typedef struct SpriteAnimation { | 231 | typedef 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 | ||
237 | static size_t gba_btn_state_idle[] = {0}; | 236 | typedef enum {BTN_STATE_IDLE, BTN_STATE_PRESSED} BtnState; |
238 | static size_t gba_btn_state_pressed[] = {0, 16, 16, 32, 32, 48, 48, 64, 64, 80, 96}; | ||
239 | 237 | ||
240 | SpriteAnimation anim_idle = { | 238 | static size_t btn_state_idle[] = {0}; |
241 | .tile_offsets = &gba_btn_state_idle, | 239 | static 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 | |||
245 | SpriteAnimation anim_pressed = { | ||
246 | .tile_offsets = &gba_btn_state_pressed, | ||
247 | .n_frames = sizeof(gba_btn_state_pressed) / sizeof(size_t), | ||
248 | }; | ||
249 | 240 | ||
250 | SpriteAnimation *animation_states[] = { | 241 | static 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 | }; |