Mercurial > molko
comparison src/libmlk-rpg/rpg/battle-bar.h @ 320:8f9937403749
misc: improve loading of data
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 01 Oct 2021 20:30:00 +0200 |
parents | libmlk-rpg/rpg/battle-bar.h@d01e83210ca2 |
children | 19782ea1cf4a |
comparison
equal
deleted
inserted
replaced
319:b843eef4cc35 | 320:8f9937403749 |
---|---|
1 /* | |
2 * battle-bar.h -- battle status bar and menu | |
3 * | |
4 * Copyright (c) 2020-2021 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 MOLKO_RPG_BATTLE_BAR_H | |
20 #define MOLKO_RPG_BATTLE_BAR_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 | |
30 union event; | |
31 | |
32 enum battle_bar_menu { | |
33 BATTLE_BAR_MENU_ATTACK = 0, | |
34 BATTLE_BAR_MENU_MAGIC = 1, | |
35 BATTLE_BAR_MENU_OBJECTS = 2, | |
36 BATTLE_BAR_MENU_SPECIAL = 3 | |
37 }; | |
38 | |
39 enum battle_bar_state { | |
40 BATTLE_BAR_STATE_NONE, | |
41 BATTLE_BAR_STATE_MENU, | |
42 BATTLE_BAR_STATE_SUB | |
43 }; | |
44 | |
45 struct battle_bar { | |
46 int x; | |
47 int y; | |
48 unsigned int w; | |
49 unsigned int h; | |
50 enum battle_bar_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_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_positionate(struct battle_bar *bar, const struct battle *bt); | |
68 | |
69 int | |
70 battle_bar_handle(struct battle_bar *bar, | |
71 const struct battle *bt, | |
72 const union event *ev); | |
73 | |
74 void | |
75 battle_bar_reset(struct battle_bar *bar); | |
76 | |
77 void | |
78 battle_bar_open_menu(struct battle_bar *bar); | |
79 | |
80 void | |
81 battle_bar_open_spells(struct battle_bar *bar, const struct battle *bt, struct character *ch); | |
82 | |
83 void | |
84 battle_bar_open_items(struct battle_bar *bar, const struct battle *bt); | |
85 | |
86 void | |
87 battle_bar_draw(const struct battle_bar *bar, const struct battle *bt); | |
88 | |
89 void | |
90 battle_bar_finish(struct battle_bar *bar); | |
91 | |
92 CORE_END_DECLS | |
93 | |
94 #endif /* !MOLKO_RPG_BATTLE_BAR_H */ |