RType
src
lib
r_type
components
Animatable.cpp
Go to the documentation of this file.
1
/*
2
** EPITECH PROJECT, 2023
3
** RType
4
** File description:
5
** Animatable.cpp
6
*/
7
8
#
include
"Animatable.hpp"
9
10
#
include
<
cstring
>
11
#
include
<
utility
>
12
13
/**
14
* @brief Construct a new Animatable:: Animatable object
15
*/
16
Animatable
::
Animatable
()
17
{
18
_attribute
=
new
char
[64];
19
std::memset(
_attribute
, 0, 64);
20
}
21
22
/**
23
* @brief getAttribute, get the attribute
24
* @return attribute (char *)
25
*/
26
char
*
Animatable
::
getAttribute
()
const
27
{
28
return
_attribute
;
29
}
30
31
/**
32
* @brief setAttribute, set the attribute
33
* @param attribute
34
*/
35
void
Animatable
::
setAttribute
(std::string attribute)
36
{
37
std::memset(
_attribute
, 0, 64);
38
std::memcpy(
_attribute
, attribute.c_str(), attribute.size());
39
std::cout <<
"attribute: "
<<
_attribute
<< std::endl;
40
}
41
42
/**
43
* @brief setTarget, set the target
44
* @param target
45
*/
46
void
Animatable
::
setTarget
(std::shared_ptr<
Drawable
> target)
47
{
48
sprite = target;
49
}
50
51
/**
52
* @brief getTarget, get the target
53
* @return target (std::shared_ptr<Drawable>)
54
*/
55
std::shared_ptr<
Drawable
>
Animatable
::
getTarget
()
56
{
57
return
sprite;
58
}
59
60
/**
61
* @brief setTime, set the time
62
* @param frametime
63
*/
64
void
Animatable
::
setTime
(timeval frametime)
65
{
66
_frametime
= frametime;
67
}
68
69
/**
70
* @brief getTime, get the time
71
* @return timeval
72
*/
73
timeval
Animatable
::
getTime
()
74
{
75
return
_frametime
;
76
}
Generated by
1.9.1