Theme and ImGui helpers live in the imgui namespace, matching their files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 18:47:42 -04:00
1 parent 901c11691b
commit c04a685f18
6 files changed
+12 -15

No files matched your search

+1 -1
View File
@@ -237,7 +237,7 @@ namespace anm2ed
logger.info("Initialized Dear ImGui");
imgui::theme_set((theme::Type)settings.theme);
imgui::theme_set((imgui::theme::Type)settings.theme);
ImGui_ImplSDL3_InitForOpenGL(window, glContext);
ImGui_ImplOpenGL3_Init("#version 330");
+1 -1
View File
@@ -52,7 +52,7 @@ namespace anm2ed
X(WINDOW_POSITION, windowPosition, STRING_UNDEFINED, IVEC2, glm::ivec2()) \
X(IS_VSYNC, isVsync, STRING_UNDEFINED, BOOL, true) \
X(UI_SCALE, uiScale, STRING_UNDEFINED, FLOAT, 1.0f) \
X(THEME, theme, STRING_UNDEFINED, INT, types::theme::DARK) \
X(THEME, theme, STRING_UNDEFINED, INT, imgui::theme::DARK) \
X(LANGUAGE, language, STRING_UNDEFINED, INT, ENGLISH) \
\
X(FILE_IS_AUTOSAVE, fileIsAutosave, STRING_UNDEFINED, BOOL, true) \
+1 -4
View File
@@ -5,7 +5,7 @@
#include <glm/glm.hpp>
#include <imgui/imgui.h>
namespace anm2ed::types
namespace anm2ed::imgui
{
constexpr ImVec2 to_imvec2(const glm::vec2& v) noexcept { return {v.x, v.y}; }
constexpr glm::vec2 to_vec2(const ImVec2& v) noexcept { return {v.x, v.y}; }
@@ -24,10 +24,7 @@ namespace anm2ed::types
static T value{-1};
return value;
}
}
namespace anm2ed::imgui
{
float row_widget_width_get(int, float = ImGui::GetContentRegionAvail().x);
ImVec2 widget_size_with_row_get(int, float = ImGui::GetContentRegionAvail().x);
float footer_height_get(int = 1);
+2 -2
View File
@@ -66,9 +66,9 @@ namespace anm2ed::imgui
switch (position)
{
case POPUP_CENTER:
ImGui::SetNextWindowPos(viewport->GetCenter(), ImGuiCond_None, types::to_imvec2(glm::vec2(0.5f)));
ImGui::SetNextWindowPos(viewport->GetCenter(), ImGuiCond_None, to_imvec2(glm::vec2(0.5f)));
if (POPUP_IS_HEIGHT_SET[type])
ImGui::SetNextWindowSize(types::to_imvec2(types::to_vec2(viewport->Size) * POPUP_MULTIPLIERS[type]));
ImGui::SetNextWindowSize(to_imvec2(to_vec2(viewport->Size) * POPUP_MULTIPLIERS[type]));
else
ImGui::SetNextWindowSize(ImVec2(viewport->Size.x * POPUP_MULTIPLIERS[type], 0));
break;
+5 -5
View File
@@ -19,25 +19,25 @@ namespace anm2ed::imgui
constexpr ImVec4 COLOR_LIGHT_CHECK_MARK{0.0f, 0.0f, 0.0f, 1.0f};
constexpr auto FRAME_BORDER_SIZE = 1.0f;
void theme_set(types::theme::Type theme)
void theme_set(theme::Type theme)
{
switch (theme)
{
case types::theme::LIGHT:
case theme::LIGHT:
ImGui::StyleColorsLight();
break;
case types::theme::DARK:
case theme::DARK:
default:
ImGui::StyleColorsDark();
break;
case types::theme::CLASSIC:
case theme::CLASSIC:
ImGui::StyleColorsClassic();
break;
}
auto& style = ImGui::GetStyle();
style.FrameBorderSize = FRAME_BORDER_SIZE;
if (theme == types::theme::LIGHT)
if (theme == theme::LIGHT)
{
auto& colors = style.Colors;
colors[ImGuiCol_Button] = COLOR_LIGHT_BUTTON;
+2 -2
View File
@@ -2,7 +2,7 @@
#include "strings.hpp"
namespace anm2ed::types::theme
namespace anm2ed::imgui::theme
{
#define THEMES \
X(LIGHT, LABEL_THEME_LIGHT) \
@@ -28,5 +28,5 @@ namespace anm2ed::types::theme
namespace anm2ed::imgui
{
void theme_set(types::theme::Type);
void theme_set(theme::Type);
}