RType
Animatable.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2023
3 ** RType
4 ** File description:
5 ** Animatable.hpp
6 */
7 
8 #pragma once
9 
10 #include "../networking/shared/USocket.hpp"
11 #include "Drawable.hpp"
12 #include "IComponent.hpp"
13 #include <iostream>
14 #include <memory>
15 #include <sys/time.h>
16 #include <tuple>
17 
19 {
20  public:
21 
22  /**
23  * @brief Construct a new Animatable:: Animatable object
24  */
25  Animatable();
26 
27  /**
28  * @brief getAttribute, get the attribute
29  *
30  * @return attribute (char *)
31  */
32  [[nodiscard]] char *getAttribute() const override;
33 
34  /**
35  * @brief setAttribute, set the attribute
36  *
37  * @param attribute
38  */
39  void setAttribute(std::string attribute) override;
40 
41  /**
42  * @brief setTarget, set the target
43  *
44  * @param target
45  */
46  void setTarget(std::shared_ptr<Drawable> target);
47 
48  /**
49  * @brief getTarget, get the target
50  *
51  * @return target (std::shared_ptr<Drawable>)
52  */
53  std::shared_ptr<Drawable> getTarget();
54 
55  /**
56  * @brief setTime, set the time
57  *
58  * @param frametime
59  */
60  void setTime(timeval frametime);
61 
62  /**
63  * @brief getTime, get the time
64  *
65  * @return timeval
66  */
67  timeval getTime();
68 
69  timeval _now;
70  timeval _diff;
71  timeval _chrono;
77 
78  protected:
79  std::shared_ptr<Drawable> sprite;
80  timeval _frametime;
81 };