Blamite Game Engine - blam!
00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
theme_editor.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "../../debug_ui.h"
4
5
#include "
components/resources/engine_text/engine_text.h
"
6
#include "
components/settings/config/config.h
"
7
#include "
components/ui/themes/themes.h
"
8
9
namespace
Blam::DebugUI::Windows
10
{
14
class
ModernThemeEditor
:
public
Blam::DebugUI::ImGUIDrawingGroup
15
{
16
private
:
17
int
active_theme_index = -1;
18
std::string selected_theme =
ENGINE_TEXT
(
"choose"
);
19
std::string selected_metrics =
ENGINE_TEXT
(
"choose"
);
20
float
global_ui_scale = 1.0f;
21
22
public
:
23
void
Draw
()
24
{
25
if
(
show
)
26
{
27
if
(ImGui::Begin(
"Theme Editor"
, &
show
))
28
{
29
if
(ImGui::BeginCombo(
"theme"
, selected_theme.c_str()))
30
{
31
for
(
int
i = 0; i <
Blam::UI::Themes::GetColorSchemeList
()->size(); i++)
32
{
33
BlamColorScheme
theme =
Blam::UI::Themes::GetColorSchemeList
()->at(i);
34
35
if
(ImGui::Selectable(theme.
name
.c_str()))
36
{
37
selected_theme = theme.
name
;
38
active_theme_index = i;
39
theme.
ApplyTheme
();
40
}
41
}
42
ImGui::EndCombo();
43
}
44
45
if
(ImGui::BeginCombo(
"metrics"
, selected_metrics.c_str()))
46
{
47
for
(
int
i = 0; i <
Blam::UI::Themes::GetMetricsList
()->size(); i++)
48
{
49
BlamThemeMetrics
metrics =
Blam::UI::Themes::GetMetricsList
()->at(i);
50
51
if
(ImGui::Selectable(metrics.
name
.c_str()))
52
{
53
selected_metrics = metrics.
name
;
54
active_theme_index = i;
55
metrics.
ApplyMetrics
();
56
}
57
}
58
ImGui::EndCombo();
59
}
60
61
ImGuiIO& io = ImGui::GetIO();
62
ImFont* font_current =
ImGui::GetFont
();
63
if
(ImGui::BeginCombo(
"imgui font"
, font_current->GetDebugName()))
64
{
65
for
(
int
i = 0; i < io.Fonts->Fonts.Size; i++)
66
{
67
ImFont* font = io.Fonts->Fonts[i];
68
ImGui::PushID((
void
*)font);
69
70
if
(ImGui::Selectable(font->GetDebugName(), font == font_current))
71
{
72
io.FontDefault = font;
73
}
74
75
ImGui::PopID();
76
}
77
ImGui::EndCombo();
78
}
79
ImGui::SameLine();
80
Blam::DebugUI::Widgets::ShowHelpMarker
(
ENGINE_TEXT
(
"imgui_theme_picker_font_info"
).c_str());
81
82
ImGui::InputFloat(
"imgui ui scale"
, &global_ui_scale, 1.0f, 0.0f, 20.0f);
83
ImGui::SameLine();
84
Blam::DebugUI::Widgets::ShowHelpMarker
(
ENGINE_TEXT
(
"imgui_theme_editor_ui_scale_help_text"
).c_str());
85
86
if
(ImGui::Button(
"Update Scale"
))
87
{
88
ImGui::GetStyle().ScaleAllSizes(global_ui_scale);
89
}
90
91
92
}
93
ImGui::End();
94
}
95
}
96
};
97
}
Blam::DebugUI::Widgets::ShowHelpMarker
BLAM void ShowHelpMarker(const char *desc)
Shows a help indicator.
Definition:
widgets.cpp:7
Blam::UI::Themes::GetMetricsList
BLAM std::vector< BlamThemeMetrics > * GetMetricsList()
Retrieves the list of currently loaded theme metrics.
Definition:
themes.cpp:456
themes.h
engine_text.h
Blam::Content::Fonts::GetFont
BLAM Font * GetFont(std::string id)
Retrieves a font from the list of loaded fonts.
Definition:
fonts.cpp:806
BlamColorScheme::name
std::string name
The name of the theme.
Definition:
themes.h:31
Blam::UI::Themes::GetColorSchemeList
BLAM std::vector< BlamColorScheme > * GetColorSchemeList()
Retrieves the list of currently loaded color schemes.
Definition:
themes.cpp:451
Blam::DebugUI::Windows::ModernThemeEditor
Class for the modern Theme Editor.
Definition:
theme_editor.hpp:14
BlamThemeMetrics
Definition:
themes.h:65
BlamColorScheme::ApplyTheme
void ApplyTheme()
Applies the theme to the engine UI.
Definition:
BlamColorScheme.cpp:13
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
BlamColorScheme
Class representing a Blam Color Scheme.
Definition:
themes.h:28
Blam::DebugUI::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition:
debug_ui.h:359
Blam::DebugUI::Windows::ModernThemeEditor::Draw
void Draw()
Draws the contents of the group.
Definition:
theme_editor.hpp:23
ENGINE_TEXT
#define ENGINE_TEXT(string_id)
Definition:
engine_text.h:7
config.h
Blam::DebugUI::Windows
Legacy namespace to contain data for the legacy ImGUI console.
Definition:
debug_ui.h:434
BlamThemeMetrics::ApplyMetrics
void ApplyMetrics()
Applies the metrics to the engine UI.
Definition:
BlamThemeMetrics.cpp:6
BlamThemeMetrics::name
std::string name
The name of the theme metrics.
Definition:
themes.h:68
blam
components
ui
imgui
imgui_windows
tools
theme_editor.hpp
Generated on Tue Jan 12 2021 01:11:27 for Blamite Game Engine - blam! by
1.8.17