 |
Blamite Game Engine - blam!
00423.10.27.24.0533.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
5 #include <Strings/components/utils/string/string.h>
17 char search_buffer[128];
18 bool use_tabs =
false;
19 bool show_empty_tabs =
false;
62 float color_values[4];
64 color_values[0] = global->
color_value.GetRedAsFloat();
65 color_values[1] = global->
color_value.GetGreenAsFloat();
66 color_values[2] = global->
color_value.GetBlueAsFloat();
67 color_values[3] = global->
color_value.GetAlphaAsFloat();
85 if (global->
info.size() > 0)
107 void GenerateGlobalGroupedControls(std::string string_id_type, std::vector<BlamEngineGlobal*> list)
109 if (list.size() > 0 || show_empty_tabs)
111 std::string tab_title_id =
"globals_editor_group_" + string_id_type +
"_title";
112 std::string tab_desc_id =
"globals_editor_group_" + string_id_type +
"_desc";
113 std::string empty_message_id =
"globals_editor_group_" + string_id_type +
"_empty";
121 if (list.size() == 0)
126 for (
int i = 0; i < list.size(); i++)
128 GenerateGlobalControl(list.at(i));
154 std::map<std::string, BlamEngineGlobal>::iterator it;
156 std::string search_filter = std::string(search_buffer);
158 if (search_filter.length() == 0)
162 std::vector<BlamEngineGlobal*> boolean_globals = std::vector<BlamEngineGlobal*>();
163 std::vector<BlamEngineGlobal*> float_globals = std::vector<BlamEngineGlobal*>();
164 std::vector<BlamEngineGlobal*> short_globals = std::vector<BlamEngineGlobal*>();
165 std::vector<BlamEngineGlobal*> int_globals = std::vector<BlamEngineGlobal*>();
166 std::vector<BlamEngineGlobal*> long_globals = std::vector<BlamEngineGlobal*>();
167 std::vector<BlamEngineGlobal*> string_globals = std::vector<BlamEngineGlobal*>();
168 std::vector<BlamEngineGlobal*> color_globals = std::vector<BlamEngineGlobal*>();
169 std::vector<BlamEngineGlobal*> unsorted_globals = std::vector<BlamEngineGlobal*>();
173 switch (it->second.type)
177 boolean_globals.push_back(&it->second);
182 short_globals.push_back(&it->second);
187 long_globals.push_back(&it->second);
192 string_globals.push_back(&it->second);
197 int_globals.push_back(&it->second);
202 float_globals.push_back(&it->second);
207 color_globals.push_back(&it->second);
212 unsorted_globals.push_back(&it->second);
220 if (boolean_globals.size() > 0 || show_empty_tabs)
222 GenerateGlobalGroupedControls(
"boolean", boolean_globals);
223 GenerateGlobalGroupedControls(
"real", float_globals);
224 GenerateGlobalGroupedControls(
"short", short_globals);
225 GenerateGlobalGroupedControls(
"int", int_globals);
226 GenerateGlobalGroupedControls(
"long", long_globals);
227 GenerateGlobalGroupedControls(
"string", string_globals);
228 GenerateGlobalGroupedControls(
"color", color_globals);
229 GenerateGlobalGroupedControls(
"unsorted", unsorted_globals);
241 GenerateGlobalControl(&it->second);
247 std::vector<BlamEngineGlobal*> matching_globals = std::vector<BlamEngineGlobal*>();
248 int omitted_count = 0;
252 if (BlamStrings::Utils::String::Contains(it->second.name, search_filter))
254 matching_globals.push_back(&it->second);
264 ImGui::TextDisabled(std::string(
"showing matching globals only, omitting " + std::to_string(omitted_count) +
" globals").c_str());
266 for (
int i = 0; i < matching_globals.size(); i++)
268 GenerateGlobalControl(matching_globals.at(i));
Class for the engine Globals editor.
Definition: globals_editor.hpp:14
@ Real
Definition: globals.h:25
@ String
Represents a std::string.
Definition: globals.h:29
@ Long
Represents a long.
Definition: globals.h:27
IMGUI_API bool Checkbox(const char *label, bool *v)
Definition: imgui_widgets.cpp:974
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: imgui.h:34
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
@ Boolean
Represents a boolean. Can be true or false.
Definition: globals.h:24
std::string name
The name of the global.
Definition: globals.h:47
IMGUI_API void End()
Definition: imgui.cpp:6016
IMGUI_API void EndTabItem()
Definition: imgui_widgets.cpp:6851
bool boolean_value
The boolean value of the global.
Definition: globals.h:56
@ Int
Represents an int.
Definition: globals.h:30
IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f)
Definition: imgui.cpp:7147
Class representing an ImGUI window.
Definition: imgui.h:31
std::string info
An optional description of the global.
Definition: globals.h:48
BlamGlobalType type
The type of the global.
Definition: globals.h:46
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
Definition: imgui.cpp:5397
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
Structure containing data for a game engine global.
Definition: globals.h:44
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
short short_value
The short value of the global.
Definition: globals.h:57
IMGUI_API bool InputLong(const char *label, long *v, long step, long step_fast, ImGuiInputTextFlags flags)
Definition: imgui_extensions.cpp:52
BlamColor color_value
The color value of the global.
Definition: globals.h:61
@ Short
!< Represents a float.
Definition: globals.h:26
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
int int_value
The int value of the global.
Definition: globals.h:59
IMGUI_API void Separator()
Definition: imgui_widgets.cpp:1284
float float_value
The float value of the global.
Definition: globals.h:60
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
std::string value_raw
The raw value of the global as a string.
Definition: globals.h:49
IMGUI_API bool InputInt(const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags flags=0)
Definition: imgui_widgets.cpp:3031
@ Color
Represents a BlamColor. See #BlamColor for details.
Definition: globals.h:31
void Draw()
Draws the contents of the group.
Definition: globals_editor.hpp:137
BLAM std::map< std::string, BlamEngineGlobal > * GetGlobalsList()
Retrieves the list of loaded globals.
Definition: globals.cpp:22
long long_value
The long value of the global.
Definition: globals.h:58