1 #ifndef RAYLIB_CPP_INCLUDE_RECTANGLE_HPP_
2 #define RAYLIB_CPP_INCLUDE_RECTANGLE_HPP_
4 #include "./raylib.hpp"
5 #include "./raylib-cpp-utils.hpp"
6 #include "./Vector2.hpp"
25 :
::Rectangle{position.x, position.y, size.x, size.y} {}
29 GETTERSETTER(
float, X, x)
30 GETTERSETTER(
float, Y, y)
31 GETTERSETTER(
float, Width, width)
32 GETTERSETTER(
float, Height, height)
39 inline ::Vector4 ToVector4() {
40 return {x, y, width, height};
43 operator ::Vector4()
const {
44 return {x, y, width, height};
51 ::DrawRectangle(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
52 static_cast<int>(height), color);
57 ::DrawRectanglePro(*
this, origin, rotation, color);
61 inline Rectangle& DrawGradientV(::Color color1, ::Color color2) {
62 ::DrawRectangleGradientV(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
63 static_cast<int>(height), color1, color2);
67 inline Rectangle& DrawGradientH(::Color color1, ::Color color2) {
68 ::DrawRectangleGradientH(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
69 static_cast<int>(height), color1, color2);
73 inline Rectangle& DrawGradient(::Color col1, ::Color col2, ::Color col3, ::Color col4) {
74 ::DrawRectangleGradientEx(*
this, col1, col2, col3, col4);
78 inline Rectangle& DrawLines(::Color color) {
79 ::DrawRectangleLines(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
80 static_cast<int>(height), color);
84 inline Rectangle& DrawLines(::Color color,
float lineThick) {
85 ::DrawRectangleLinesEx(*
this, lineThick, color);
89 inline Rectangle& DrawRounded(
float roundness,
int segments, ::Color color) {
90 ::DrawRectangleRounded(*
this, roundness, segments, color);
94 inline Rectangle& DrawRoundedLines(
float roundness,
int segments,
95 float lineThick, ::Color color) {
96 ::DrawRectangleRoundedLines(*
this, roundness, segments, lineThick, color);
104 return ::CheckCollisionRecs(*
this, rec2);
111 return ::GetCollisionRec(*
this, rec2);
118 return ::CheckCollisionPointRec(point, *
this);
125 return ::CheckCollisionCircleRec(center, radius, *
this);
128 inline ::Vector2 GetSize() {
129 return {width, height};
132 inline Rectangle& SetSize(
float newWidth,
float newHeight) {
138 inline Rectangle& SetSize(const ::Vector2& size) {
139 return SetSize(size.x, size.y);
142 inline Rectangle& SetShapesTexture(const ::Texture2D& texture) {
143 ::SetShapesTexture(texture, *
this);
147 inline ::Vector2 GetPosition() {
151 inline Rectangle& SetPosition(
float newX,
float newY) {
157 inline Rectangle& SetPosition(const ::Vector2& position) {
158 return SetPosition(position.x, position.y);
162 inline void set(const ::Rectangle& rect) {
166 height = rect.height;
171 #endif // RAYLIB_CPP_INCLUDE_RECTANGLE_HPP_