]> git.lizzy.rs Git - dragonfireclient.git/blob - src/hud.h
Add bold, italic and monospace font styling for HUD text elements (#11478)
[dragonfireclient.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 #pragma once
22
23 #include "irrlichttypes_extrabloated.h"
24 #include <string>
25 #include "common/c_types.h"
26
27 #define HUD_DIR_LEFT_RIGHT 0
28 #define HUD_DIR_RIGHT_LEFT 1
29 #define HUD_DIR_TOP_BOTTOM 2
30 #define HUD_DIR_BOTTOM_TOP 3
31
32 #define HUD_CORNER_UPPER  0
33 #define HUD_CORNER_LOWER  1
34 #define HUD_CORNER_CENTER 2
35
36 #define HUD_STYLE_BOLD   1
37 #define HUD_STYLE_ITALIC 2
38 #define HUD_STYLE_MONO   4
39
40 // Note that these visibility flags do not determine if the hud items are
41 // actually drawn, but rather, whether to draw the item should the rest
42 // of the game state permit it.
43 #define HUD_FLAG_HOTBAR_VISIBLE        (1 << 0)
44 #define HUD_FLAG_HEALTHBAR_VISIBLE     (1 << 1)
45 #define HUD_FLAG_CROSSHAIR_VISIBLE     (1 << 2)
46 #define HUD_FLAG_WIELDITEM_VISIBLE     (1 << 3)
47 #define HUD_FLAG_BREATHBAR_VISIBLE     (1 << 4)
48 #define HUD_FLAG_MINIMAP_VISIBLE       (1 << 5)
49 #define HUD_FLAG_MINIMAP_RADAR_VISIBLE (1 << 6)
50
51 #define HUD_PARAM_HOTBAR_ITEMCOUNT 1
52 #define HUD_PARAM_HOTBAR_IMAGE 2
53 #define HUD_PARAM_HOTBAR_SELECTED_IMAGE 3
54
55 #define HUD_HOTBAR_ITEMCOUNT_DEFAULT 8
56 #define HUD_HOTBAR_ITEMCOUNT_MAX     32
57
58 #define HOTBAR_IMAGE_SIZE 48
59
60 enum HudElementType {
61         HUD_ELEM_IMAGE     = 0,
62         HUD_ELEM_TEXT      = 1,
63         HUD_ELEM_STATBAR   = 2,
64         HUD_ELEM_INVENTORY = 3,
65         HUD_ELEM_WAYPOINT  = 4,
66         HUD_ELEM_IMAGE_WAYPOINT = 5,
67         HUD_ELEM_COMPASS   = 6,
68         HUD_ELEM_MINIMAP   = 7
69 };
70
71 enum HudElementStat {
72         HUD_STAT_POS = 0,
73         HUD_STAT_NAME,
74         HUD_STAT_SCALE,
75         HUD_STAT_TEXT,
76         HUD_STAT_NUMBER,
77         HUD_STAT_ITEM,
78         HUD_STAT_DIR,
79         HUD_STAT_ALIGN,
80         HUD_STAT_OFFSET,
81         HUD_STAT_WORLD_POS,
82         HUD_STAT_SIZE,
83         HUD_STAT_Z_INDEX,
84         HUD_STAT_TEXT2,
85         HUD_STAT_STYLE,
86 };
87
88 enum HudCompassDir {
89         HUD_COMPASS_ROTATE = 0,
90         HUD_COMPASS_ROTATE_REVERSE,
91         HUD_COMPASS_TRANSLATE,
92         HUD_COMPASS_TRANSLATE_REVERSE,
93 };
94
95 struct HudElement {
96         HudElementType type;
97         v2f pos;
98         std::string name;
99         v2f scale;
100         std::string text;
101         u32 number;
102         u32 item;
103         u32 dir;
104         v2f align;
105         v2f offset;
106         v3f world_pos;
107         v2s32 size;
108         s16 z_index = 0;
109         std::string text2;
110         u32 style;
111 };
112
113 extern const EnumString es_HudElementType[];
114 extern const EnumString es_HudElementStat[];
115 extern const EnumString es_HudBuiltinElement[];
116
117 // Minimap stuff
118
119 enum MinimapType {
120         MINIMAP_TYPE_OFF,
121         MINIMAP_TYPE_SURFACE,
122         MINIMAP_TYPE_RADAR,
123         MINIMAP_TYPE_TEXTURE,
124 };
125