RType
src
lib
r_type
components
Timer.hpp
Go to the documentation of this file.
1
//
2
// Created by talleux on 1/10/24.
3
//
4
5
#
pragma
once
6
7
#
include
"../networking/shared/USocket.hpp"
8
#
include
"Drawable.hpp"
9
#
include
"IComponent.hpp"
10
11
class
Timer
:
public
IComponentRType
12
{
13
public
:
14
15
/**
16
* @brief Construct a new Timer:: Timer object
17
*/
18
Timer
();
19
20
21
/**
22
* @brief getAttribute, get the attribute
23
*
24
* @return attribute (char *)
25
*/
26
[[
nodiscard
]]
char
*
getAttribute
()
const
override
;
27
28
/**
29
* @brief setAttribute, set the attribute
30
*
31
* @param attribute
32
*/
33
void
setAttribute
(std::string attribute)
override
;
34
35
/**
36
* @brief setTarget, set the target
37
*
38
* @param target
39
*/
40
void
setTarget
(std::shared_ptr<
Drawable
> target);
41
42
/**
43
* @brief getTarget, get the target
44
*
45
* @return target (std::shared_ptr<Drawable>)
46
*/
47
std::shared_ptr<
Drawable
>
getTarget
();
48
49
50
/**
51
* @brief setActive, set the timer active
52
*
53
* @param active
54
*/
55
void
setActive
(
bool
active);
56
57
/**
58
* @brief getActive, get the timer active
59
*
60
* @return active (bool)
61
*/
62
bool
isActive
()
const
;
63
64
void
setDirection
(
int
direction);
65
int
getDirection
()
const
;
66
67
68
timeval
_startTime
{};
69
timeval
_now
{};
70
timeval
_targetTime
{};
71
timeval
_diff
{};
72
73
protected
:
74
std::shared_ptr<
Drawable
>
_target
;
75
bool
_active
;
76
int
_direction
;
77
78
79
80
};
Generated by
1.9.1