Bomberman
Rectangle.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2021
3 ** Bomberman
4 ** File description:
5 ** Pixel
6 */
7 
8 #ifndef RECTANGLE2D_HPP_
9 #define RECTANGLE2D_HPP_
10 
11 #include <raylib.h>
13 
15 {
17  class Rectangle : public ADrawable2D
18  {
19  public:
24  Rectangle(const Vector2 &position,
25  const Vector2 &dimensions,
26  const Color &color = WHITE,
27  float scale = 1,
28  float rotation = 0);
29 
36  Rectangle(int x, int y, int width, int height, const Color &color = WHITE);
37 
39  Rectangle(const Rectangle &) = default;
40 
42  Rectangle &operator=(const Rectangle &) = default;
43 
45  ~Rectangle() override = default;
46 
48  const Vector2 &getDimensions(void);
49 
51  float getWidth(void) const;
52 
54  float getHeight(void) const;
55 
57  Rectangle &setDimensions(const Vector2 &dimensions);
58 
61  Rectangle &incrementWidth(float width);
62 
65  Rectangle &incrementHeight(float height);
66 
69  Rectangle &setHeight(float height);
70 
73  Rectangle &setWidth(float width);
74 
76  Rectangle &setDimensions(float x, float y);
77 
79  virtual void drawOn(RAY::Window &) override;
80 
82  virtual void drawOn(RAY::Image &image) override;
83 
84  protected:
87 
88  INTERNAL:
89 
90  operator ::Rectangle() const;
91  };
92 };
93 
94 #endif /* !PIXEL_HPP_ */
RAY::Drawables::Drawables2D::Rectangle::~Rectangle
~Rectangle() override=default
A default destructor.
RAY::Drawables::Drawables2D::Rectangle::setDimensions
Rectangle & setDimensions(const Vector2 &dimensions)
set dimensions
Definition: Rectangle.cpp:30
RAY::Drawables::Drawables2D::Rectangle::incrementHeight
Rectangle & incrementHeight(float height)
increment height of the rectangle
Definition: Rectangle.cpp:59
RAY::Window
Definition: Window.hpp:32
RAY::Drawables::Drawables2D::Rectangle::setHeight
Rectangle & setHeight(float height)
set rectangle's height
Definition: Rectangle.cpp:71
RAY::Vector2
A Two-dimensionnal Vector data type.
Definition: Vector2.hpp:15
RAY::Drawables::Drawables2D::Rectangle::setWidth
Rectangle & setWidth(float width)
set rectangle's width
Definition: Rectangle.cpp:65
RAY::Drawables::Drawables2D::Rectangle::getHeight
float getHeight(void) const
Definition: Rectangle.cpp:43
RAY::Drawables::Drawables2D::Rectangle::operator=
Rectangle & operator=(const Rectangle &)=default
A rectangle is assignable.
RAY::Drawables::Drawables2D::Rectangle::incrementWidth
Rectangle & incrementWidth(float width)
increment width of the rectangle
Definition: Rectangle.cpp:53
RAY::Drawables::Drawables2D::Rectangle::_dimensions
Vector2 _dimensions
Diemnsions of the rectangle.
Definition: Rectangle.hpp:86
RAY::Drawables::Drawables2D::Rectangle::getWidth
float getWidth(void) const
Definition: Rectangle.cpp:48
RAY::Drawables::Drawables2D::Rectangle
Rectangle in a two-dimensional space.
Definition: Rectangle.hpp:17
RAY::Drawables::Drawables2D::Rectangle::getDimensions
const Vector2 & getDimensions(void)
Definition: Rectangle.cpp:25
RAY::Image
Object representation of a framebuffer.
Definition: Image.hpp:20
RAY::Color
Object representation of color.
Definition: Color.hpp:15
RAY::Drawables::ADrawable2D
Abstraction of any two-dimensionnal drawable.
Definition: ADrawable2D.hpp:21
RAY::Drawables::Drawables2D::Rectangle::Rectangle
Rectangle(const Vector2 &position, const Vector2 &dimensions, const Color &color=WHITE, float scale=1, float rotation=0)
Rectangle constructor.
Definition: Rectangle.cpp:15
ADrawable2D.hpp
RAY::Drawables::Drawables2D::Rectangle::drawOn
virtual void drawOn(RAY::Window &) override
Draw point on window.
Definition: Rectangle.cpp:77
RAY::Drawables::Drawables2D
Definition: Circle.cpp:11