Tramway SDK
gui.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_FRAMEWORK_GUI_H
5#define TRAM_SDK_FRAMEWORK_GUI_H
6
7#include <framework/ui.h>
8
9namespace tram::Render {
10 class Sprite;
11}
12
13namespace tram::GUI {
14
15typedef uint32_t font_t;
16typedef uint32_t glyph_t;
17
18enum orientation:uint32_t {
23
27
37};
38
49
53
91};
92
93void Init();
94void Update();
96
97void SetScaling(uint32_t);
98uint32_t GetScaling();
99
100bool ClickHandled();
101
102void Begin();
103void End();
104
105void SetColor(vec3 color);
106void FillFrame(font_t font, glyph_t glyph);
107void HorizontalDivider();
108void NewLine(uint32_t line = LINE_NORMAL);
109bool CheckBox(bool& selected, const char* text, bool enabled = true);
110bool RadioButton(uint32_t index, uint32_t& selected, const char* text, bool enabled = true);
111bool Button(const char* text, bool enabled = true, uint32_t width = 0);
112bool Slider(float& value, bool enabled = true, uint32_t width = 0);
113void PopFrame();
114void PushFrameRelative(uint32_t orientation, uint32_t offset);
115void PushFrame(uint32_t x, uint32_t y, uint32_t w, uint32_t h);
116void Glyph(font_t font, glyph_t glyph);
117void Text(font_t font, const char* text, uint32_t orientation = TEXT_LEFT);
118bool TextBox(char* text, uint32_t length, bool enabled = true, uint32_t w = 0, uint32_t h = 0);
119void TextBox(const char* text, uint32_t w = 0, uint32_t h = 0);
120
121}
122
123#endif // TRAM_SDK_FRAMEWORK_GUI_H
Definition: sprite.h:24
Definition: gui.cpp:28
void HorizontalDivider()
Definition: gui.cpp:568
bool Slider(float &value, bool enabled, uint32_t width)
Definition: gui.cpp:506
void Text(font_t font, const char *text, uint32_t orientation)
Definition: gui.cpp:281
bool RadioButton(uint32_t index, uint32_t &selected, const char *text, bool enabled)
Definition: gui.cpp:446
void Update()
Submits all of the glyphs for rendering.
Definition: gui.cpp:124
orientation
Definition: gui.h:18
@ TEXT_RIGHT
Definition: gui.h:21
@ FRAME_RIGHT
Definition: gui.h:29
@ TEXT_LEFT
Definition: gui.h:19
@ LINE_LOW
Definition: gui.h:24
@ TEXT_JUSTIFIED
Definition: gui.h:22
@ FRAME_TOP
Definition: gui.h:30
@ FRAME_BOTTOM
Definition: gui.h:31
@ FRAME_RIGHT_INV
Definition: gui.h:33
@ LINE_NORMAL
Definition: gui.h:25
@ FRAME_INSET
Definition: gui.h:36
@ FRAME_TOP_INV
Definition: gui.h:34
@ LINE_HIGH
Definition: gui.h:26
@ TEXT_CENTER
Definition: gui.h:20
@ FRAME_BOTTOM_INV
Definition: gui.h:35
@ FRAME_LEFT_INV
Definition: gui.h:32
@ FRAME_LEFT
Definition: gui.h:28
void Init()
Performs initialization of the GUI system.
Definition: gui.cpp:78
bool TextBox(char *text, uint32_t length, bool enabled, uint32_t w, uint32_t h)
Definition: gui.cpp:590
bool Button(const char *text, bool enabled, uint32_t width)
Definition: gui.cpp:411
void PushFrameRelative(uint32_t orientation, uint32_t offset)
Definition: gui.cpp:338
widget
Definition: gui.h:39
@ WIDGET_BUTTON_1_WINDOW
Definition: gui.h:89
@ WIDGET_DIVIDER_HORIZONTAL
Definition: gui.h:70
@ WIDGET_RIGHT
Definition: gui.h:52
@ WIDGET_WINDOW
Definition: gui.h:60
@ WIDGET_BOTTOM_MIDDLE
Definition: gui.h:47
@ WIDGET_BUTTON_HELP
Definition: gui.h:87
@ WIDGET_TEXT_BOX
Definition: gui.h:65
@ WIDGET_TOP_LEFT
Definition: gui.h:40
@ WIDGET_SCROLL_BAR_TRACK_HORIZONTAL
Definition: gui.h:69
@ WIDGET_CHECK_BUTTON
Definition: gui.h:79
@ WIDGET_BORDER
Definition: gui.h:67
@ WIDGET_MIDDLE
Definition: gui.h:51
@ WIDGET_BUTTON_DISABLED
Definition: gui.h:58
@ WIDGET_SLIDER_TRACK_HORIZONTAL
Definition: gui.h:73
@ WIDGET_SCROLL_BAR_HORIZONTAL
Definition: gui.h:75
@ WIDGET_SCROLL_BAR_TRACK_VERTICAL
Definition: gui.h:68
@ WIDGET_MIDDLE_LEFT
Definition: gui.h:43
@ WIDGET_TOP_RIGHT
Definition: gui.h:42
@ WIDGET_SELECT_BOX
Definition: gui.h:62
@ WIDGET_SLIDER_HORIZONTAL
Definition: gui.h:81
@ WIDGET_BUTTON_PRESSED
Definition: gui.h:55
@ WIDGET_TEXT_BOX_DISABLED
Definition: gui.h:66
@ WIDGET_BUTTON_DOWN
Definition: gui.h:83
@ WIDGET_BOTTOM_RIGHT
Definition: gui.h:48
@ WIDGET_BUTTON_SELECTED_ENABLED
Definition: gui.h:56
@ WIDGET_SLIDER_TRACK_VERTICAL
Definition: gui.h:72
@ WIDGET_REVERSE_WINDOW
Definition: gui.h:61
@ WIDGET_BUTTON_SELECTED_DISABLED
Definition: gui.h:57
@ WIDGET_BUTTON_LEFT
Definition: gui.h:84
@ WIDGET_MIDDLE_MIDDLE
Definition: gui.h:44
@ WIDGET_SLIDER_VERTICAL
Definition: gui.h:80
@ WIDGET_DIVIDER_VERTICAL
Definition: gui.h:71
@ WIDGET_BUTTON_2_WINDOW
Definition: gui.h:88
@ WIDGET_DEFAULT
Definition: gui.h:90
@ WIDGET_TAB
Definition: gui.h:76
@ WIDGET_BUTTON_UP
Definition: gui.h:82
@ WIDGET_BUTTON
Definition: gui.h:54
@ WIDGET_LEFT
Definition: gui.h:50
@ WIDGET_BUTTON_PRESSED_DISABLED
Definition: gui.h:59
@ WIDGET_SELECT_BOX_PRESSED
Definition: gui.h:63
@ WIDGET_SCROLL_BAR_VERTICAL
Definition: gui.h:74
@ WIDGET_TOP_MIDDLE
Definition: gui.h:41
@ WIDGET_PROGESS_BAR
Definition: gui.h:77
@ WIDGET_BUTTON_EXIT
Definition: gui.h:86
@ WIDGET_MIDDLE_RIGHT
Definition: gui.h:45
@ WIDGET_SELECT_BOX_SELECTED
Definition: gui.h:64
@ WIDGET_BUTTON_RIGHT
Definition: gui.h:85
@ WIDGET_RADIO_BUTTON
Definition: gui.h:78
@ WIDGET_BOTTOM_LEFT
Definition: gui.h:46
bool ClickHandled()
Definition: gui.cpp:398
uint32_t GetScaling()
Definition: gui.cpp:70
void PopFrame()
Definition: gui.cpp:385
void NewLine(uint32_t line)
Definition: gui.cpp:552
font_t RegisterFont(Render::Sprite *sprite)
Registers a font.
Definition: gui.cpp:134
void End()
Definition: gui.cpp:742
void FillFrame(font_t font, glyph_t glyph)
Definition: gui.cpp:580
void PushFrame(uint32_t x, uint32_t y, uint32_t w, uint32_t h)
Definition: gui.cpp:324
void SetScaling(uint32_t scale)
Definition: gui.cpp:66
bool CheckBox(bool &selected, const char *text, bool enabled)
Definition: gui.cpp:476
void SetColor(vec3 color)
Definition: gui.cpp:61
void Glyph(font_t font, glyph_t glyph)
Definition: gui.cpp:231
uint32_t font_t
Definition: gui.h:15
void Begin()
Definition: gui.cpp:677
uint32_t glyph_t
Definition: gui.h:16
Definition: gui.h:9
glm::vec3 vec3
Definition: math.h:12