raylib-cpp
C++ object-oriented wrapper library for raylib.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
raylib::Rectangle Class Reference

Rectangle type. More...

#include <Rectangle.hpp>

Public Member Functions

constexpr Rectangle (::Vector2 position, ::Vector2 size)
 
constexpr Rectangle (::Vector2 size)
 
constexpr Rectangle (::Vector4 rect)
 
constexpr Rectangle (const ::Rectangle &rect)
 
constexpr Rectangle (float x)
 
constexpr Rectangle (float x, float y)
 
constexpr Rectangle (float x, float y, float width)
 
constexpr Rectangle (float x, float y, float width, float height)
 
bool CheckCollision (::Rectangle rec2) const
 Check collision between two rectangles.
 
bool CheckCollision (::Vector2 center, float radius) const
 Check collision between circle and rectangle.
 
bool CheckCollision (::Vector2 point) const
 Check if point is inside rectangle.
 
void Draw (::Color color) const
 
void Draw (::Vector2 origin, float rotation, ::Color color) const
 
void DrawGradient (::Color topLeft, ::Color bottomLeft, ::Color bottomRight, ::Color topRight) const
 
void DrawGradientH (::Color color1, ::Color color2) const
 
void DrawGradientV (::Color color1, ::Color color2) const
 
void DrawLines (::Color color) const
 
void DrawLines (::Color color, float lineThick) const
 
void DrawRounded (float roundness, int segments, ::Color color) const
 
void DrawRoundedLines (float roundness, int segments, ::Color color) const
 
void DrawRoundedLines (float roundness, int segments, float lineThick, ::Color color) const
 
::Rectangle GetCollision (::Rectangle rec2) const
 Get collision rectangle for two rectangles collision.
 
float GetHeight () const
 Retrieves the height value for the object.
 
Vector2 GetPosition () const
 
Vector2 GetSize () const
 
float GetWidth () const
 Retrieves the width value for the object.
 
float GetX () const
 Retrieves the x value for the object.
 
float GetY () const
 Retrieves the y value for the object.
 
constexpr operator::Vector4 () const
 
Rectangleoperator= (const ::Rectangle &rect)
 
void SetHeight (float value)
 Sets the height value for the object.
 
RectangleSetPosition (const ::Vector2 &position)
 
RectangleSetPosition (float newX, float newY)
 
RectangleSetShapesTexture (const ::Texture2D &texture)
 
RectangleSetSize (const ::Vector2 &size)
 
RectangleSetSize (float newWidth, float newHeight)
 
void SetWidth (float value)
 Sets the width value for the object.
 
void SetX (float value)
 Sets the x value for the object.
 
void SetY (float value)
 Sets the y value for the object.
 
constexpr ::Vector4 ToVector4 () const
 

Static Public Member Functions

static void Draw (::Vector2 position, ::Vector2 size, ::Color color)
 
static void Draw (int posX, int posY, int width, int height, ::Color color)
 Draw a color-filled rectangle.
 

Protected Member Functions

void set (const ::Rectangle &rect)
 

Detailed Description

Rectangle type.

Definition at line 12 of file Rectangle.hpp.

Constructor & Destructor Documentation

◆ Rectangle() [1/9]

constexpr raylib::Rectangle::Rectangle ( const ::Rectangle &  rect)
inlineconstexpr

Definition at line 14 of file Rectangle.hpp.

◆ Rectangle() [2/9]

constexpr raylib::Rectangle::Rectangle ( float  x,
float  y,
float  width,
float  height 
)
inlineconstexpr

Definition at line 16 of file Rectangle.hpp.

◆ Rectangle() [3/9]

constexpr raylib::Rectangle::Rectangle ( float  x,
float  y,
float  width 
)
inlineconstexpr

Definition at line 17 of file Rectangle.hpp.

◆ Rectangle() [4/9]

constexpr raylib::Rectangle::Rectangle ( float  x,
float  y 
)
inlineconstexpr

Definition at line 18 of file Rectangle.hpp.

