-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathg_statusbar.h
64 lines (55 loc) · 2.7 KB
/
g_statusbar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) ZeniMax Media Inc.
// Licensed under the GNU General Public License 2.0.
#include <sstream>
// easy statusbar wrapper
struct statusbar_t
{
std::stringstream sb;
inline auto &yb(int32_t offset) { sb << "yb " << offset << ' '; return *this; }
inline auto &yt(int32_t offset) { sb << "yt " << offset << ' '; return *this; }
inline auto &yv(int32_t offset) { sb << "yv " << offset << ' '; return *this; }
inline auto &xl(int32_t offset) { sb << "xl " << offset << ' '; return *this; }
inline auto &xr(int32_t offset) { sb << "xr " << offset << ' '; return *this; }
inline auto &xv(int32_t offset) { sb << "xv " << offset << ' '; return *this; }
inline auto &ifstat(player_stat_t stat) { sb << "if " << stat << ' '; return *this; }
inline auto &endifstat() { sb << "endif "; return *this; }
inline auto &pic(player_stat_t stat) { sb << "pic " << stat << ' '; return *this; }
inline auto &picn(const char *icon) { sb << "picn " << icon << ' '; return *this; }
inline auto &anum() { sb << "anum "; return *this; }
inline auto &rnum() { sb << "rnum "; return *this; }
inline auto &hnum() { sb << "hnum "; return *this; }
inline auto &num(int32_t width, player_stat_t stat) { sb << "num " << width << ' ' << stat << ' '; return *this; }
inline auto &loc_stat_string(player_stat_t stat) { sb << "loc_stat_string " << stat << ' '; return *this; }
inline auto &loc_stat_rstring(player_stat_t stat) { sb << "loc_stat_rstring " << stat << ' '; return *this; }
inline auto &stat_string(player_stat_t stat) { sb << "stat_string " << stat << ' '; return *this; }
inline auto &stat_string2(player_stat_t stat) { sb << "stat_string2 " << stat << ' '; return *this; }
inline auto &loc_stat_cstring2(player_stat_t stat) { sb << "loc_stat_cstring2 " << stat << ' '; return *this; }
inline auto &string2(const char *str)
{
if (str[0] != '"' && (strchr(str, ' ') || strchr(str, '\n')))
sb << "string2 \"" << str << "\" ";
else
sb << "string2 " << str << ' ';
return *this;
}
inline auto &string(const char *str)
{
if (str[0] != '"' && (strchr(str, ' ') || strchr(str, '\n')))
sb << "string \"" << str << "\" ";
else
sb << "string " << str << ' ';
return *this;
}
inline auto &loc_rstring(const char *str)
{
if (str[0] != '"' && (strchr(str, ' ') || strchr(str, '\n')))
sb << "loc_rstring 0 \"" << str << "\" ";
else
sb << "loc_rstring 0 " << str << ' ';
return *this;
}
inline auto &lives_num(player_stat_t stat) { sb << "lives_num " << stat << ' '; return *this; }
inline auto &stat_pname(player_stat_t stat) { sb << "stat_pname " << stat << ' '; return *this; }
inline auto &health_bars() { sb << "health_bars "; return *this; }
inline auto &story() { sb << "story "; return *this; }
};