diff options
Diffstat (limited to 'src/gui/Button.cpp')
-rw-r--r-- | src/gui/Button.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp index a0dd8e9..1849737 100644 --- a/src/gui/Button.cpp +++ b/src/gui/Button.cpp @@ -7,10 +7,10 @@ #include <mglpp/system/FloatRect.hpp> namespace gsr { - static const float padding_top = 10.0f; - static const float padding_bottom = 10.0f; - static const float padding_left = 10.0f; - static const float padding_right = 10.0f; + static const float padding_top_scale = 0.004629f; + static const float padding_bottom_scale = 0.004629f; + static const float padding_left_scale = 0.007f; + static const float padding_right_scale = 0.007f; Button::Button(mgl::Font *font, const char *text, mgl::vec2f size, mgl::Color bg_color) : size(size), bg_color(bg_color), text(text, *font) { @@ -40,10 +40,15 @@ namespace gsr { const bool mouse_inside = mgl::FloatRect(draw_pos, item_size).contains(window.get_mouse_position().to_vec2f()); if(mouse_inside) - draw_rectangle_outline(window, draw_pos, item_size, gsr::get_theme().tint_color, border_scale * gsr::get_theme().window_height); + draw_rectangle_outline(window, draw_pos, item_size, get_theme().tint_color, border_scale * get_theme().window_height); } mgl::vec2f Button::get_size() { + const int padding_top = padding_top_scale * get_theme().window_height; + const int padding_bottom = padding_bottom_scale * get_theme().window_height; + const int padding_left = padding_left_scale * get_theme().window_height; + const int padding_right = padding_right_scale * get_theme().window_height; + const mgl::vec2f text_bounds = text.get_bounds().size; mgl::vec2f s = size; if(s.x < 0.0001f) |