◆ Rectangle() [5/9]

constexpr raylib::Rectangle::Rectangle ( float  x)
inlineconstexpr

Definition at line 19 of file Rectangle.hpp.

◆ Rectangle() [6/9]

constexpr raylib::Rectangle::Rectangle ( )
inlineconstexpr

Definition at line 20 of file Rectangle.hpp.

◆ Rectangle() [7/9]

constexpr raylib::Rectangle::Rectangle ( ::Vector2  position,
::Vector2  size 
)
inlineconstexpr

Definition at line 22 of file Rectangle.hpp.

◆ Rectangle() [8/9]

constexpr raylib::Rectangle::Rectangle ( ::Vector2  size)
inlineconstexpr

Definition at line 23 of file Rectangle.hpp.

◆ Rectangle() [9/9]

constexpr raylib::Rectangle::Rectangle ( ::Vector4  rect)
inlineconstexpr

Definition at line 24 of file Rectangle.hpp.

Member Function Documentation

◆ CheckCollision() [1/3]

bool raylib::Rectangle::CheckCollision ( ::Rectangle  rec2) const
inline

Check collision between two rectangles.

Definition at line 107 of file Rectangle.hpp.

◆ CheckCollision() [2/3]

bool raylib::Rectangle::CheckCollision ( ::Vector2  center,
float  radius 
) const
inline

Check collision between circle and rectangle.

Definition at line 122 of file Rectangle.hpp.

◆ CheckCollision() [3/3]

bool raylib::Rectangle::CheckCollision ( ::Vector2  point) const
inline

Check if point is inside rectangle.

Definition at line 117 of file Rectangle.hpp.

◆ Draw() [1/4]

void raylib::Rectangle::Draw ( ::Color  color) const
inline

Definition at line 51 of file Rectangle.hpp.

◆ Draw() [2/4]

void raylib::Rectangle::Draw ( ::Vector2  origin,
float  rotation,
::Color  color 
) const
inline

Definition at line 53 of file Rectangle.hpp.

◆ Draw() [3/4]

static void raylib::Rectangle::Draw ( ::Vector2  position,
::Vector2  size,
::Color  color 
)
inlinestatic

Definition at line 47 of file Rectangle.hpp.

◆ Draw() [4/4]

static void raylib::Rectangle::Draw ( int  posX,
int  posY,
int  width,
int  height,
::Color  color 
)
inlinestatic

Draw a color-filled rectangle.

Definition at line 43 of file Rectangle.hpp.

◆ DrawGradient()

void raylib::Rectangle::DrawGradient ( ::Color  topLeft,
::Color  bottomLeft,
::Color  bottomRight,
::Color  topRight 
) const
inline

Definition at line 77 of file Rectangle.hpp.

◆ DrawGradientH()

void raylib::Rectangle::DrawGradientH ( ::Color  color1,
::Color  color2 
) const
inline

Definition at line 67 of file Rectangle.hpp.

◆ DrawGradientV()

void raylib::Rectangle::DrawGradientV ( ::Color  color1,
::Color  color2 
) const
inline

Definition at line 57 of file Rectangle.hpp.

◆ DrawLines() [1/2]

void raylib::Rectangle::DrawLines ( ::Color  color) const
inline

Definition at line 81 of file Rectangle.hpp.

◆ DrawLines() [2/2]

void raylib::Rectangle::DrawLines ( ::Color  color,
float  lineThick 
) const
inline

Definition at line 90 of file Rectangle.hpp.

◆ DrawRounded()

void raylib::Rectangle::DrawRounded ( float  roundness,
int  segments,
::Color  color 
) const
inline

Definition at line 92 of file Rectangle.hpp.

◆ DrawRoundedLines() [1/2]

void raylib::Rectangle::DrawRoundedLines ( float  roundness,
int  segments,
::Color  color 
) const
inline

Definition at line 96 of file Rectangle.hpp.

◆ DrawRoundedLines() [2/2]

