Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2024 |
3 |
|
|
** zappy |
4 |
|
|
** File description: |
5 |
|
|
** button |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#ifndef INPUT_HPP_ |
9 |
|
|
#define INPUT_HPP_ |
10 |
|
|
|
11 |
|
|
#include <SFML/Graphics.hpp> |
12 |
|
|
#include <string> |
13 |
|
|
|
14 |
|
|
class Input { |
15 |
|
|
public: |
16 |
|
|
Input(sf::Vector2f pos, sf::Vector2f size, std::string text, sf::Font &font, |
17 |
|
|
std::string accept = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); |
18 |
|
✗ |
~Input() {}; |
19 |
|
|
|
20 |
|
|
bool update(sf::Event event, sf::RenderWindow &window); |
21 |
|
|
void draw(sf::RenderWindow &window, float deltaTime); |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
std::string getInput() { |
25 |
|
✗ |
return _input; |
26 |
|
|
} |
27 |
|
|
void setInput(std::string input) { |
28 |
|
✗ |
_input = input; |
29 |
|
✗ |
} |
30 |
|
|
void setEnd(std::string end) { |
31 |
|
✗ |
_end = end; |
32 |
|
✗ |
} |
33 |
|
|
bool isFocused() { |
34 |
|
✗ |
return _isFocused; |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
protected: |
38 |
|
|
private: |
39 |
|
|
bool _isFocused = false; |
40 |
|
|
bool _hover = false; |
41 |
|
|
std::string _input = ""; |
42 |
|
|
std::string _placeHolder = ""; |
43 |
|
|
sf::Text _text; |
44 |
|
|
std::string _accept; |
45 |
|
|
std::string _end = ""; |
46 |
|
|
|
47 |
|
|
float _time = 0; |
48 |
|
|
}; |
49 |
|
|
|
50 |
|
|
#endif /* !INPUT_HPP_ */ |
51 |
|
|
|