comparison libmlk-rpg/mlk/rpg/battle-bar-default.h @ 434:4e78f045e8c0

rpg: cleanup hierarchy
author David Demelier <markand@malikania.fr>
date Sat, 15 Oct 2022 21:24:17 +0200
parents src/libmlk-rpg/rpg/battle-bar-default.h@862b15c3a3ae
children 773a082f0b91
comparison
equal deleted inserted replaced
433:862b15c3a3ae 434:4e78f045e8c0
1 /*
2 * battle-bar-default.h -- default battle status bar and menu implementation
3 *
4 * Copyright (c) 2020-2022 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef MLK_RPG_BATTLE_BAR_DEFAULT_H
20 #define MLK_RPG_BATTLE_BAR_DEFAULT_H
21
22 #include <mlk/core/core.h>
23
24 #include <mlk/ui/gridmenu.h>
25
26 struct battle;
27 struct battle_bar;
28 struct character;
29 struct selection;
30 struct theme;
31
32 union event;
33
34 enum battle_bar_default_menu {
35 BATTLE_BAR_DEFAULT_MENU_ATTACK,
36 BATTLE_BAR_DEFAULT_MENU_MAGIC,
37 BATTLE_BAR_DEFAULT_MENU_ITEM,
38 BATTLE_BAR_DEFAULT_MENU_SPECIAL
39 };
40
41 enum battle_bar_default_state {
42 BATTLE_BAR_DEFAULT_STATE_NONE,
43 BATTLE_BAR_DEFAULT_STATE_MENU,
44 BATTLE_BAR_DEFAULT_STATE_GRID
45 };
46
47 struct battle_bar_default {
48 int x;
49 int y;
50 unsigned int w;
51 unsigned int h;
52 struct theme *theme;
53 enum battle_bar_default_state state;
54 enum battle_bar_default_menu menu;
55
56 /* Private fields. */
57 const char **items;
58 size_t itemsz;
59 struct gridmenu grid;
60 };
61
62 CORE_BEGIN_DECLS
63
64 void
65 battle_bar_default_init(struct battle_bar_default *);
66
67 void
68 battle_bar_default_open_magic(struct battle_bar_default *, const struct battle *, struct character *);
69
70 void
71 battle_bar_default_open_item(struct battle_bar_default *, const struct battle *);
72
73 void
74 battle_bar_default_start(struct battle_bar_default *);
75
76 void
77 battle_bar_default_select(struct battle_bar_default *, struct battle *, const struct selection *);
78
79 void
80 battle_bar_default_handle(struct battle_bar_default *, struct battle *, const union event *);
81
82 void
83 battle_bar_default_draw(const struct battle_bar_default *, const struct battle *);
84
85 void
86 battle_bar_default_finish(struct battle_bar_default *);
87
88 void
89 battle_bar_default(struct battle_bar_default *, struct battle_bar *);
90
91 CORE_END_DECLS
92
93 #endif /* !MLK_RPG_BATTLE_BAR_DEFAULT_H */