Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
3dgui.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "inexor/shared/cube_formatting.hpp" // for PRINTFARGS, defvformats...
4 #include "inexor/texture/slot.hpp" // for Texture and Image and Slot
5 
6 class VSlot;
7 struct Texture;
8 struct vec;
9 
11 enum
12 {
16 
18 
27 
29 
33 
35 
36  // bomberman
39 
40  HICON_X = 20,
41  HICON_Y = 1650,
42  HICON_TEXTY = 1644,
43  HICON_STEP = 490,
44  HICON_SIZE = 120,
46 };
47 
48 enum { G3D_DOWN = 1, G3D_UP = 2, G3D_PRESSED = 4, G3D_ROLLOVER = 8, G3D_DRAGGED = 16 };
49 
51 
52 struct g3d_gui
53 {
54  virtual ~g3d_gui() {}
55 
56  virtual void start(int starttime, float basescale, int *tab = nullptr, bool allowinput = true) = 0;
57  virtual void end() = 0;
58 
59  virtual int text(const char *text, int color, const char *icon = nullptr) = 0;
60  int textf(const char *fmt, int color, const char *icon = nullptr, ...) PRINTFARGS(2, 5)
61  {
62  defvformatstring(str, icon, fmt);
63  return text(str, color, icon);
64  }
65  virtual int button(const char *text, int color, const char *icon = nullptr) = 0;
66  int buttonf(const char *fmt, int color, const char *icon = nullptr, ...) PRINTFARGS(2, 5)
67  {
68  defvformatstring(str, icon, fmt);
69  return button(str, color, icon);
70  }
71  virtual int title(const char *text, int color, const char *icon = nullptr) = 0;
72  int titlef(const char *fmt, int color, const char *icon = nullptr, ...) PRINTFARGS(2, 5)
73  {
74  defvformatstring(str, icon, fmt);
75  return title(str, color, icon);
76  }
77  virtual void background(int color, int parentw = 0, int parenth = 0) = 0;
78 
79  virtual void pushlist() {}
80  virtual void poplist() {}
81 
82  virtual bool allowautotab(bool on) = 0;
83  virtual bool shouldtab() { return false; }
84  virtual void tab(const char *name = nullptr, int color = 0) = 0;
85  virtual int image(Texture *t, float scale, bool overlaid = false) = 0;
86  virtual int texture(VSlot &vslot, float scale, bool overlaid = true) = 0;
87  virtual int playerpreview(int model, int team, int weap, float scale, bool overlaid = false) { return 0; }
88  virtual int modelpreview(const char *name, int anim, float scale, bool overlaid = false) { return 0; }
89  virtual int prefabpreview(const char *prefab, const vec &color, float scale, bool overlaid = false) { return 0; }
90  virtual void slider(int &val, int vmin, int vmax, int color, const char *label = nullptr) = 0;
91  virtual void separator() = 0;
92  virtual void progress(float percent) = 0;
93  virtual void strut(float size) = 0;
94  virtual void space(float size) = 0;
95  virtual void spring(int weight = 1) = 0;
96  virtual void column(int col) = 0;
97  virtual char *keyfield(const char *name, int color, int length, int height = 0, const char *initval = nullptr, int initmode = EDITORFOCUSED) = 0;
98  virtual char *field(const char *name, int color, int length, int height = 0, const char *initval = nullptr, int initmode = EDITORFOCUSED) = 0;
99  virtual void textbox(const char *text, int width, int height, int color = 0xFFFFFF) = 0;
100  virtual bool mergehits(bool on) = 0;
101 };
102 
104 {
105  virtual ~g3d_callback() {}
106 
107  int starttime();
108 
109  virtual void gui(g3d_gui &g, bool firstpass) = 0;
110 };
111 
112 enum
113 {
114  GUI_2D = 1<<0,
115  GUI_FOLLOW = 1<<1,
116  GUI_FORCE_2D = 1<<2,
117  GUI_BOTTOM = 1<<3
118 };
119 
120 extern void g3d_addgui(g3d_callback *cb, vec &origin, int flags = 0);
121 extern bool g3d_movecursor(int dx, int dy);
122 extern void g3d_cursorpos(float &x, float &y);
123 extern void g3d_resetcursor();
124 extern void g3d_limitscale(float scale);
125 
126 extern void g3d_render();
127 extern bool g3d_windowhit(bool on, bool act);
128 extern bool g3d_key(int code, bool isdown);
129 extern bool g3d_input(const char *str, int len);
130 
131 
134 {
147 };
148 
149 
150 extern int hudannounce_begin;
151 extern int hudannounce_timeout;
152 extern int hudannounce_effect;
153 extern char* hudannounce_text;
154 
Definition: 3dgui.hpp:20
Definition: 3dgui.hpp:17
virtual void slider(int &val, int vmin, int vmax, int color, const char *label=nullptr)=0
Definition: 3dgui.hpp:15
Definition: octaedit.cpp:1300
#define act(action, _new, _ret, description)
GLenum GLsizei GLsizei height
Definition: glexts.hpp:291
Definition: 3dgui.hpp:23
Definition: 3dgui.hpp:135
#define defvformatstring(d, last, fmt)
Definition: cube_formatting.hpp:63
Definition: 3dgui.hpp:145
StringFormatter::FmtMark fmt
Marker that starts formatting a string.
Definition: StringFormatter.cpp:5
A virtual Slot.
Definition: slot.hpp:37
Definition: 3dgui.hpp:37
Definition: 3dgui.hpp:142
Definition: 3dgui.hpp:103
virtual void separator()=0
Definition: model.hpp:40
virtual int button(const char *text, int color, const char *icon=nullptr)=0
Definition: 3dgui.hpp:38
GLintptr GLsizeiptr length
Definition: glexts.hpp:354
virtual int title(const char *text, int color, const char *icon=nullptr)=0
GLenum GLsizei width
Definition: glexts.hpp:291
void g3d_render()
Definition: 3dgui.cpp:1367
#define PRINTFARGS(fmt, args)
Definition: cube_formatting.hpp:11
virtual int text(const char *text, int color, const char *icon=nullptr)=0
Definition: 3dgui.hpp:141
Definition: 3dgui.hpp:50
Definition: 3dgui.hpp:48
virtual ~g3d_gui()
Definition: 3dgui.hpp:54
Definition: 3dgui.hpp:137
Definition: 3dgui.hpp:138
virtual void strut(float size)=0
Definition: 3dgui.hpp:44
Definition: 3dgui.hpp:52
void g3d_limitscale(float scale)
Definition: 3dgui.cpp:1346
Definition: 3dgui.hpp:50
virtual void gui(g3d_gui &g, bool firstpass)=0
Definition: 3dgui.hpp:140
virtual bool allowautotab(bool on)=0
virtual void poplist()
Definition: 3dgui.hpp:80
virtual int playerpreview(int model, int team, int weap, float scale, bool overlaid=false)
Definition: 3dgui.hpp:87
hudannounceeffects
Bomberman: HUD announce effects.
Definition: 3dgui.hpp:133
virtual int modelpreview(const char *name, int anim, float scale, bool overlaid=false)
Definition: 3dgui.hpp:88
virtual void textbox(const char *text, int width, int height, int color=0xFFFFFF)=0
Definition: 3dgui.hpp:136
Definition: 3dgui.hpp:45
vector with 3 floats and some useful methods.
Definition: geom.hpp:110
Definition: 3dgui.hpp:114
Definition: 3dgui.hpp:48
Definition: 3dgui.hpp:116
Definition: 3dgui.hpp:143
int hudannounce_effect
Definition: 3dgui.cpp:58
Definition: 3dgui.hpp:40
Definition: 3dgui.hpp:144
Definition: 3dgui.hpp:31
int hudannounce_begin
Bomberman HUD.
Definition: 3dgui.cpp:56
bool g3d_windowhit(bool on, bool act)
Definition: 3dgui.cpp:1353
Definition: 3dgui.hpp:48
Definition: 3dgui.hpp:117
Definition: 3dgui.hpp:13
int textf(const char *fmt, int color, const char *icon=nullptr,...) PRINTFARGS(2
virtual void space(float size)=0
virtual void start(int starttime, float basescale, int *tab=nullptr, bool allowinput=true)=0
Definition: 3dgui.hpp:25
virtual int image(Texture *t, float scale, bool overlaid=false)=0
bool g3d_movecursor(int dx, int dy)
Definition: 3dgui.cpp:1322
Definition: 3dgui.hpp:19
void t(T x, const char *cmp)
Definition: utilTest.cpp:52
void g3d_resetcursor()
Definition: 3dgui.cpp:1315
Definition: 3dgui.hpp:48
virtual void pushlist()
Definition: 3dgui.hpp:79
virtual ~g3d_callback()
Definition: 3dgui.hpp:105
virtual int prefabpreview(const char *prefab, const vec &color, float scale, bool overlaid=false)
Definition: 3dgui.hpp:89
int buttonf(const char *fmt, int color, const char *icon=nullptr,...) PRINTFARGS(2
GLuint GLuint GLintptr GLsizeiptr size
Definition: glexts.hpp:412
virtual bool shouldtab()
Definition: 3dgui.hpp:83
Definition: 3dgui.hpp:48
Definition: 3dgui.hpp:139
char * hudannounce_text
Definition: 3dgui.cpp:59
virtual char * keyfield(const char *name, int color, int length, int height=0, const char *initval=nullptr, int initmode=EDITORFOCUSED)=0
uchar flags[MAXBRUSH][MAXBRUSH]
Definition: octaedit.cpp:1742
virtual void column(int col)=0
int titlef(const char *fmt, int color, const char *icon=nullptr,...) PRINTFARGS(2
virtual void end()=0
Definition: 3dgui.hpp:28
virtual int texture(VSlot &vslot, float scale, bool overlaid=true)=0
bool g3d_key(int code, bool isdown)
Definition: 3dgui.cpp:1227
Definition: 3dgui.hpp:42
Definition: 3dgui.hpp:30
Definition: 3dgui.hpp:43
void g3d_addgui(g3d_callback *cb, vec &origin, int flags=0)
Definition: 3dgui.cpp:1334
virtual char * field(const char *name, int color, int length, int height=0, const char *initval=nullptr, int initmode=EDITORFOCUSED)=0
Definition: 3dgui.hpp:41
void g3d_cursorpos(float &x, float &y)
Definition: 3dgui.cpp:1309
Definition: 3dgui.hpp:146
virtual void progress(float percent)=0
bool g3d_input(const char *str, int len)
Definition: 3dgui.cpp:1218
static void color(const bvec &v, uchar alpha=255)
Definition: glemu.hpp:71
virtual bool mergehits(bool on)=0
virtual void tab(const char *name=nullptr, int color=0)=0
Definition: 3dgui.hpp:50
Definition: 3dgui.hpp:26
Definition: 3dgui.hpp:32
Definition: 3dgui.hpp:34
Definition: 3dgui.hpp:115
static int starttime
Definition: movie.cpp:831
virtual void spring(int weight=1)=0
Definition: 3dgui.hpp:21
int hudannounce_timeout
Definition: 3dgui.cpp:57
virtual void background(int color, int parentw=0, int parenth=0)=0
int starttime()
Definition: 3dgui.cpp:1453
Definition: 3dgui.hpp:22
Definition: 3dgui.hpp:24
Definition: 3dgui.hpp:14
A Texture entry, holding info about a texture on the GPU.
Definition: texture.hpp:27
management of texture slots as visible ingame.