void raylib::Rectangle::DrawRoundedLines ( float  roundness,
int  segments,
float  lineThick,
::Color  color 
) const
inline

Definition at line 100 of file Rectangle.hpp.

◆ GetCollision()

::Rectangle raylib::Rectangle::GetCollision ( ::Rectangle  rec2) const
inline

Get collision rectangle for two rectangles collision.

Definition at line 112 of file Rectangle.hpp.

◆ GetHeight()

float raylib::Rectangle::GetHeight ( ) const
inline

Retrieves the height value for the object.

Returns
The height value of the object.

Definition at line 29 of file Rectangle.hpp.

◆ GetPosition()

Vector2 raylib::Rectangle::GetPosition ( ) const
inline

Definition at line 141 of file Rectangle.hpp.

◆ GetSize()

Vector2 raylib::Rectangle::GetSize ( ) const
inline

Definition at line 126 of file Rectangle.hpp.

◆ GetWidth()

float raylib::Rectangle::GetWidth ( ) const
inline

Retrieves the width value for the object.

Returns
The width value of the object.

Definition at line 28 of file Rectangle.hpp.

◆ GetX()

float raylib::Rectangle::GetX ( ) const
inline

Retrieves the x value for the object.

Returns
The x value of the object.

Definition at line 26 of file Rectangle.hpp.

◆ GetY()

float raylib::Rectangle::GetY ( ) const
inline

Retrieves the y value for the object.

Returns
The y value of the object.

Definition at line 27 of file Rectangle.hpp.

◆ operator::Vector4()

constexpr raylib::Rectangle::operator::Vector4 ( ) const
inlineexplicitconstexpr

Definition at line 38 of file Rectangle.hpp.

◆ operator=()

Rectangle & raylib::Rectangle::operator= ( const ::Rectangle &  rect)
inline

Definition at line 31 of file Rectangle.hpp.

◆ set()

void raylib::Rectangle::set ( const ::Rectangle &  rect)
inlineprotected

Definition at line 151 of file Rectangle.hpp.

◆ SetHeight()

void raylib::Rectangle::SetHeight ( float  value)
inline

Sets the height value for the object.

Parameters
valueThe value of which to set height to.

Definition at line 29 of file Rectangle.hpp.

◆ SetPosition() [1/2]

Rectangle & raylib::Rectangle::SetPosition ( const ::Vector2 &  position)
inline

Definition at line 149 of file Rectangle.hpp.

◆ SetPosition() [2/2]

Rectangle & raylib::Rectangle::SetPosition ( float  newX,
float  newY 
)
inline

Definition at line 143 of file Rectangle.hpp.

◆ SetShapesTexture()

Rectangle & raylib::Rectangle::SetShapesTexture ( const ::Texture2D &  texture)
inline

Definition at line 136 of file Rectangle.hpp.

◆ SetSize() [1/2]

Rectangle & raylib::Rectangle::SetSize ( const ::Vector2 &  size)
inline

Definition at line 134 of file Rectangle.hpp.

◆ SetSize() [2/2]

Rectangle & raylib::Rectangle::SetSize ( float  newWidth,
float  newHeight 
)
inline

Definition at line 128 of file Rectangle.hpp.

◆ SetWidth()

void raylib::Rectangle::SetWidth ( float  value)
inline

Sets the width value for the object.

Parameters
valueThe value of which to set width to.

Definition at line 28 of file Rectangle.hpp.

◆ SetX()

void raylib::Rectangle::SetX ( float  value)
inline

Sets the x value for the object.

Parameters
valueThe value of which to set x to.

Definition at line 26 of file Rectangle.hpp.

◆ SetY()

void raylib::Rectangle::SetY ( float  value)
inline

Sets the y value for the object.

Parameters
valueThe value of which to set y to.

Definition at line 27 of file Rectangle.hpp.

◆ ToVector4()

constexpr ::Vector4 raylib::Rectangle::ToVector4 ( ) const
inline

Definition at line 36 of file Rectangle.hpp.