Mercurial > molko
comparison src/libmlk-rpg/rpg/battle-bar-default.h @ 385:3f13dc6c0e37
rpg: separate battle and the bar, closes #2522
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 15 Feb 2022 14:45:11 +0100 |
parents | |
children | ef2fc4442ed5 |
comparison
equal
deleted
inserted
replaced
384:c458441ff472 | 385:3f13dc6c0e37 |
---|---|
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 <core/core.h> | |
23 | |
24 #include <ui/frame.h> | |
25 #include <ui/gridmenu.h> | |
26 | |
27 struct battle; | |
28 struct character; | |
29 struct selection; | |
30 | |
31 union event; | |
32 | |
33 enum battle_bar_default_menu { | |
34 BATTLE_BAR_DEFAULT_MENU_ATTACK, | |
35 BATTLE_BAR_DEFAULT_MENU_MAGIC, | |
36 BATTLE_BAR_DEFAULT_MENU_ITEM, | |
37 BATTLE_BAR_DEFAULT_MENU_SPECIAL | |
38 }; | |
39 | |
40 enum battle_bar_default_state { | |
41 BATTLE_BAR_DEFAULT_STATE_MENU, | |
42 BATTLE_BAR_DEFAULT_STATE_GRID | |
43 }; | |
44 | |
45 struct battle_bar_default { | |
46 int x; | |
47 int y; | |
48 unsigned int w; | |
49 unsigned int h; | |
50 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; | |
58 | |
59 /* Sub menu selection (spells/objects). */ | |
60 char sub_items[GRIDMENU_ENTRY_MAX][128]; | |
61 struct gridmenu sub_grid; | |
62 }; | |
63 | |
64 CORE_BEGIN_DECLS | |
65 | |
66 void | |
67 battle_bar_default_positionate(struct battle_bar_default *, const struct battle *); | |
68 | |
69 void | |
70 battle_bar_default_open_magic(struct battle_bar_default *, const struct battle *, struct character *); | |
71 | |
72 void | |
73 battle_bar_default_open_item(struct battle_bar_default *, const struct battle *); | |
74 | |
75 void | |
76 battle_bar_default_start(struct battle_bar_default *); | |
77 | |
78 void | |
79 battle_bar_default_select(struct battle_bar_default *, struct battle *, const struct selection *); | |
80 | |
81 void | |
82 battle_bar_default_handle(struct battle_bar_default *bar, struct battle *bt, const union event *); | |
83 | |
84 void | |
85 battle_bar_default_draw(const struct battle_bar_default *, const struct battle *); | |
86 | |
87 void | |
88 battle_bar_default_finish(struct battle_bar_default *); | |
89 | |
90 void | |
91 battle_bar_default(struct battle *); | |
92 | |
93 CORE_END_DECLS | |
94 | |
95 #endif /* !MLK_RPG_BATTLE_BAR_DEFAULT_H */ |