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} {}
28 GETTERSETTER(
float, X, x)
29 GETTERSETTER(
float, Y, y)
30 GETTERSETTER(
float, Width, width)
31 GETTERSETTER(
float, Height, height)
38 inline ::Vector4 ToVector4() {
39 return {x, y, width, height};
42 operator ::Vector4()
const {
43 return {x, y, width, height};
50 ::DrawRectangle(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
51 static_cast<int>(height), color);
56 ::DrawRectanglePro(*
this, origin, rotation, color);
60 inline Rectangle& DrawGradientV(::Color color1, ::Color color2) {
61 ::DrawRectangleGradientV(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
62 static_cast<int>(height), color1, color2);
66 inline Rectangle& DrawGradientH(::Color color1, ::Color color2) {
67 ::DrawRectangleGradientH(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
68 static_cast<int>(height), color1, color2);
72 inline Rectangle& DrawGradient(::Color col1, ::Color col2, ::Color col3, ::Color col4) {
73 ::DrawRectangleGradientEx(*
this, col1, col2, col3, col4);
77 inline Rectangle& DrawLines(::Color color) {
78 ::DrawRectangleLines(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
79 static_cast<int>(height), color);
83 inline Rectangle& DrawLines(::Color color,
int lineThick) {
84 ::DrawRectangleLinesEx(*
this, lineThick, color);
88 inline Rectangle& DrawRounded(
float roundness,
int segments, ::Color color) {
89 ::DrawRectangleRounded(*
this, roundness, segments, color);
93 inline Rectangle& DrawRoundedLines(
float roundness,
int segments,
int lineThick,
95 ::DrawRectangleRoundedLines(*
this, roundness, segments, lineThick, color);
103 return ::CheckCollisionRecs(*
this, rec2);
110 return ::GetCollisionRec(*
this, rec2);
117 return ::CheckCollisionPointRec(point, *
this);
124 return ::CheckCollisionCircleRec(center, radius, *
this);
127 inline ::Vector2 GetSize() {
128 return {width, height};
131 inline Rectangle& SetSize(
float newWidth,
float newHeight) {
137 inline Rectangle& SetSize(const ::Vector2& size) {
138 return SetSize(size.x, size.y);
141 inline ::Vector2 GetPosition() {
145 inline Rectangle& SetPosition(
float newX,
float newY) {
151 inline Rectangle& SetPosition(const ::Vector2& position) {
152 return SetPosition(position.x, position.y);
156 inline void set(const ::Rectangle& rect) {
160 height = rect.height;
165 #endif // RAYLIB_CPP_INCLUDE_RECTANGLE_HPP_