aboutsummaryrefslogtreecommitdiff
path: root/src/Entry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entry.cpp')
-rw-r--r--src/Entry.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Entry.cpp b/src/Entry.cpp
index c18006f..facb615 100644
--- a/src/Entry.cpp
+++ b/src/Entry.cpp
@@ -1,22 +1,23 @@
#include "../include/Entry.hpp"
#include "../include/ResourceLoader.hpp"
+#include "../include/Utils.hpp"
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Window/Event.hpp>
#include <cmath>
-const float background_margin_horizontal = 5.0f;
-const float padding_vertical = 3.0f;
-const float background_margin_vertical = 0.0f;
+const float background_margin_horizontal = 5.0f * QuickMedia::get_ui_scale();
+const float padding_vertical = 3.0f * QuickMedia::get_ui_scale();
+const float background_margin_vertical = 0.0f * QuickMedia::get_ui_scale();
namespace QuickMedia {
Entry::Entry(const std::string &placeholder_text) :
on_submit_callback(nullptr),
draw_background(true),
- text("", false, 16, 0.0f),
+ text("", false, 16 * get_ui_scale(), 0.0f),
width(0.0f),
background(sf::Vector2f(1.0f, 1.0f), 7.0f, 10),
- placeholder(placeholder_text, *FontLoader::get_font(FontLoader::FontType::LATIN), 16)
+ placeholder(placeholder_text, *FontLoader::get_font(FontLoader::FontType::LATIN), 16 * get_ui_scale())
{
text.setEditable(true);
background.setFillColor(sf::Color(55, 60, 68));
@@ -74,8 +75,8 @@ namespace QuickMedia {
void Entry::set_position(const sf::Vector2f &pos) {
background.setPosition(pos);
- text.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical - 3.0f));
- placeholder.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical + 3.0f));
+ text.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical - 3.0f * get_ui_scale()));
+ placeholder.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical + 3.0f * get_ui_scale()));
}
void Entry::set_max_width(float width) {