From 02e029ed40f801e0710b09062069e7083cd30b93 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 17 Feb 2022 19:18:19 +0100 Subject: Add local anime tracking. Check readme for more info about local_anime config --- src/gui/Button.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp index 13bc8c6..bf9c174 100644 --- a/src/gui/Button.cpp +++ b/src/gui/Button.cpp @@ -4,9 +4,12 @@ #include #include #include -#include namespace QuickMedia { + static float floor(float v) { + return (int)v; + } + static const float PADDING_Y = 5.0f; Button::Button(const std::string &label, mgl::Font *font, float width, mgl::Shader *rounded_rectangle_shader, float scale) : @@ -14,7 +17,7 @@ namespace QuickMedia { background(mgl::vec2f(1.0f, 1.0f), 10.0f * get_config().scale, get_theme().shade_color, rounded_rectangle_shader), scale(scale) { - background.set_size(mgl::vec2f(std::floor(width * scale), get_height())); + background.set_size(mgl::vec2f(floor(width * scale), get_height())); set_position(mgl::vec2f(0.0f, 0.0f)); } @@ -60,8 +63,8 @@ namespace QuickMedia { const auto label_bounds = label.get_bounds(); mgl::vec2f label_pos(pos + background.get_size() * 0.5f - label_bounds.size * 0.5f - mgl::vec2f(0.0f, 5.0f * scale)); - label_pos.x = std::floor(label_pos.x); - label_pos.y = std::floor(label_pos.y); + label_pos.x = floor(label_pos.x); + label_pos.y = floor(label_pos.y); label.set_position(label_pos); } @@ -74,6 +77,6 @@ namespace QuickMedia { } float Button::get_height() { - return std::floor((PADDING_Y * 2.0f) * scale + label.get_bounds().size.y); + return floor((PADDING_Y * 2.0f) * scale + label.get_bounds().size.y); } } \ No newline at end of file -- cgit v1.2.3