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/gui/Button.cpp | 2 +- src/gui/CheckBox.cpp | 6 +++--- src/gui/ComboBox.cpp | 4 ++-- src/gui/DropdownButton.cpp | 12 ++++++------ src/gui/Entry.cpp | 4 ++-- src/gui/FileChooser.cpp | 8 ++++---- src/gui/GsrPage.cpp | 4 ++-- src/gui/RadioButton.cpp | 4 ++-- src/gui/SettingsPage.cpp | 48 +++++++++++++++++++++++----------------------- src/gui/Subsection.cpp | 2 +- 10 files changed, 47 insertions(+), 47 deletions(-) (limited to 'src/gui') diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp index bccf7b0..fbf5cdd 100644 --- a/src/gui/Button.cpp +++ b/src/gui/Button.cpp @@ -49,7 +49,7 @@ namespace gsr { const bool mouse_inside = mgl::FloatRect(draw_pos, item_size).contains(window.get_mouse_position().to_vec2f()) && !has_parent_with_selected_child_widget(); if(mouse_inside) { - const mgl::Color outline_color = (bg_color == get_theme().tint_color) ? mgl::Color(255, 255, 255) : get_theme().tint_color; + const mgl::Color outline_color = (bg_color == get_color_theme().tint_color) ? mgl::Color(255, 255, 255) : get_color_theme().tint_color; draw_rectangle_outline(window, draw_pos, item_size, outline_color, std::max(1.0f, border_scale * get_theme().window_height)); } } diff --git a/src/gui/CheckBox.cpp b/src/gui/CheckBox.cpp index d602cca..9ae3b41 100644 --- a/src/gui/CheckBox.cpp +++ b/src/gui/CheckBox.cpp @@ -32,8 +32,8 @@ namespace gsr { background_sprite(&get_theme().checkbox_background_texture), circle_sprite(&get_theme().checkbox_circle_texture) { - background_sprite.set_color(get_theme().tint_color); - circle_sprite.set_color(get_theme().tint_color); + background_sprite.set_color(get_color_theme().tint_color); + circle_sprite.set_color(get_color_theme().tint_color); } bool CheckBox::on_event(mgl::Event &event, mgl::Window&, mgl::vec2f offset) { @@ -62,7 +62,7 @@ namespace gsr { apply_animation(); const mgl::Color background_color_unchecked(0, 0, 0, 120); - const mgl::Color background_color_checked = color_multiply(get_theme().tint_color, 0.6f); + const mgl::Color background_color_checked = color_multiply(get_color_theme().tint_color, 0.6f); background_sprite.set_color(interpolate_color(background_color_unchecked, background_color_checked, toggle_animation_value)); background_sprite.set_position(draw_pos.floor()); window.draw(background_sprite); diff --git a/src/gui/ComboBox.cpp b/src/gui/ComboBox.cpp index 96a64bf..62b2086 100644 --- a/src/gui/ComboBox.cpp +++ b/src/gui/ComboBox.cpp @@ -141,7 +141,7 @@ namespace gsr { cursor_inside = mgl::FloatRect(items_draw_pos, item_size).contains(mouse_pos); if(cursor_inside) { mgl::Rectangle item_background(items_draw_pos.floor(), item_size.floor()); - item_background.set_color(get_theme().tint_color); + item_background.set_color(get_color_theme().tint_color); window.draw(item_background); } } @@ -184,7 +184,7 @@ namespace gsr { void ComboBox::draw_item_outline(mgl::Window &window, mgl::vec2f pos, mgl::vec2f size) { const int border_size = std::max(1.0f, border_scale * get_theme().window_height); - const mgl::Color border_color = get_theme().tint_color; + const mgl::Color border_color = get_color_theme().tint_color; draw_rectangle_outline(window, pos.floor(), size.floor(), border_color, border_size); } diff --git a/src/gui/DropdownButton.cpp b/src/gui/DropdownButton.cpp index 28c1b5b..4a2ae3a 100644 --- a/src/gui/DropdownButton.cpp +++ b/src/gui/DropdownButton.cpp @@ -82,7 +82,7 @@ namespace gsr { window.draw(rect); } - const mgl::Color border_color = get_theme().tint_color; + const mgl::Color border_color = get_color_theme().tint_color; // Green line at top { @@ -100,7 +100,7 @@ namespace gsr { window.draw(rect); } - const mgl::Color border_color = get_theme().tint_color; + const mgl::Color border_color = get_color_theme().tint_color; draw_rectangle_outline(window, draw_pos, size, border_color, border_size); } else { // Background @@ -144,14 +144,14 @@ namespace gsr { if(i > 0) { const float separator_height = std::max(1.0f, item_size.y * 0.05f); mgl::Rectangle separator((item_position - mgl::vec2f(0.0f, separator_height * 0.5f)).floor(), mgl::vec2f(item_size.x, separator_height).floor()); - separator.set_color(get_theme().page_bg_color); + separator.set_color(get_color_theme().page_bg_color); window.draw(separator); } if(mouse_inside_item == -1) { const bool inside = mgl::FloatRect(item_position, item_size).contains({ (float)mouse_pos.x, (float)mouse_pos.y }); if(inside) { - draw_rectangle_outline(window, item_position, item_size, get_theme().tint_color, border_size); + draw_rectangle_outline(window, item_position, item_size, get_color_theme().tint_color, border_size); mouse_inside_item = i; } } @@ -212,8 +212,8 @@ namespace gsr { this->activated = activated; if(activated) { - description.set_color(get_theme().tint_color); - icon_sprite.set_color(get_theme().tint_color); + description.set_color(get_color_theme().tint_color); + icon_sprite.set_color(get_color_theme().tint_color); } else { description.set_color(mgl::Color(150, 150, 150)); icon_sprite.set_color(mgl::Color(255, 255, 255)); diff --git a/src/gui/Entry.cpp b/src/gui/Entry.cpp index 1cb8d16..4f318ec 100644 --- a/src/gui/Entry.cpp +++ b/src/gui/Entry.cpp @@ -17,7 +17,7 @@ namespace gsr { static const float caret_width_scale = 0.001f; Entry::Entry(mgl::Font *font, const char *text, float max_width) : text("", *font), max_width(max_width) { - this->text.set_color(get_theme().text_color); + this->text.set_color(get_color_theme().text_color); set_text(text); } @@ -63,7 +63,7 @@ namespace gsr { if(selected) { const int border_size = std::max(1.0f, border_scale * get_theme().window_height); - draw_rectangle_outline(window, draw_pos.floor(), get_size().floor(), get_theme().tint_color, border_size); + draw_rectangle_outline(window, draw_pos.floor(), get_size().floor(), get_color_theme().tint_color, border_size); const int caret_width = std::max(1.0f, caret_width_scale * get_theme().window_height); mgl::Rectangle caret({(float)caret_width, text.get_bounds().size.y}); diff --git a/src/gui/FileChooser.cpp b/src/gui/FileChooser.cpp index d445ccf..a58a582 100644 --- a/src/gui/FileChooser.cpp +++ b/src/gui/FileChooser.cpp @@ -93,7 +93,7 @@ namespace gsr { if(i == selected_item) { mgl::Rectangle selected_item_background(item_size.floor()); selected_item_background.set_position(item_pos.floor()); - selected_item_background.set_color(get_theme().tint_color); + selected_item_background.set_color(get_color_theme().tint_color); window.draw(selected_item_background); } if(!has_parent_with_selected_child_widget() && mouse_over_item == -1 && mgl::FloatRect(item_pos, item_size).contains(mouse_pos)) { @@ -102,7 +102,7 @@ namespace gsr { // selected_item_background.set_color(mgl::Color(20, 20, 20, 150)); // window.draw(selected_item_background); const float border_scale = 0.0015f; - draw_rectangle_outline(window, item_pos.floor(), item_size.floor(), get_theme().tint_color, border_scale * get_theme().window_height); + draw_rectangle_outline(window, item_pos.floor(), item_size.floor(), get_color_theme().tint_color, border_scale * get_theme().window_height); mouse_over_item = i; } @@ -249,7 +249,7 @@ namespace gsr { up_arrow_sprite.set_height((int)(current_directory_background_size.y * 0.8f)); up_arrow_sprite.set_position((draw_pos + mgl::vec2f(file_chooser_body_ptr->get_size().x - up_arrow_sprite.get_size().x, current_directory_background_size.y * 0.5f - up_arrow_sprite.get_size().y * 0.5f)).floor()); const bool mouse_inside_up_arrow = mgl::FloatRect(up_arrow_sprite.get_position(), up_arrow_sprite.get_size()).contains(window.get_mouse_position().to_vec2f()) && !has_parent_with_selected_child_widget(); - up_arrow_sprite.set_color(mouse_inside_up_arrow ? get_theme().tint_color : mgl::Color(255, 255, 255)); + up_arrow_sprite.set_color(mouse_inside_up_arrow ? get_color_theme().tint_color : mgl::Color(255, 255, 255)); window.draw(up_arrow_sprite); current_directory_background_size.x = file_chooser_body_ptr->get_size().x - up_arrow_sprite.get_size().x - up_button_spacing_scale * get_theme().window_height; @@ -258,7 +258,7 @@ namespace gsr { current_directory_background.set_position(draw_pos.floor()); window.draw(current_directory_background); - current_directory_text.set_color(get_theme().text_color); + current_directory_text.set_color(get_color_theme().text_color); current_directory_text.set_position((draw_pos + mgl::vec2f(current_directory_padding.x, current_directory_background_size.y * 0.5f - current_directory_text.get_bounds().size.y * 0.5f)).floor()); window.draw(current_directory_text); } diff --git a/src/gui/GsrPage.cpp b/src/gui/GsrPage.cpp index 7a5615c..e6ee5fc 100644 --- a/src/gui/GsrPage.cpp +++ b/src/gui/GsrPage.cpp @@ -55,12 +55,12 @@ namespace gsr { mgl::Rectangle background(content_page_size); background.set_position(content_page_position); - background.set_color(get_theme().page_bg_color); + background.set_color(get_color_theme().page_bg_color); window.draw(background); mgl::Rectangle border(mgl::vec2f(content_page_size.x, get_border_size()).floor()); border.set_position(content_page_position); - border.set_color(get_theme().tint_color); + border.set_color(get_color_theme().tint_color); window.draw(border); draw_page_label(window, content_page_position); diff --git a/src/gui/RadioButton.cpp b/src/gui/RadioButton.cpp index 925e133..8c937c6 100644 --- a/src/gui/RadioButton.cpp +++ b/src/gui/RadioButton.cpp @@ -72,13 +72,13 @@ namespace gsr { const mgl::vec2f item_size = item.text.get_bounds().size + mgl::vec2f(padding_left + padding_right, padding_top + padding_bottom); mgl::Rectangle background(item_size.floor()); background.set_position(draw_pos.floor()); - background.set_color(i == selected_item ? get_theme().tint_color : mgl::Color(0, 0, 0, 120)); + background.set_color(i == selected_item ? get_color_theme().tint_color : mgl::Color(0, 0, 0, 120)); window.draw(background); const bool mouse_inside = mgl::FloatRect(draw_pos, item_size).contains(window.get_mouse_position().to_vec2f()); if(can_select_item && mouse_inside) { const int border_size = std::max(1.0f, border_scale * get_theme().window_height); - const mgl::Color border_color = i == selected_item ? mgl::Color(255, 255, 255) : get_theme().tint_color; + const mgl::Color border_color = i == selected_item ? mgl::Color(255, 255, 255) : get_color_theme().tint_color; draw_rectangle_outline(window, draw_pos.floor(), item_size.floor(), border_color, border_size); } diff --git a/src/gui/SettingsPage.cpp b/src/gui/SettingsPage.cpp index 9c755cc..fc376ad 100644 --- a/src/gui/SettingsPage.cpp +++ b/src/gui/SettingsPage.cpp @@ -23,7 +23,7 @@ namespace gsr { settings_title_text("Settings", get_theme().title_font) { auto content_page = std::make_unique(); - content_page->add_button("Back", "back", get_theme().page_bg_color); + content_page->add_button("Back", "back", get_color_theme().page_bg_color); content_page->on_click = [page_stack](const std::string &id) { if(id == "back") page_stack->pop(); @@ -68,14 +68,14 @@ namespace gsr { std::unique_ptr SettingsPage::create_record_area(const GsrInfo &gsr_info) { auto record_area_list = std::make_unique(List::Orientation::VERTICAL); - record_area_list->add_widget(std::make_unique