diff --git a/include/Cubed/ui/label.hpp b/include/Cubed/ui/label.hpp index e02f694..0435eca 100644 --- a/include/Cubed/ui/label.hpp +++ b/include/Cubed/ui/label.hpp @@ -36,8 +36,8 @@ protected: private: TextStyle m_text; UIVertexData m_data; - float m_width = 0.0f; - float m_height = 0.0f; + float m_real_width = 0.0f; + float m_real_height = 0.0f; float m_offset_x = 0.0f; float m_offset_y = 0.0f; void update_vertices(); diff --git a/src/ui/button.cpp b/src/ui/button.cpp index 49bfaac..b6875a9 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -48,7 +48,7 @@ bool Button::handle_mouse_button_event(const MouseButtonEvent& e) { Widget& Button::set_position(const glm::vec2& pos) { m_pos = pos; m_background->set_position(pos); - m_foreground->set_position(pos); + m_foreground->set_position(pos.x, pos.y + m_foreground->height() / 2.0f); m_min_pos = pos; m_max_pos.x = m_min_pos.x + width(); diff --git a/src/ui/image.cpp b/src/ui/image.cpp index f13ddcc..3338d6f 100644 --- a/src/ui/image.cpp +++ b/src/ui/image.cpp @@ -19,7 +19,7 @@ float Image::height() const { Logger::error("Image id {} not set image!", m_id); return 0.0f; } - return m_texture->height(); + return m_texture->height() * m_scale; } float Image::width() const { @@ -27,7 +27,7 @@ float Image::width() const { Logger::error("Image id {} not set image!", m_id); return 0.0f; } - return m_texture->width(); + return m_texture->width() * m_scale; } const Texture* Image::texture() const { return m_texture; } diff --git a/src/ui/label.cpp b/src/ui/label.cpp index d114a46..d7ca24d 100644 --- a/src/ui/label.cpp +++ b/src/ui/label.cpp @@ -30,8 +30,8 @@ void Label::update_vertices() { m_offset_x = textmesh.min_x; m_offset_y = textmesh.min_y; - m_width = textmesh.width; - m_height = textmesh.height; + m_real_width = textmesh.width; + m_real_height = textmesh.height; m_data.update_sum(); m_data.upload(); @@ -39,8 +39,8 @@ void Label::update_vertices() { const UIVertexData& Label::data() const { return m_data; } const TextStyle& Label::text_style() const { return m_text; } -float Label::width() const { return m_width; } -float Label::height() const { return m_height; } +float Label::width() const { return m_real_width * m_scale; } +float Label::height() const { return m_real_height * m_scale; } float Label::offset_x() const { return m_offset_x; } float Label::offset_y() const { return m_offset_y; } diff --git a/src/ui/main_menu_ui_manager.cpp b/src/ui/main_menu_ui_manager.cpp index 835dc1f..a6339b5 100644 --- a/src/ui/main_menu_ui_manager.cpp +++ b/src/ui/main_menu_ui_manager.cpp @@ -18,6 +18,7 @@ void MainMenuUIManager::init() { m_scene.scene_manager().app().texture_manager()); auto& fore = start_game_button->set_foreground