1#ifndef RAYLIB_CPP_INCLUDE_RECTANGLE_HPP_
2#define RAYLIB_CPP_INCLUDE_RECTANGLE_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)
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);
56 inline Rectangle&
Draw(::Vector2 origin,
float rotation, ::Color color) {
57 ::DrawRectanglePro(*
this, origin, rotation, color);
62 ::DrawRectangleGradientV(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
63 static_cast<int>(height), color1, color2);
68 ::DrawRectangleGradientH(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
69 static_cast<int>(height), color1, color2);
74 ::DrawRectangleGradientEx(*
this, col1, col2, col3, col4);
79 ::DrawRectangleLines(
static_cast<int>(x),
static_cast<int>(y),
static_cast<int>(width),
80 static_cast<int>(height), color);
85 ::DrawRectangleLinesEx(*
this, lineThick, color);
90 ::DrawRectangleRounded(*
this, roundness, segments, color);
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);
129 return {width, height};
139 return SetSize(size.x, size.y);
162 inline void set(const ::Rectangle& rect) {
166 height = rect.height;
Rectangle(float x, float y)
Rectangle(::Vector4 rect)
Rectangle & SetPosition(const ::Vector2 &position)
Rectangle(::Vector2 position, ::Vector2 size)
bool CheckCollision(::Rectangle rec2) const
Check collision between two rectangles.
Rectangle & SetPosition(float newX, float newY)
Rectangle & DrawGradientV(::Color color1, ::Color color2)
Rectangle(float x, float y, float width)
inline ::Rectangle GetCollision(::Rectangle rec2) const
Get collision rectangle for two rectangles collision.
Rectangle & DrawGradientH(::Color color1, ::Color color2)
inline ::Vector4 ToVector4()
Rectangle(::Vector2 size)
Rectangle & DrawGradient(::Color col1, ::Color col2, ::Color col3, ::Color col4)
Rectangle & SetSize(float newWidth, float newHeight)
Rectangle & DrawRounded(float roundness, int segments, ::Color color)
Rectangle & DrawLines(::Color color)
inline ::Vector2 GetPosition()
Rectangle & DrawRoundedLines(float roundness, int segments, float lineThick, ::Color color)
Rectangle(float x, float y, float width, float height)
Rectangle & Draw(::Vector2 origin, float rotation, ::Color color)
Rectangle & Draw(::Color color)
Draw a color-filled rectangle.
bool CheckCollision(::Vector2 center, float radius)
Check collision between circle and rectangle.
bool CheckCollision(::Vector2 point) const
Check if point is inside rectangle.
Rectangle & SetSize(const ::Vector2 &size)
Rectangle & DrawLines(::Color color, float lineThick)
inline ::Vector2 GetSize()
Rectangle(const ::Rectangle &vec)
Rectangle & SetShapesTexture(const ::Texture2D &texture)
All raylib-cpp classes and functions appear in the raylib namespace.