 |
Blamite Game Engine - blam!
00346.12.11.21.0529.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
3 #include "../../debug_ui.h"
5 #include <Strings/components/utils/string/string.h>
19 char search_buffer[128];
20 bool use_tabs =
false;
21 bool show_empty_tabs =
false;
32 case Blam::Globals::GvarType::Boolean:
62 case Blam::Globals::GvarType::Color:
64 float color_values[4];
66 color_values[0] = global->
color_value.GetRedAsFloat();
67 color_values[1] = global->
color_value.GetGreenAsFloat();
68 color_values[2] = global->
color_value.GetBlueAsFloat();
69 color_values[3] = global->
color_value.GetAlphaAsFloat();
87 if (global->
info.size() > 0)
109 void GenerateGlobalGroupedControls(std::string string_id_type, std::vector<Blam::Globals::EngineGlobal*> list)
111 if (list.size() > 0 || show_empty_tabs)
113 std::string tab_title_id =
"globals_editor_group_" + string_id_type +
"_title";
114 std::string tab_desc_id =
"globals_editor_group_" + string_id_type +
"_desc";
115 std::string empty_message_id =
"globals_editor_group_" + string_id_type +
"_empty";
123 if (list.size() == 0)
128 for (
int i = 0; i < list.size(); i++)
130 GenerateGlobalControl(list.at(i));
156 std::map<std::string, Blam::Globals::EngineGlobal>::iterator it;
158 std::string search_filter = std::string(search_buffer);
160 if (search_filter.length() == 0)
164 std::vector<Blam::Globals::EngineGlobal*> boolean_globals = std::vector<Blam::Globals::EngineGlobal*>();
165 std::vector<Blam::Globals::EngineGlobal*> float_globals = std::vector<Blam::Globals::EngineGlobal*>();
166 std::vector<Blam::Globals::EngineGlobal*> short_globals = std::vector<Blam::Globals::EngineGlobal*>();
167 std::vector<Blam::Globals::EngineGlobal*> int_globals = std::vector<Blam::Globals::EngineGlobal*>();
168 std::vector<Blam::Globals::EngineGlobal*> long_globals = std::vector<Blam::Globals::EngineGlobal*>();
169 std::vector<Blam::Globals::EngineGlobal*> string_globals = std::vector<Blam::Globals::EngineGlobal*>();
170 std::vector<Blam::Globals::EngineGlobal*> color_globals = std::vector<Blam::Globals::EngineGlobal*>();
171 std::vector<Blam::Globals::EngineGlobal*> unsorted_globals = std::vector<Blam::Globals::EngineGlobal*>();
175 switch (it->second.type)
177 case Blam::Globals::GvarType::Boolean:
179 boolean_globals.push_back(&it->second);
184 short_globals.push_back(&it->second);
189 long_globals.push_back(&it->second);
194 string_globals.push_back(&it->second);
199 int_globals.push_back(&it->second);
204 float_globals.push_back(&it->second);
207 case Blam::Globals::GvarType::Color:
209 color_globals.push_back(&it->second);
214 unsorted_globals.push_back(&it->second);
222 if (boolean_globals.size() > 0 || show_empty_tabs)
224 GenerateGlobalGroupedControls(
"boolean", boolean_globals);
225 GenerateGlobalGroupedControls(
"float", float_globals);
226 GenerateGlobalGroupedControls(
"short", short_globals);
227 GenerateGlobalGroupedControls(
"int", int_globals);
228 GenerateGlobalGroupedControls(
"long", long_globals);
229 GenerateGlobalGroupedControls(
"string", string_globals);
230 GenerateGlobalGroupedControls(
"color", color_globals);
231 GenerateGlobalGroupedControls(
"unsorted", unsorted_globals);
243 GenerateGlobalControl(&it->second);
249 std::vector<Blam::Globals::EngineGlobal*> matching_globals = std::vector<Blam::Globals::EngineGlobal*>();
250 int omitted_count = 0;
254 if (BlamStrings::Utils::String::Contains(it->second.name, search_filter))
256 matching_globals.push_back(&it->second);
266 ImGui::TextDisabled(std::string(
"showing matching globals only, omitting " + std::to_string(omitted_count) +
" globals").c_str());
268 for (
int i = 0; i < matching_globals.size(); i++)
270 GenerateGlobalControl(matching_globals.at(i));
float float_value
The float value of the global.
Definition: globals.h:80
std::string info
An optional description of the global.
Definition: globals.h:68
@ Int
Represents an int.
Definition: globals.h:49
BlamColor color_value
The color value of the global.
Definition: globals.h:81
IMGUI_API bool Checkbox(const char *label, bool *v)
Definition: imgui_widgets.cpp:974
IMGUI_API bool InputText(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
Definition: imgui_widgets.cpp:3068
@ Long
Represents a long.
Definition: globals.h:46
IMGUI_API void End()
Definition: imgui.cpp:6016
IMGUI_API void EndTabItem()
Definition: imgui_widgets.cpp:6851
std::string name
The name of the global.
Definition: globals.h:67
short short_value
The short value of the global.
Definition: globals.h:77
IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f)
Definition: imgui.cpp:7147
std::map< std::string, EngineGlobal > globals
The list of loaded globals.
Definition: globals.cpp:20
@ String
Represents a std::string.
Definition: globals.h:48
@ Float
Definition: render_model.h:12
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
Definition: imgui.cpp:5397
Structure containing data for a game engine global.
Definition: globals.h:64
Add a fourth parameter to bake specific font ranges NULL
Definition: README.txt:57
IMGUI_API bool BeginTabBar(const char *str_id, ImGuiTabBarFlags flags=0)
Definition: imgui_widgets.cpp:6366
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
Definition: imgui_widgets.cpp:238
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: debug_ui.h:362
long long_value
The long value of the global.
Definition: globals.h:78
IMGUI_API bool InputTextWithHint(const char *label, const char *hint, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
Definition: imgui_widgets.cpp:3079
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:359
IMGUI_API bool InputLong(const char *label, long *v, long step, long step_fast, ImGuiInputTextFlags flags)
Definition: imgui_extensions.cpp:52
@ Short
Represents a short.
Definition: globals.h:45
int int_value
The int value of the global.
Definition: globals.h:79
void Draw()
Draws the contents of the group.
Definition: globals_editor.hpp:139
BLAM std::map< std::string, EngineGlobal > * GetGlobalsList()
Retrieves the list of loaded globals.
Definition: globals.cpp:22
IMGUI_API void EndTabBar()
Definition: imgui_widgets.cpp:6432
IMGUI_API bool InputShort(const char *label, short *v, short step, short step_fast, ImGuiInputTextFlags flags)
Definition: imgui_extensions.cpp:46
IMGUI_API bool ColorEdit4(const char *label, float col[4], ImGuiColorEditFlags flags=0)
Definition: imgui_widgets.cpp:4154
#define ENGINE_TEXT(string_id)
Definition: engine_text.h:7
IMGUI_API void Separator()
Definition: imgui_widgets.cpp:1284
std::string value_raw
The raw value of the global as a string.
Definition: globals.h:69
Legacy namespace to contain data for the legacy ImGUI console.
Definition: ui.h:14
GvarType type
The type of the global.
Definition: globals.h:66
IMGUI_API void TextColored(const ImVec4 &col, const char *fmt,...) IM_FMTARGS(2)
Definition: imgui_widgets.cpp:257
IMGUI_API bool InputFloat(const char *label, float *v, float step=0.0f, float step_fast=0.0f, const char *format="%.3f", ImGuiInputTextFlags flags=0)
Definition: imgui_widgets.cpp:2975
IMGUI_API bool BeginTabItem(const char *label, bool *p_open=NULL, ImGuiTabItemFlags flags=0)
Definition: imgui_widgets.cpp:6829
IMGUI_API void TextDisabled(const char *fmt,...) IM_FMTARGS(1)
Definition: imgui_widgets.cpp:272
IMGUI_API bool InputInt(const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags flags=0)
Definition: imgui_widgets.cpp:3031
Class for the engine Globals editor.
Definition: globals_editor.hpp:16
bool boolean_value
The boolean value of the global.
Definition: globals.h:76