diff options
author | Bad Diode <bd@badd10de.dev> | 2021-04-21 14:02:30 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-04-21 14:02:30 +0200 |
commit | aa7e7fc98deddaed3b8dbb1942ec954f6b4c016f (patch) | |
tree | 3d7d3b46aefd4e474cfcd4bfe7488b0f25b508c1 /src/gba-buttons.c | |
parent | e10a71a8d5c89f8dd01a77e28abcf474061680e6 (diff) | |
download | gba-experiments-aa7e7fc98deddaed3b8dbb1942ec954f6b4c016f.tar.gz gba-experiments-aa7e7fc98deddaed3b8dbb1942ec954f6b4c016f.zip |
Experiment with enabling multiple animation states
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 | }; | ||