From 80ff6582a95854712221bf4c84252584566ac041 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 27 Oct 2024 13:56:03 +0100 Subject: Fix window not visible in fullscreen applications --- src/Theme.cpp | 60 ++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 19 deletions(-) (limited to 'src/Theme.cpp') diff --git a/src/Theme.cpp b/src/Theme.cpp index 8865796..a88aa1e 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -5,6 +5,7 @@ namespace gsr { static Theme *theme = nullptr; + static ColorTheme *color_theme = nullptr; bool Theme::set_window_size(mgl::vec2i window_size) { if(std::abs(window_size.x - window_width) < 0.1f && std::abs(window_size.y - window_height) < 0.1f) @@ -25,30 +26,12 @@ namespace gsr { return true; } - bool init_theme(const GsrInfo &gsr_info, const std::string &resources_path) { + bool init_theme(const std::string &resources_path) { if(theme) return true; theme = new Theme(); - switch(gsr_info.gpu_info.vendor) { - case GpuVendor::UNKNOWN: { - break; - } - case GpuVendor::AMD: { - theme->tint_color = mgl::Color(221, 0, 49); - break; - } - case GpuVendor::INTEL: { - theme->tint_color = mgl::Color(8, 109, 183); - break; - } - case GpuVendor::NVIDIA: { - theme->tint_color = mgl::Color(118, 185, 0); - break; - } - } - if(!theme->body_font_file.load((resources_path + "fonts/NotoSans-Regular.ttf").c_str(), mgl::MemoryMappedFile::LoadOptions{true, false})) goto error; @@ -118,4 +101,43 @@ namespace gsr { assert(theme); return *theme; } + + bool init_color_theme(const GsrInfo &gsr_info) { + if(color_theme) + return true; + + color_theme = new ColorTheme(); + + switch(gsr_info.gpu_info.vendor) { + case GpuVendor::UNKNOWN: { + break; + } + case GpuVendor::AMD: { + color_theme->tint_color = mgl::Color(221, 0, 49); + break; + } + case GpuVendor::INTEL: { + color_theme->tint_color = mgl::Color(8, 109, 183); + break; + } + case GpuVendor::NVIDIA: { + color_theme->tint_color = mgl::Color(118, 185, 0); + break; + } + } + + return true; + } + + void deinit_color_theme() { + if(color_theme) { + delete color_theme; + color_theme = nullptr; + } + } + + ColorTheme& get_color_theme() { + assert(color_theme); + return *color_theme; + } } \ No newline at end of file -- cgit v1.2.3