RType
src
client
Components
Input
InputComponent.hpp
Go to the documentation of this file.
1
/*
2
** EPITECH PROJECT, 2023
3
** R-type
4
** File description:
5
** R-type
6
*/
7
8
#
pragma
once
9
10
#
include
"../AComponent.hpp"
11
#
include
<
functional
>
12
13
class
InputComponent
:
public
AComponent
14
{
15
public
:
16
17
/**
18
* @brief Construct a new Input Component object
19
*
20
* @param core
21
* @param socket
22
*/
23
explicit
InputComponent
(
ClientCore
*core, std::shared_ptr<
ClientSocket
> socket);
24
25
/**
26
* @brief action, call the callback function
27
*
28
*/
29
void
action
()
override
;
30
31
/**
32
* @brief setTexture set the texture of the component
33
*
34
* @param texture
35
*/
36
void
setTexture
(
const
sf::Texture &texture);
37
38
/**
39
* @brief setPosition set the position of the component
40
*
41
* @param position
42
*/
43
void
setPosition
(sf::Vector2f position);
44
45
/**
46
* @brief setSize set the size of the component
47
*
48
* @param size
49
*/
50
void
setSize
(sf::Vector2f size);
51
52
/**
53
* @brief setRect set the rect of the component
54
*
55
* @param rect
56
*/
57
void
setRect
(sf::IntRect rect);
58
59
/**
60
* @brief setIsClicked, set the isClicked of the component
61
*/
62
void
setIsClicked
(
bool
isClicked);
63
64
/**
65
* @brief display display the component
66
*
67
* @param window
68
*/
69
void
display
(sf::RenderWindow &window)
override
;
70
71
/**
72
* @brief getRect get the rect of the component
73
*
74
* @return sf::IntRect
75
*/
76
sf
::
IntRect
getRect
()
const
;
77
78
/**
79
* @brief handleEvent, handle the event
80
*
81
* @param event
82
* @param window
83
*/
84
void
handleEvent
(
const
sf::Event &event, sf::RenderWindow &window)
override
;
85
86
/**
87
* @brief handleClick, handle the click
88
*
89
*/
90
void
handleClick
();
91
92
/**
93
* @brief setText, set the text of the component
94
*
95
*/
96
void
setText
();
97
98
/**
99
* @brief getText, get the text of the component
100
*
101
*/
102
std::string
getText
();
103
104
std::string
_textEntry
;
105
106
private
:
107
sf::Texture _texture;
108
sf::Text _text;
109
sf::Font _font;
110
sf::Sprite _sprite;
111
sf::Vector2f _position;
112
sf::Vector2f _size;
113
sf::IntRect _rect;
114
std::function<
void
()> _callback;
115
bool
_isClicked;
116
std::shared_ptr<
ClientSocket
> _socket;
117
};
Generated by
1.9.1