comparison libmlk-rpg/mlk/rpg/battle-bar-default.c @ 492:c7b18475f640

ui: gridmenu -> mlk_gridmenu
author David Demelier <markand@malikania.fr>
date Tue, 28 Feb 2023 13:18:23 +0100
parents 734b598534c4
children fce3b3c4b496
comparison
equal deleted inserted replaced
491:734b598534c4 492:c7b18475f640
443 handle_keydown_grid(struct battle_bar_default *bar, struct battle *bt, const union mlk_event *ev) 443 handle_keydown_grid(struct battle_bar_default *bar, struct battle *bt, const union mlk_event *ev)
444 { 444 {
445 /* Go back to main menu if I press escape. */ 445 /* Go back to main menu if I press escape. */
446 if (ev->key.key == MLK_KEY_ESCAPE) 446 if (ev->key.key == MLK_KEY_ESCAPE)
447 bar->state = BATTLE_BAR_DEFAULT_STATE_MENU; 447 bar->state = BATTLE_BAR_DEFAULT_STATE_MENU;
448 else if (gridmenu_handle(&bar->grid, ev)) { 448 else if (mlk_gridmenu_handle(&bar->grid, ev)) {
449 switch (bar->menu) { 449 switch (bar->menu) {
450 case BATTLE_BAR_DEFAULT_MENU_MAGIC: 450 case BATTLE_BAR_DEFAULT_MENU_MAGIC:
451 switch_selection_spell(bar, bt); 451 switch_selection_spell(bar, bt);
452 break; 452 break;
453 case BATTLE_BAR_DEFAULT_MENU_ITEM: 453 case BATTLE_BAR_DEFAULT_MENU_ITEM:
540 bar->x = 0; 540 bar->x = 0;
541 bar->y = mlk_window.h - bar->h; 541 bar->y = mlk_window.h - bar->h;
542 542
543 dimensions(geo, bar); 543 dimensions(geo, bar);
544 544
545 gridmenu_init(&bar->grid, 2, 2, NULL, 0); 545 mlk_gridmenu_init(&bar->grid, 2, 2, NULL, 0);
546 gridmenu_resize(&bar->grid, bar->x, geo[0].y, geo[1].w, bar->h); 546 mlk_gridmenu_resize(&bar->grid, bar->x, geo[0].y, geo[1].w, bar->h);
547 bar->grid.theme = bar->theme; 547 bar->grid.theme = bar->theme;
548 } 548 }
549 549
550 void 550 void
551 battle_bar_default_open_magic(struct battle_bar_default *bar, const struct battle *bt, struct character *ch) 551 battle_bar_default_open_magic(struct battle_bar_default *bar, const struct battle *bt, struct character *ch)
666 } 666 }
667 } 667 }
668 668
669 /* Sub menu is only shown if state is set to it. */ 669 /* Sub menu is only shown if state is set to it. */
670 if (bar->state == BATTLE_BAR_DEFAULT_STATE_GRID) 670 if (bar->state == BATTLE_BAR_DEFAULT_STATE_GRID)
671 gridmenu_draw(&bar->grid); 671 mlk_gridmenu_draw(&bar->grid);
672 } 672 }
673 673
674 void 674 void
675 battle_bar_default_finish(struct battle_bar_default *bar) 675 battle_bar_default_finish(struct battle_bar_default *bar)
676 { 676 {