SDL Utility
sdlu::Rectangle Class Reference

#include <Rectangle.hpp>

Inheritance diagram for sdlu::Rectangle:
Shape Drawable Transformable

Public Member Functions

 Rectangle ()
 Default constructor. More...
 
 Rectangle (const Vector2f &position, const Vector2f &size)
 Constructor with default parameters. More...
 
Vector2f GetSize ()
 Gets the size of the rectangle. More...
 
void SetSize (const Vector2f &size)
 Sets a new size for the rectangle. More...
 
void SetSize (float x, float y)
 Sets a new size for the rectangle. More...
 
virtual void Draw (SDL_Renderer *const target) const override
 Draws the Rectangle to the target. More...
 
- Public Member Functions inherited from Shape
virtual ~Shape ()
 Deconstructor. More...
 
void SetColor (const Color &color)
 Sets the color of the shape. More...
 
Color GetColor ()
 Gets the color of the shape. More...
 
- Public Member Functions inherited from Drawable
 Drawable (const Drawable &other)=delete
 
 Drawable (Drawable &&other)=delete
 
Drawableoperator= (const Drawable &other)=delete
 
- Public Member Functions inherited from Transformable
 Transformable ()
 Default constructur. More...
 
virtual ~Transformable ()
 Deconstructor. More...
 
Vector2f GetPosition ()
 Returns the position of the object. More...
 
void SetPosition (const Vector2f &position)
 Sets a new position. More...
 
void SetPosition (float x, float y)
 Sets a new position. More...
 
void Move (const Vector2f &position)
 Adds to the current position. More...
 
void Move (float x, float y)
 Adds to the current position. More...
 
Vector2f GetOrigin ()
 Gets the current local origin. More...
 
void SetOrigin (const Vector2f &origin)
 Sets a new local origin. More...
 
void SetOrigin (float x, float y)
 Sets a new local origin. More...
 
Vector2f GetScale ()
 Gets the current scale of the object. More...
 
void SetScale (const Vector2f &scale)
 Sets a new scale. More...
 
void SetScale (float x, float y)
 Sets a new scale. More...
 
void Scale (const Vector2f &scale)
 Scales the object by some amount. More...
 
void Scale (float x, float y)
 Scales the object by some amount. More...
 
float GetRotation ()
 Gets the current rotation. More...
 
void SetRotation (float angle)
 Sets a new rotation. More...
 
void Rotate (float angle)
 Rotates by some amount. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Shape
 Shape ()
 Default constructor. More...
 
- Protected Member Functions inherited from Drawable
 Drawable ()
 
- Protected Attributes inherited from Shape
Color color
 
- Protected Attributes inherited from Transformable
Vector2f position
 Position of the object. More...
 
Vector2f origin
 Offset of the top-left corner from the position. More...
 
Vector2f scale
 Scale of the object. More...
 
float rotation
 Rotation of the object (in degrees) More...
 

Constructor & Destructor Documentation

◆ Rectangle() [1/2]

sdlu::Rectangle::Rectangle ( )

Default constructor.

◆ Rectangle() [2/2]

sdlu::Rectangle::Rectangle ( const Vector2f position,
const Vector2f size 
)

Constructor with default parameters.

Parameters
[in]positionA 2D position vector
[in]sizeA 2D size vector

Member Function Documentation

◆ Draw()

virtual void sdlu::Rectangle::Draw ( SDL_Renderer *const  target) const
overridevirtual

Draws the Rectangle to the target.

Parameters
[in]targetThe RenderTarget to draw to

Implements Drawable.

◆ GetSize()

Vector2f sdlu::Rectangle::GetSize ( )

Gets the size of the rectangle.

Returns
A 2D vector with the size information

◆ SetSize() [1/2]

void sdlu::Rectangle::SetSize ( const Vector2f size)

Sets a new size for the rectangle.

Parameters
[in]sizeA 2D vector with the size information

◆ SetSize() [2/2]

void sdlu::Rectangle::SetSize ( float  x,
float  y 
)

Sets a new size for the rectangle.

Parameters
[in]xThe new size in x direction
[in]yThe new size in y direction

The documentation for this class was generated from the following file: