Formspecs: Add starting frame to `animated_image` (#9411)
[oweals/minetest.git] / src / hud.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
4 Copyright (C) 2017 red-001 <red-001@outlook.ie>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #ifndef HUD_HEADER
22 #define HUD_HEADER
23
24 #include "irrlichttypes_extrabloated.h"
25 #include <string>
26 #include "common/c_types.h"
27
28 #define HUD_DIR_LEFT_RIGHT 0
29 #define HUD_DIR_RIGHT_LEFT 1
30 #define HUD_DIR_TOP_BOTTOM 2
31 #define HUD_DIR_BOTTOM_TOP 3
32
33 #define HUD_CORNER_UPPER  0
34 #define HUD_CORNER_LOWER  1
35 #define HUD_CORNER_CENTER 2
36
37 // Note that these visibility flags do not determine if the hud items are
38 // actually drawn, but rather, whether to draw the item should the rest
39 // of the game state permit it.
40 #define HUD_FLAG_HOTBAR_VISIBLE        (1 << 0)
41 #define HUD_FLAG_HEALTHBAR_VISIBLE     (1 << 1)
42 #define HUD_FLAG_CROSSHAIR_VISIBLE     (1 << 2)
43 #define HUD_FLAG_WIELDITEM_VISIBLE     (1 << 3)
44 #define HUD_FLAG_BREATHBAR_VISIBLE     (1 << 4)
45 #define HUD_FLAG_MINIMAP_VISIBLE       (1 << 5)
46 #define HUD_FLAG_MINIMAP_RADAR_VISIBLE (1 << 6)
47
48 #define HUD_PARAM_HOTBAR_ITEMCOUNT 1
49 #define HUD_PARAM_HOTBAR_IMAGE 2
50 #define HUD_PARAM_HOTBAR_SELECTED_IMAGE 3
51
52 #define HUD_HOTBAR_ITEMCOUNT_DEFAULT 8
53 #define HUD_HOTBAR_ITEMCOUNT_MAX     32
54
55
56 #define HOTBAR_IMAGE_SIZE 48
57
58 enum HudElementType {
59         HUD_ELEM_IMAGE     = 0,
60         HUD_ELEM_TEXT      = 1,
61         HUD_ELEM_STATBAR   = 2,
62         HUD_ELEM_INVENTORY = 3,
63         HUD_ELEM_WAYPOINT  = 4,
64 };
65
66 enum HudElementStat {
67         HUD_STAT_POS = 0,
68         HUD_STAT_NAME,
69         HUD_STAT_SCALE,
70         HUD_STAT_TEXT,
71         HUD_STAT_NUMBER,
72         HUD_STAT_ITEM,
73         HUD_STAT_DIR,
74         HUD_STAT_ALIGN,
75         HUD_STAT_OFFSET,
76         HUD_STAT_WORLD_POS,
77         HUD_STAT_SIZE,
78         HUD_STAT_Z_INDEX,
79 };
80
81 struct HudElement {
82         HudElementType type;
83         v2f pos;
84         std::string name;
85         v2f scale;
86         std::string text;
87         u32 number;
88         u32 item;
89         u32 dir;
90         v2f align;
91         v2f offset;
92         v3f world_pos;
93         v2s32 size;
94         s16 z_index = 0;
95 };
96
97 extern const EnumString es_HudElementType[];
98 extern const EnumString es_HudElementStat[];
99 extern const EnumString es_HudBuiltinElement[];
100
101 #endif