Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
debug_ui.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <map>
5 
6 #include "components/3rdparty/imgui/imgui.h"
7 
8 //macros
9 
19 #define duigvs(x) Blam::DebugUI::GetVisibility(x)
20 
21 #ifndef BLAM
22 #define BLAM
23 #endif
24 
25 #ifndef UI_API
26 #define UI_API
27 #endif
28 
39 namespace InternalUI
40 {
42  // Main //
44 
48  UI_API void Initialize();
49 
53  UI_API void Render();
54 
58  UI_API void Shutdown();
59 
66  UI_API void LoadConfig(); //Loads UI configuration file
67 
76  UI_API void CheckForUpdates(); //Update checked
77 
94  UI_API void ShowCrashScreen(std::string crash_message); //Displays crash screen for development builds
95 
103  UI_API void ShowHaloConsole(bool* p_open);
104 
105 
106 
108  // Styles //
110 
119 
127  UI_API void load_xenia_styles(); //Function to load the Xenia UI theme
128 
136  UI_API void load_elaztek_styles(); //Function to load the Default/Elaztek UI theme
137 
145  UI_API void load_default_styles(); //Function to load the standard ImGui theme
146 
154  UI_API void load_elaztek_styles_classic(); //Function to load the classic Elaztek UI theme
155 
163  UI_API void load_cex_styles(); //Function to load the Halo: CE Anniversary based styles
164 
172  UI_API void load_win9x_styles(); //Function to load the Windows 9x styles
173 
181  UI_API void load_hl2_styles(); //Function to load Half-Life 2/Source Engine based styles
182 
190  UI_API void load_osx_styles(); //Function to load Mac OSX/ImGUI light theme
191 
192 
194  // Fonts //
196 
204  UI_API void SetFont(int id); //Change font via numeric ID
205 
211  UI_API ImFont* font_fixedsys(); //default fixedsys
212 
218  UI_API ImFont* font_proggytiny(); //proggytiny for xenia
219 
228  namespace Colors
229  {
230  UI_API ImVec4 crash_col();
231  UI_API ImVec4 crash_text_col();
232  UI_API ImVec4 crash_text_shadow_col();
233 
234  UI_API ImVec4 clear_col();
235 
236  UI_API ImVec4 console_color();
237  UI_API ImVec4 console_msg_color();
238  UI_API ImVec4 console_shadow();
239  UI_API ImVec4 console_error();
240  UI_API ImVec4 console_print();
241  UI_API ImVec4 console_blue();
242  UI_API ImVec4 console_internal_gold();
243  UI_API ImVec4 console_yellow();
244  UI_API ImVec4 transparent();
245 
246  UI_API ImVec4 mc_color_0();
247  UI_API ImVec4 mc_color_1();
248  UI_API ImVec4 mc_color_2();
249  UI_API ImVec4 mc_color_3();
250  UI_API ImVec4 mc_color_4();
251  UI_API ImVec4 mc_color_5();
252  UI_API ImVec4 mc_color_6();
253  UI_API ImVec4 mc_color_7();
254  UI_API ImVec4 mc_color_8();
255  UI_API ImVec4 mc_color_9();
256  UI_API ImVec4 mc_color_a();
257  UI_API ImVec4 mc_color_b();
258  UI_API ImVec4 mc_color_c();
259  UI_API ImVec4 mc_color_d();
260  UI_API ImVec4 mc_color_e();
261  UI_API ImVec4 mc_color_f();
262 
263  UI_API ImVec4 mc_color_0_s();
264  UI_API ImVec4 mc_color_1_s();
265  UI_API ImVec4 mc_color_2_s();
266  UI_API ImVec4 mc_color_3_s();
267  UI_API ImVec4 mc_color_4_s();
268  UI_API ImVec4 mc_color_5_s();
269  UI_API ImVec4 mc_color_6_s();
270  UI_API ImVec4 mc_color_7_s();
271  UI_API ImVec4 mc_color_8_s();
272  UI_API ImVec4 mc_color_9_s();
273  UI_API ImVec4 mc_color_a_s();
274  UI_API ImVec4 mc_color_b_s();
275  UI_API ImVec4 mc_color_c_s();
276  UI_API ImVec4 mc_color_d_s();
277  UI_API ImVec4 mc_color_e_s();
278  UI_API ImVec4 mc_color_f_s();
279 
280  UI_API ImVec4 d_blurple();
281  UI_API ImVec4 d_white();
282  UI_API ImVec4 d_greyple();
283  UI_API ImVec4 d_dark();
284  UI_API ImVec4 d_nqblack();
285 
286  UI_API ImVec4 d_text_dark();
287  UI_API ImVec4 d_text_light();
288 
289  }
290 
291 }
292 
293 namespace Blam
294 {
301  BLAM void LogEventLegacy(const char* message); //Adds an event to console
302 
310  BLAM void SetConsoleState(bool state); //Opens halo( prompt
311 
317  BLAM bool GetConsoleState(); //Gets whether console open or closed
318 
324  BLAM void SetConsoleState2(bool state); //Opens halo( prompt
325 
331  BLAM bool GetConsoleState2(); //Gets whether console open or closed
332 
338  BLAM void SetConsoleCommand2(std::string command); //Sets console command
339 
345  BLAM std::string GetConsoleCommand2(); //Sets console command
346 
350  namespace DebugUI
351  {
360  {
361  protected:
362  bool show = false;
363 
364  public:
372  virtual void Draw() {};
373 
379  bool* Show()
380  {
381  return &show;
382  };
383  };
384 
392  BLAM bool* GetVisibility(std::string key);
393 
400  BLAM void AddToDrawList(std::string key, ImGUIDrawingGroup* group);
401 
409  BLAM ImGUIDrawingGroup* GetDrawListItem(std::string key);
410 
417  BLAM void ShowErrorDialog(const char* title, const char* message);
418 
425  BLAM std::map<std::string, Blam::DebugUI::ImGUIDrawingGroup*>* GetDrawList();
426 
427  //Shows a window (or group of windows) created using ImGUI.
428 
434  namespace Windows
435  {
436  BLAM void HackConsole(bool* show_console);
438  }
439  }
440 }
InternalUI::Colors::mc_color_e
UI_API ImVec4 mc_color_e()
Definition: debug_ui_colors.cpp:51
Blam
Namespace surrounding all major engine components.
Definition: blam_api.h:18
InternalUI::Colors::mc_color_f
UI_API ImVec4 mc_color_f()
Definition: debug_ui_colors.cpp:52
InternalUI::Colors::crash_col
UI_API ImVec4 crash_col()
Definition: debug_ui_colors.cpp:21
InternalUI::Colors::mc_color_2
UI_API ImVec4 mc_color_2()
Definition: debug_ui_colors.cpp:39
InternalUI::Colors::d_dark
UI_API ImVec4 d_dark()
Definition: debug_ui_colors.cpp:74
Blam::DebugUI::ImGUIDrawingGroup::Draw
virtual void Draw()
Draws the contents of the group.
Definition: debug_ui.h:372
InternalUI::Colors::mc_color_5_s
UI_API ImVec4 mc_color_5_s()
Definition: debug_ui_colors.cpp:59
InternalUI::Colors::mc_color_3
UI_API ImVec4 mc_color_3()
Definition: debug_ui_colors.cpp:40
Blam::GetConsoleCommand2
BLAM std::string GetConsoleCommand2()
i have no idea why this exists
Definition: console_hack.cpp:123
Blam::GetConsoleState2
BLAM bool GetConsoleState2()
i have no idea why this exists
Definition: console_hack.cpp:108
InternalUI::Colors::mc_color_7
UI_API ImVec4 mc_color_7()
Definition: debug_ui_colors.cpp:44
InternalUI::Colors::mc_color_c
UI_API ImVec4 mc_color_c()
Definition: debug_ui_colors.cpp:49
InternalUI::ShowHaloConsole
UI_API void ShowHaloConsole(bool *p_open)
Legacy function that was used to open the ImGUI-based console.
Definition: legacy_halo_prompt.cpp:1794
InternalUI::ShowCrashScreen
UI_API void ShowCrashScreen(std::string crash_message)
Show the engine's crash screen.
Definition: crash_screen.cpp:11
InternalUI::Colors::mc_color_6_s
UI_API ImVec4 mc_color_6_s()
Definition: debug_ui_colors.cpp:60
crash_message
std::string crash_message
The message to display on the crash screen.
Definition: render_manage.cpp:62
InternalUI::Initialize
UI_API void Initialize()
Initializes the ImGUI draw list.
Definition: debug_ui.cpp:82
InternalUI::Colors::clear_col
UI_API ImVec4 clear_col()
The color to use for render target clearing.
Definition: debug_ui_colors.cpp:25
Blam::DebugUI::Windows::HackConsole
BLAM void HackConsole(bool *show_console)
Definition: console_hack.cpp:14
InternalUI::load_win9x_styles
UI_API void load_win9x_styles()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:406
InternalUI::load_default_styles
UI_API void load_default_styles()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:280
InternalUI::Colors::mc_color_2_s
UI_API ImVec4 mc_color_2_s()
Definition: debug_ui_colors.cpp:56
InternalUI::load_xenia_styles
UI_API void load_xenia_styles()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:59
Blam::LogEventLegacy
BLAM void LogEventLegacy(const char *message)
Legacy function to add a message to console.
Definition: legacy_halo_prompt.cpp:1804
InternalUI::Colors::mc_color_a
UI_API ImVec4 mc_color_a()
Definition: debug_ui_colors.cpp:47
InternalUI::Colors::console_blue
UI_API ImVec4 console_blue()
Definition: debug_ui_colors.cpp:32
InternalUI::load_cex_styles
UI_API void load_cex_styles()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:341
InternalUI::font_proggytiny
UI_API ImFont * font_proggytiny()
Legacy function to set the ImGUI font to Proggy Tiny - used by Xenia and some elements of Reach.
InternalUI::Colors::mc_color_9_s
UI_API ImVec4 mc_color_9_s()
Definition: debug_ui_colors.cpp:63
Blam::DebugUI::GetVisibility
BLAM bool * GetVisibility(std::string key)
Retrieves the visibility of the specified draw list item.
Definition: drawing_list.cpp:42
Blam::DebugUI::AddToDrawList
BLAM void AddToDrawList(std::string key, ImGUIDrawingGroup *group)
Adds a new item to the ImGUI draw list.
Definition: drawing_list.cpp:13
InternalUI::Colors::d_text_light
UI_API ImVec4 d_text_light()
Definition: debug_ui_colors.cpp:78
Blam::SetConsoleState
BLAM void SetConsoleState(bool state)
Legacy function to control legacy ImGUI console visibility.
Definition: console_hack.cpp:99
InternalUI::Colors::d_greyple
UI_API ImVec4 d_greyple()
Definition: debug_ui_colors.cpp:73
InternalUI::load_blamite_pink_styles
UI_API void load_blamite_pink_styles()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:3
InternalUI::Colors::console_msg_color
UI_API ImVec4 console_msg_color()
Definition: debug_ui_colors.cpp:28
Blam::DebugUI::GetDrawList
BLAM std::map< std::string, Blam::DebugUI::ImGUIDrawingGroup * > * GetDrawList()
Retrieves the current ImGUI drawing list.
Definition: drawing_list.cpp:25
Blam::GetConsoleState
BLAM bool GetConsoleState()
Legacy function to retrieve legacy ImGUI console visibility.
Definition: console_hack.cpp:128
InternalUI::Colors::console_error
UI_API ImVec4 console_error()
Definition: debug_ui_colors.cpp:30
InternalUI::Colors::console_color
UI_API ImVec4 console_color()
Definition: debug_ui_colors.cpp:27
InternalUI::Colors::mc_color_7_s
UI_API ImVec4 mc_color_7_s()
Definition: debug_ui_colors.cpp:61
UI_API
#define UI_API
Definition: debug_ui.h:26
InternalUI::font_fixedsys
UI_API ImFont * font_fixedsys()
Legacy function to set the ImGUI font to fixedsys.
show_console
bool show_console
Definition: console_hack.cpp:6
InternalUI::Colors::mc_color_f_s
UI_API ImVec4 mc_color_f_s()
Definition: debug_ui_colors.cpp:69
InternalUI::load_osx_styles
UI_API void load_osx_styles()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:543
InternalUI::LoadConfig
UI_API void LoadConfig()
Loads UI configuration file.
Blam::DebugUI::ShowErrorDialog
BLAM void ShowErrorDialog(const char *title, const char *message)
Shows a simple error dialog created using ImGUI.
Definition: debug_ui.cpp:166
InternalUI::Colors::d_white
UI_API ImVec4 d_white()
Definition: debug_ui_colors.cpp:72
InternalUI::load_hl2_styles
UI_API void load_hl2_styles()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:475
InternalUI::Colors::console_internal_gold
UI_API ImVec4 console_internal_gold()
Definition: debug_ui_colors.cpp:33
InternalUI::Colors::console_print
UI_API ImVec4 console_print()
Definition: debug_ui_colors.cpp:31
Blam::DebugUI::ImGUIDrawingGroup::show
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: debug_ui.h:362
InternalUI::Colors::console_shadow
UI_API ImVec4 console_shadow()
Definition: debug_ui_colors.cpp:29
Blam::DebugUI::Windows::HackConsoleNew
BLAM void HackConsoleNew(bool *show_testing_newconsole)
Definition: console_hack.cpp:71
InternalUI::Colors::mc_color_8
UI_API ImVec4 mc_color_8()
Definition: debug_ui_colors.cpp:45
Blam::DebugUI::ImGUIDrawingGroup::Show
bool * Show()
Retrieves whether or not this item should be shown.
Definition: debug_ui.h:379
Blam::DebugUI::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:359
InternalUI::Colors::mc_color_9
UI_API ImVec4 mc_color_9()
Definition: debug_ui_colors.cpp:46
InternalUI::Colors::mc_color_4
UI_API ImVec4 mc_color_4()
Definition: debug_ui_colors.cpp:41
InternalUI::Colors::mc_color_a_s
UI_API ImVec4 mc_color_a_s()
Definition: debug_ui_colors.cpp:64
InternalUI::Colors::d_text_dark
UI_API ImVec4 d_text_dark()
Definition: debug_ui_colors.cpp:77
BLAM
#define BLAM
Definition: debug_ui.h:22
InternalUI::Colors::crash_text_shadow_col
UI_API ImVec4 crash_text_shadow_col()
Definition: debug_ui_colors.cpp:23
Blam::SetConsoleState2
BLAM void SetConsoleState2(bool state)
i have no idea why this exists
Definition: console_hack.cpp:113
InternalUI::Colors::mc_color_5
UI_API ImVec4 mc_color_5()
Definition: debug_ui_colors.cpp:42
InternalUI::Colors::mc_color_6
UI_API ImVec4 mc_color_6()
Definition: debug_ui_colors.cpp:43
InternalUI::Colors::mc_color_0_s
UI_API ImVec4 mc_color_0_s()
Definition: debug_ui_colors.cpp:54
InternalUI::Colors::mc_color_e_s
UI_API ImVec4 mc_color_e_s()
Definition: debug_ui_colors.cpp:68
InternalUI::Shutdown
UI_API void Shutdown()
Cleans up any data used by the ImGUI draw list.
Definition: debug_ui.cpp:142
InternalUI::Colors::console_yellow
UI_API ImVec4 console_yellow()
Definition: debug_ui_colors.cpp:34
Blam::SetConsoleCommand2
BLAM void SetConsoleCommand2(std::string command)
i have no idea why this exists
Definition: console_hack.cpp:118
InternalUI::Colors::mc_color_8_s
UI_API ImVec4 mc_color_8_s()
Definition: debug_ui_colors.cpp:62
InternalUI::Colors::mc_color_b
UI_API ImVec4 mc_color_b()
Definition: debug_ui_colors.cpp:48
Blam::DebugUI::GetDrawListItem
BLAM ImGUIDrawingGroup * GetDrawListItem(std::string key)
Retrieves a drawing group with the specified ID.
Definition: drawing_list.cpp:30
show_testing_newconsole
bool show_testing_newconsole
Definition: console_hack.cpp:9
InternalUI::Colors::mc_color_4_s
UI_API ImVec4 mc_color_4_s()
Definition: debug_ui_colors.cpp:58
InternalUI::Colors::mc_color_d_s
UI_API ImVec4 mc_color_d_s()
Definition: debug_ui_colors.cpp:67
InternalUI
Namespace containing things for the engine's "internal UI", which is powered through ImGUI.
Definition: debug_menu.h:18
InternalUI::Colors::mc_color_3_s
UI_API ImVec4 mc_color_3_s()
Definition: debug_ui_colors.cpp:57
InternalUI::Colors::mc_color_b_s
UI_API ImVec4 mc_color_b_s()
Definition: debug_ui_colors.cpp:65
InternalUI::Colors::d_blurple
UI_API ImVec4 d_blurple()
Definition: debug_ui_colors.cpp:71
InternalUI::Colors::d_nqblack
UI_API ImVec4 d_nqblack()
Definition: debug_ui_colors.cpp:75
InternalUI::Colors::mc_color_d
UI_API ImVec4 mc_color_d()
Definition: debug_ui_colors.cpp:50
InternalUI::Render
UI_API void Render()
Renders all ImGUI data.
Definition: debug_ui.cpp:154
InternalUI::load_elaztek_styles_classic
UI_API void load_elaztek_styles_classic()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:213
InternalUI::load_elaztek_styles
UI_API void load_elaztek_styles()
Legacy function to apply a modified ImGUI color scheme.
Definition: ui_themes.cpp:142
InternalUI::CheckForUpdates
UI_API void CheckForUpdates()
Legacy function that would have checked for game engine updates.
InternalUI::Colors::mc_color_1
UI_API ImVec4 mc_color_1()
Definition: debug_ui_colors.cpp:38
InternalUI::Colors::mc_color_c_s
UI_API ImVec4 mc_color_c_s()
Definition: debug_ui_colors.cpp:66
InternalUI::Colors::mc_color_0
UI_API ImVec4 mc_color_0()
Definition: debug_ui_colors.cpp:37
InternalUI::Colors::crash_text_col
UI_API ImVec4 crash_text_col()
Definition: debug_ui_colors.cpp:22
InternalUI::Colors::transparent
UI_API ImVec4 transparent()
Definition: debug_ui_colors.cpp:35
InternalUI::Colors::mc_color_1_s
UI_API ImVec4 mc_color_1_s()
Definition: debug_ui_colors.cpp:55
InternalUI::SetFont
UI_API void SetFont(int id)
Legacy function to change the font used by ImGUI.