/
ne-ilyxa
/
SFMLProj
Обзор
Документация
Войти
/
ne-ilyxa
/
SFMLProj
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/gui/TextBox.hpp
32 строки
876 B
git1worker
Updated shooting by bots, selection menu, map1
10 сен 2023, 23:00
10 сен 2023, 23:00
09d6e5a
Код
Авторство
О чём код?
#pragma once #include "Element.hpp" #include <SFML/Graphics.hpp> #include <iostream> #include <memory> #include <string> class TextBox : public Element { public: TextBox(sf::RenderWindow *window, sf::Font *font, const float x, const float y, const unsigned int fSize = 30, const float w = 200, const float h = 60); void Draw() override; void Update() override; void SetDrawCursor(bool v); void AppendLetter(wchar_t ch); void DelLetter(); void ChangeText(std::wstring t); sf::RectangleShape &getRect(); void HandleTextbox(const sf::Event &event); private: void CheckWidthText(); int posCursor; sf::RenderWindow *window; sf::Font *Geologica; sf::Text text; sf::RectangleShape rect; sf::RectangleShape cursor; bool showCursor = true; sf::Clock cursorClock; bool drawCursor = false; };