2 #include <SFML/Graphics/RectangleShape.hpp>
3 #include <SFML/Graphics/RenderWindow.hpp>
4 #include <SFML/Graphics/Text.hpp>
5 #include <SFML/System/Vector2.hpp>
6 #include <unordered_map>
9 #include <SFML/Graphics/Color.hpp>
28 sf::Text placeholderText;
31 sf::RectangleShape container;
41 std::string placeholder;
43 std::unordered_map<std::string, std::variant<unsigned int, float, std::string>> styles = {
44 {
"fontPath",
"src/assets/AdwaitaSans-Regular.ttf"},
46 {
"letterSpacing", 1.f},
47 {
"fontColor", 0x000000FFu},
48 {
"outlineColor", 0x000000FFu},
49 {
"activeOutlineColor", 0x0288D1FFu},
50 {
"backgroundColor", 0xFFFFFFFFu},
51 {
"placeholderColor", 0x6E6E6EFFu},
55 void draw(sf::RenderWindow &window)
override;
56 void update(sf::RenderWindow &window)
override;
57 void drawText(sf::Text, sf::RenderWindow &window);
62 void render(sf::RenderWindow &window)
override;
68 void handleEvent(
const sf::Event &event, sf::RenderWindow &window)
override;
78 InputField(std::string placeholder =
"", std::unordered_map<std::string, std::variant<unsigned int, float, std::string>> styling = {});
85 void overrideStyling(std::unordered_map<std::string, std::variant<unsigned int, float, std::string>> styling);