diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-02 01:36:43 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-02 01:36:43 +0200 |
commit | 9e68dfad4449d5c0180e252fada6de56b4f405d1 (patch) | |
tree | 5b507b70dca104852d1537bc83be61a484d65558 /src | |
parent | 48aa56227856b46d6502203f26464c05f16b6913 (diff) |
Matrix: improve entry style
Diffstat (limited to 'src')
-rw-r--r-- | src/Entry.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Entry.cpp b/src/Entry.cpp index a3c576f..f9897ba 100644 --- a/src/Entry.cpp +++ b/src/Entry.cpp @@ -4,17 +4,17 @@ #include <SFML/Window/Event.hpp> #include <cmath> -const float background_margin_horizontal = 15.0f; -const float padding_vertical = 5.0f; -const float background_margin_vertical = 4.0f; +const float background_margin_horizontal = 5.0f; +const float padding_vertical = 3.0f; +const float background_margin_vertical = 0.0f; namespace QuickMedia { Entry::Entry(const std::string &placeholder_text, sf::Font *font, sf::Font *cjk_font) : on_submit_callback(nullptr), - text("", font, cjk_font, 18, 0.0f), + text("", font, cjk_font, 16, 0.0f), width(0.0f), background(sf::Vector2f(1.0f, 1.0f), 7.0f, 10), - placeholder(placeholder_text, *font, 18) + placeholder(placeholder_text, *font, 16) { text.setEditable(true); background.setFillColor(sf::Color(55, 60, 68)); @@ -36,7 +36,7 @@ namespace QuickMedia { // (and also split text into lines to not draw them at all once they are not inside the scissor box) void Entry::draw(sf::RenderWindow &window) { background.setSize(sf::Vector2f(width, get_height())); - window.draw(background); + //window.draw(background); if(text.getString().isEmpty() && !text.isEditable()) { window.draw(placeholder); //sf::Vector2f placeholder_pos = placeholder.getPosition(); @@ -65,8 +65,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)); - placeholder.setPosition(pos + sf::Vector2f(background_margin_horizontal, background_margin_vertical + 7.0f)); + 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)); } void Entry::set_max_width(float width) { |