Mercurial > molko
diff libmlk-rpg/mlk/rpg/battle-bar-default.c @ 450:b26dd49f69ff
core: event -> mlk_event (and friends)
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 18 Feb 2023 13:37:11 +0100 |
parents | 773a082f0b91 |
children | 90a097b1aa0f |
line wrap: on
line diff
--- a/libmlk-rpg/mlk/rpg/battle-bar-default.c Sat Feb 18 13:16:40 2023 +0100 +++ b/libmlk-rpg/mlk/rpg/battle-bar-default.c Sat Feb 18 13:37:11 2023 +0100 @@ -394,24 +394,24 @@ * one of the Attack, Magic, Item and Special items. */ static void -handle_keydown_menu(struct battle_bar_default *bar, struct battle *bt, const union event *ev) +handle_keydown_menu(struct battle_bar_default *bar, struct battle *bt, const union mlk_event *ev) { (void)bt; switch (ev->key.key) { - case KEY_UP: + case MLK_KEY_UP: bar->menu = BATTLE_BAR_DEFAULT_MENU_ATTACK; break; - case KEY_RIGHT: + case MLK_KEY_RIGHT: bar->menu = BATTLE_BAR_DEFAULT_MENU_MAGIC; break; - case KEY_DOWN: + case MLK_KEY_DOWN: bar->menu = BATTLE_BAR_DEFAULT_MENU_ITEM; break; - case KEY_LEFT: + case MLK_KEY_LEFT: bar->menu = BATTLE_BAR_DEFAULT_MENU_SPECIAL; break; - case KEY_ENTER: + case MLK_KEY_ENTER: /* * At this step, attack does not require opening the sub menu so * we change selection state immediately if needed. @@ -440,10 +440,10 @@ * and Magic. */ static void -handle_keydown_grid(struct battle_bar_default *bar, struct battle *bt, const union event *ev) +handle_keydown_grid(struct battle_bar_default *bar, struct battle *bt, const union mlk_event *ev) { /* Go back to main menu if I press escape. */ - if (ev->key.key == KEY_ESCAPE) + if (ev->key.key == MLK_KEY_ESCAPE) bar->state = BATTLE_BAR_DEFAULT_STATE_MENU; else if (gridmenu_handle(&bar->grid, ev)) { switch (bar->menu) { @@ -460,11 +460,11 @@ } static void -handle_keydown(struct battle_bar_default *bar, struct battle *bt, const union event *ev) +handle_keydown(struct battle_bar_default *bar, struct battle *bt, const union mlk_event *ev) { - assert(ev->type == EVENT_KEYDOWN); + assert(ev->type == MLK_EVENT_KEYDOWN); - static void (*handlers[])(struct battle_bar_default *, struct battle *, const union event *) = { + static void (*handlers[])(struct battle_bar_default *, struct battle *, const union mlk_event *) = { [BATTLE_BAR_DEFAULT_STATE_MENU] = handle_keydown_menu, [BATTLE_BAR_DEFAULT_STATE_GRID] = handle_keydown_grid }; @@ -515,7 +515,7 @@ } static void -self_handle(struct battle_bar *bar, struct battle *bt, const union event *ev) +self_handle(struct battle_bar *bar, struct battle *bt, const union mlk_event *ev) { battle_bar_default_handle(bar->data, bt, ev); } @@ -622,15 +622,15 @@ } void -battle_bar_default_handle(struct battle_bar_default *bar, struct battle *bt, const union event *ev) +battle_bar_default_handle(struct battle_bar_default *bar, struct battle *bt, const union mlk_event *ev) { assert(bar); assert(bt); assert(ev); - static void (*handlers[])(struct battle_bar_default *, struct battle *, const union event *) = { - [EVENT_KEYDOWN] = handle_keydown, - [EVENT_NUM] = NULL + static void (*handlers[])(struct battle_bar_default *, struct battle *, const union mlk_event *) = { + [MLK_EVENT_KEYDOWN] = handle_keydown, + [MLK_EVENT_NUM] = NULL }; if (handlers[ev->type])