 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
25 #ifndef RAYLIB_CPP_INCLUDE_RECTANGLE_HPP_
26 #define RAYLIB_CPP_INCLUDE_RECTANGLE_HPP_
28 #include "./raylib.hpp"
29 #include "./raylib-cpp-utils.hpp"
30 #include "./Vector2.hpp"
46 : ::
Rectangle{position.x, position.y, size.x, size.y} {}
49 GETTERSETTER(
float, X, x)
50 GETTERSETTER(
float, Y, y)
51 GETTERSETTER(
float, Width, width)
52 GETTERSETTER(
float, Height, height)
65 return {x, y, width, height};
68 operator ::Vector4()
const {
69 return {x, y, width, height};
76 ::DrawRectangle(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
77 static_cast<int>(height), color);
82 ::DrawRectanglePro(*
this, origin, rotation, color);
87 ::DrawRectangleGradientV(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
88 static_cast<int>(height), color1, color2);
93 ::DrawRectangleGradientH(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
94 static_cast<int>(height), color1, color2);
99 ::DrawRectangleGradientEx(*
this, col1, col2, col3, col4);
104 ::DrawRectangleLines(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
105 static_cast<int>(height), color);
110 ::DrawRectangleLinesEx(*
this, lineThick, color);
115 ::DrawRectangleRounded(*
this, roundness, segments, color);
121 ::DrawRectangleRoundedLines(*
this, roundness, segments, lineThick, color);
129 return ::CheckCollisionRecs(*
this, rec2);
136 return ::GetCollisionRec(*
this, rec2);
143 return ::CheckCollisionPointRec(point, *
this);
150 return ::CheckCollisionCircleRec(center, radius, *
this);
154 return {width, height};
164 return SetSize(size.x, size.y);
182 inline void set(const ::Rectangle& rect) {
186 height = rect.height;
191 #endif // RAYLIB_CPP_INCLUDE_RECTANGLE_HPP_
inline ::Vector2 GetPosition()
Provides all the classes associated with raylib-cpp.
Rectangle & SetSize(float newWidth, float newHeight)
Rectangle & DrawRounded(float roundness, int segments, ::Color color)
Rectangle & DrawGradientH(::Color color1, ::Color color2)
Rectangle(::Vector2 size)
Rectangle & Draw(::Vector2 origin, float rotation, ::Color color)
inline ::Vector2 GetSize()
Rectangle(::Vector2 position, ::Vector2 size)
Rectangle & SetPosition(const ::Vector2 &position)
Rectangle & DrawGradientV(::Color color1, ::Color color2)
Rectangle & DrawLines(::Color color)
bool CheckCollision(::Vector2 point) const
Check if point is inside rectangle.
inline ::Vector4 ToVector4()
bool CheckCollision(::Vector2 center, float radius)
Check collision between circle and rectangle.
Rectangle(const ::Rectangle &vec)
Rectangle(float x, float y, float width)
inline ::Rectangle GetCollision(::Rectangle rec2) const
Get collision rectangle for two rectangles collision.
Rectangle & SetSize(const ::Vector2 &size)
Rectangle & SetPosition(float newX, float newY)
Rectangle(float x, float y)
Rectangle(float x, float y, float width, float height)
Rectangle & DrawGradient(::Color col1, ::Color col2, ::Color col3, ::Color col4)
bool CheckCollision(::Rectangle rec2) const
Check collision between two rectangles.
Rectangle & DrawLines(::Color color, int lineThick)
void set(const ::Rectangle &rect)
Rectangle & Draw(::Color color)
Draw a color-filled rectangle.
Rectangle & DrawRoundedLines(float roundness, int segments, int lineThick, ::Color color)
Rectangle & operator=(const Rectangle &rect)