From 58d00f8ff54697b6f30cb6e12321ebc5a2377331 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Wed, 21 Apr 2021 14:43:04 +0200 Subject: Cleanup sprite animation code in gba-buttons --- src/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 8c1e82d..2015ee0 100644 --- a/src/main.c +++ b/src/main.c @@ -460,7 +460,7 @@ typedef struct ButtonSprite { int x; int y; int frame; - GbaBtnState state; + BtnState state; } ButtonSprite; #define NUM_SPRITES 128 @@ -516,7 +516,7 @@ int main(void) { .x = buttons_x, .y = buttons_y, .frame = 0, - .state = GBA_BTN_STATE_IDLE, + .state = BTN_STATE_IDLE, }; OBJ_ATTR_0(btn_b.id) = btn_b.y; OBJ_ATTR_1(btn_b.id) = btn_b.x | (1 << 0xF); @@ -527,7 +527,7 @@ int main(void) { .x = buttons_x + 20, .y = buttons_y - 16, .frame = 0, - .state = GBA_BTN_STATE_IDLE, + .state = BTN_STATE_IDLE, }; OBJ_ATTR_0(btn_a.id) = btn_a.y; OBJ_ATTR_1(btn_a.id) = btn_a.x | (1 << 0xF); @@ -551,7 +551,7 @@ int main(void) { } if (key_pressed(KEY_B)) { btn_b.frame = 0; - btn_b.state = GBA_BTN_STATE_PRESSED; + btn_b.state = BTN_STATE_PRESSED; } else if (key_hold(KEY_B)) { size_t n_frames = animation_states[btn_b.state]->n_frames; if (btn_b.frame < n_frames - 1) { @@ -564,12 +564,12 @@ int main(void) { btn_b.frame++; } else { btn_b.frame = 0; - btn_b.state = GBA_BTN_STATE_IDLE; + btn_b.state = BTN_STATE_IDLE; } } if (key_pressed(KEY_A)) { btn_a.frame = 0; - btn_a.state = GBA_BTN_STATE_PRESSED; + btn_a.state = BTN_STATE_PRESSED; } else if (key_hold(KEY_A)) { size_t n_frames = animation_states[btn_a.state]->n_frames; if (btn_a.frame < n_frames - 1) { @@ -582,7 +582,7 @@ int main(void) { btn_a.frame++; } else { btn_a.frame = 0; - btn_a.state = GBA_BTN_STATE_IDLE; + btn_a.state = BTN_STATE_IDLE; } } if (key_pressed(KEY_L)) { -- cgit v1.2.1