comparison src/libmlk-rpg/rpg/battle-bar-default.h @ 398:14ce7c4871e3

rpg: overhaul of battle bar
author David Demelier <markand@malikania.fr>
date Sun, 27 Feb 2022 10:08:51 +0100
parents ef2fc4442ed5
children 8f59201dc76b
comparison
equal deleted inserted replaced
397:73eabfd50410 398:14ce7c4871e3
19 #ifndef MLK_RPG_BATTLE_BAR_DEFAULT_H 19 #ifndef MLK_RPG_BATTLE_BAR_DEFAULT_H
20 #define MLK_RPG_BATTLE_BAR_DEFAULT_H 20 #define MLK_RPG_BATTLE_BAR_DEFAULT_H
21 21
22 #include <core/core.h> 22 #include <core/core.h>
23 23
24 #include <ui/frame.h>
25 #include <ui/gridmenu.h> 24 #include <ui/gridmenu.h>
26 25
27 struct battle; 26 struct battle;
27 struct battle_bar;
28 struct character; 28 struct character;
29 struct selection; 29 struct selection;
30 struct theme;
30 31
31 union event; 32 union event;
32 33
33 enum battle_bar_default_menu { 34 enum battle_bar_default_menu {
34 BATTLE_BAR_DEFAULT_MENU_ATTACK, 35 BATTLE_BAR_DEFAULT_MENU_ATTACK,
36 BATTLE_BAR_DEFAULT_MENU_ITEM, 37 BATTLE_BAR_DEFAULT_MENU_ITEM,
37 BATTLE_BAR_DEFAULT_MENU_SPECIAL 38 BATTLE_BAR_DEFAULT_MENU_SPECIAL
38 }; 39 };
39 40
40 enum battle_bar_default_state { 41 enum battle_bar_default_state {
42 BATTLE_BAR_DEFAULT_STATE_NONE,
41 BATTLE_BAR_DEFAULT_STATE_MENU, 43 BATTLE_BAR_DEFAULT_STATE_MENU,
42 BATTLE_BAR_DEFAULT_STATE_GRID 44 BATTLE_BAR_DEFAULT_STATE_GRID
43 }; 45 };
44 46
45 struct battle_bar_default { 47 struct battle_bar_default {
46 int x; 48 int x;
47 int y; 49 int y;
48 unsigned int w; 50 unsigned int w;
49 unsigned int h; 51 unsigned int h;
52 struct theme *theme;
50 enum battle_bar_default_state state; 53 enum battle_bar_default_state state;
51
52 /* Right status frame. */
53 struct frame status_frame;
54
55 /* Main menu selection. */
56 struct frame menu_frame;
57 enum battle_bar_default_menu menu; 54 enum battle_bar_default_menu menu;
58 55
59 /* Sub menu selection (spells/objects). */ 56 /* Private fields. */
60 char sub_items[16][128]; 57 const char **items;
61 struct gridmenu sub_grid; 58 size_t itemsz;
59 struct gridmenu grid;
62 }; 60 };
63 61
64 CORE_BEGIN_DECLS 62 CORE_BEGIN_DECLS
65 63
66 void 64 void
67 battle_bar_default_positionate(struct battle_bar_default *, const struct battle *); 65 battle_bar_default_init(struct battle_bar_default *);
68 66
69 void 67 void
70 battle_bar_default_open_magic(struct battle_bar_default *, const struct battle *, struct character *); 68 battle_bar_default_open_magic(struct battle_bar_default *, const struct battle *, struct character *);
71 69
72 void 70 void
77 75
78 void 76 void
79 battle_bar_default_select(struct battle_bar_default *, struct battle *, const struct selection *); 77 battle_bar_default_select(struct battle_bar_default *, struct battle *, const struct selection *);
80 78
81 void 79 void
82 battle_bar_default_handle(struct battle_bar_default *bar, struct battle *bt, const union event *); 80 battle_bar_default_handle(struct battle_bar_default *, struct battle *, const union event *);
83 81
84 void 82 void
85 battle_bar_default_draw(const struct battle_bar_default *, const struct battle *); 83 battle_bar_default_draw(const struct battle_bar_default *, const struct battle *);
86 84
87 void 85 void
88 battle_bar_default_finish(struct battle_bar_default *); 86 battle_bar_default_finish(struct battle_bar_default *);
89 87
90 void 88 void
91 battle_bar_default(struct battle *); 89 battle_bar_default(struct battle_bar_default *, struct battle_bar *);
92 90
93 CORE_END_DECLS 91 CORE_END_DECLS
94 92
95 #endif /* !MLK_RPG_BATTLE_BAR_DEFAULT_H */ 93 #endif /* !MLK_RPG_BATTLE_BAR_DEFAULT_H */