aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-09-11 19:32:02 +0200
committerdec05eba <dec05eba@protonmail.com>2024-09-11 19:32:02 +0200
commitc6942aaa9a9cd87ac1615214788ea6a09cfe0a4c (patch)
tree1d7d16c14ad01d38d2a7c709e8d0bccb41074e0b
parentcb04c11b2c29d973cdda9b0336024946bb3ca93d (diff)
Nicer close window button
-rw-r--r--src/Overlay.cpp16
-rw-r--r--src/gui/CheckBox.cpp4
2 files changed, 10 insertions, 10 deletions
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index fae74e0..bc51b42 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -273,7 +273,7 @@ namespace gsr {
top_bar_background = mgl::Rectangle(mgl::vec2f(get_theme().window_width, get_theme().window_height*0.06f).floor());
top_bar_text = mgl::Text("GPU Screen Recorder", get_theme().top_bar_font);
logo_sprite = mgl::Sprite(&get_theme().logo_texture);
- close_button_widget.set_size(mgl::vec2f(top_bar_background.get_size().y * 0.3f, top_bar_background.get_size().y * 0.3f).floor());
+ close_button_widget.set_size(mgl::vec2f(top_bar_background.get_size().y * 0.35f, top_bar_background.get_size().y * 0.35f).floor());
bg_screenshot_overlay.set_color(bg_color);
top_bar_background.set_color(mgl::Color(0, 0, 0, 180));
@@ -434,15 +434,15 @@ namespace gsr {
front_page_ptr->add_widget(std::move(main_buttons_list));
close_button_widget.draw_handler = [&](mgl::Window &window, mgl::vec2f pos, mgl::vec2f size) {
- if(mgl::FloatRect(pos, size).contains(window.get_mouse_position().to_vec2f())) {
- const float border_scale = 0.0015f;
- const int border_size = std::max(1.0f, border_scale * get_theme().window_height);
- draw_rectangle_outline(window, pos, size, get_theme().tint_color, border_size);
- }
+ const int border_size = std::max(1.0f, 0.0015f * get_theme().window_height);
+ const float padding_size = std::max(1.0f, 0.003f * get_theme().window_height);
+ const mgl::vec2f padding(padding_size, padding_size);
+ if(mgl::FloatRect(pos, size).contains(window.get_mouse_position().to_vec2f()))
+ draw_rectangle_outline(window, pos.floor(), size.floor(), get_theme().tint_color, border_size);
mgl::Sprite close_sprite(&get_theme().close_texture);
- close_sprite.set_position(pos);
- close_sprite.set_size(size);
+ close_sprite.set_position(pos + padding);
+ close_sprite.set_size(size - padding * 2.0f);
window.draw(close_sprite);
};
diff --git a/src/gui/CheckBox.cpp b/src/gui/CheckBox.cpp
index 74e84d1..f1c84ff 100644
--- a/src/gui/CheckBox.cpp
+++ b/src/gui/CheckBox.cpp
@@ -58,8 +58,8 @@ 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.7f);
- background_sprite.set_color(interpolate_color(background_color_unchecked, background_color_checked, checked ? 1.0f : 0.0f));
+ const mgl::Color background_color_checked = color_multiply(get_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);