aboutsummaryrefslogtreecommitdiff
path: root/src/Entry.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-09-04 02:31:10 +0200
committerdec05eba <dec05eba@protonmail.com>2021-09-04 02:31:10 +0200
commitfa815c3eee27cdae69b2e765b03de62a13f6379d (patch)
tree4244ae7b62e2c94d749f0b199dd620bdd251dad0 /src/Entry.cpp
parentdd4573e05cdfa2d9b99ef7a49c99e27c201da3e9 (diff)
Make font sizes customizable with a config file, see example-config.json. Remove environment variables
Diffstat (limited to 'src/Entry.cpp')
-rw-r--r--src/Entry.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Entry.cpp b/src/Entry.cpp
index 771e2fd..f35e34f 100644
--- a/src/Entry.cpp
+++ b/src/Entry.cpp
@@ -1,5 +1,6 @@
#include "../include/Entry.hpp"
#include "../include/ResourceLoader.hpp"
+#include "../include/Config.hpp"
#include "../include/Utils.hpp"
#include "../include/Theme.hpp"
#include <SFML/Graphics/RenderWindow.hpp>
@@ -8,17 +9,17 @@
#include <math.h>
namespace QuickMedia {
- static const float background_margin_horizontal = std::floor(5.0f * get_ui_scale());
- static const float padding_vertical = std::floor(5.0f * get_ui_scale());
- static const float background_margin_vertical = std::floor(0.0f * get_ui_scale());
+ static const float background_margin_horizontal = std::floor(5.0f * get_config().scale);
+ static const float padding_vertical = std::floor(5.0f * get_config().scale);
+ static const float background_margin_vertical = std::floor(0.0f * get_config().scale);
Entry::Entry(const std::string &placeholder_text, sf::Shader *rounded_rectangle_shader) :
on_submit_callback(nullptr),
draw_background(true),
- text("", false, std::floor(16 * get_ui_scale() * get_font_scale()), 0.0f),
+ text("", false, std::floor(get_config().input.font_size * get_config().scale * get_config().font_scale), 0.0f),
width(0.0f),
background(sf::Vector2f(1.0f, 1.0f), 10.0f, get_current_theme().selected_color, rounded_rectangle_shader),
- placeholder(placeholder_text, *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(16 * get_ui_scale() * get_font_scale())),
+ placeholder(placeholder_text, *FontLoader::get_font(FontLoader::FontType::LATIN), std::floor(get_config().input.font_size * get_config().scale * get_config().font_scale)),
mouse_left_inside(false)
{
text.setEditable(true);
@@ -107,7 +108,7 @@ namespace QuickMedia {
void Entry::set_position(const sf::Vector2f &pos) {
background.set_position(pos);
text.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical));
- placeholder.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical + std::floor(5.0f * get_ui_scale())));
+ placeholder.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical + std::floor(5.0f * get_config().scale)));
}
void Entry::set_max_width(float width) {