-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextField.h
More file actions
58 lines (33 loc) · 778 Bytes
/
TextField.h
File metadata and controls
58 lines (33 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef TXTFIELD_H
#define TXTFIELD_H
#include <string>
#include <SFML/Graphics.hpp>
const int GUI_TEXT_MAX = 16;
const int GUI_TEXT_BACKSPACE = 8;
const int GUI_TEXT_ESCAPE = 27;
const sf::Color GUI_TEXT_GRAY = sf::Color(105, 105, 105);
class TextField {
public:
TextField();
void setPosition(sf::Vector2f vec);
void input(sf::Event ev);
void setFont(sf::Font& f);
const sf::String& getText();
void setPlaceholder(std::string str);
void render(sf::RenderWindow& window);
void setLength(int arg);
int getTextLength();
bool isActive();
void open();
private:
sf::Text txt;
sf::RectangleShape box;
int size;
int length;
bool renderPlaceholder;
void setActive(bool arg);
bool active;
sf::Vector2f pos;
std::string placeholder;
};
#endif