R-Type
R-Type project
Rectangle.hpp
1 /*
2 ** EPITECH PROJECT, 2022
3 ** gameEngine2
4 ** File description:
5 ** Rectangle
6 */
7 
8 #ifndef RECTANGLE_HPP_
9 #define RECTANGLE_HPP_
10 
11 #include "Vectors.hpp"
12 
13 namespace KapEngine {
14  namespace Tools {
15  class Vector2;
16  }
17 }
18 
19 namespace KapEngine {
20 
21  namespace Tools {
22 
23  class Rectangle {
24  public:
25  Rectangle() {
26  PROFILER_FUNC_START();
27  PROFILER_FUNC_END();
28  }
29  Rectangle(float x, float y, float w, float h) {
30  PROFILER_FUNC_START();
31  setPos(x, y);
32  setSize(w, h);
33  PROFILER_FUNC_END();
34  }
35  Rectangle(Vector2 const& pos, Vector2 const& size) {
36  PROFILER_FUNC_START();
37  setPos(pos);
38  setSize(size);
39  PROFILER_FUNC_END();
40  }
41  ~Rectangle() {
42  PROFILER_FUNC_START();
43  PROFILER_FUNC_END();
44  }
45 
46  void setPos(float x, float y);
47  void setPos(Vector2 const& pos);
48  void setX(float x);
49  void setPosX(float x) {
50  PROFILER_FUNC_START();
51  setX(x);
52  PROFILER_FUNC_END();
53  }
54  void setY(float y);
55  void setPosY(float y) {
56  PROFILER_FUNC_START();
57  setY(y);
58  PROFILER_FUNC_END();
59  }
60 
61  void setSize(float width, float heigth);
62  void setSize(Vector2 const& size);
63  void setW(float w);
64  void setWidth(float w) {
65  PROFILER_FUNC_START();
66  setW(w);
67  PROFILER_FUNC_END();
68  }
69  void setH(float h);
70  void setHeigth(float h) {
71  PROFILER_FUNC_START();
72  setH(h);
73  PROFILER_FUNC_END();
74  }
75 
76  Vector2 getPos() const {
77  PROFILER_FUNC_START();
78  PROFILER_FUNC_END();
79  return _pos;
80  }
81 
82  Vector2 getSize() const {
83  PROFILER_FUNC_START();
84  PROFILER_FUNC_END();
85  return _size;
86  }
87 
88  float getX() const;
89  float getY() const;
90  float getWidth() const;
91  float getHeigth() const;
92 
93  std::string to_string() const;
94 
95  protected:
96  private:
97  Vector2 _pos;
98  Vector2 _size;
99  };
100 
101  }
102 
103 }
104 
105 #endif /* !RECTANGLE_HPP_ */
KapEngine::Tools::Vector2
Definition: Vectors.hpp:25
KapEngine
main namespace
Definition: Component.hpp:17
KapEngine::Tools::Rectangle
Definition: Rectangle.hpp:23