diff options
Diffstat (limited to 'src/gba-buttons.c')
-rw-r--r-- | src/gba-buttons.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gba-buttons.c b/src/gba-buttons.c index 0f6218a..ee6458d 100644 --- a/src/gba-buttons.c +++ b/src/gba-buttons.c | |||
@@ -227,3 +227,27 @@ u32 gba_btn_b_data[112][8] = { | |||
227 | {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 227 | {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
228 | {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 228 | {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
229 | }; | 229 | }; |
230 | |||
231 | typedef enum {GBA_BTN_STATE_IDLE, GBA_BTN_STATE_PRESSED} GbaBtnState; | ||
232 | typedef struct SpriteAnimation { | ||
233 | size_t *tile_offsets; | ||
234 | size_t n_frames; | ||
235 | } SpriteAnimation; | ||
236 | |||
237 | static size_t gba_btn_state_idle[] = {0}; | ||
238 | static size_t gba_btn_state_pressed[] = {0, 16, 16, 32, 32, 48, 48, 64, 64, 80, 96}; | ||
239 | |||
240 | SpriteAnimation anim_idle = { | ||
241 | .tile_offsets = &gba_btn_state_idle, | ||
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 | |||
250 | SpriteAnimation *animation_states[] = { | ||
251 | &anim_idle, | ||
252 | &anim_pressed, | ||
253 | }; | ||