Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::RectangleShape Class Reference

A 2D axis-aligned rectangle rendered as a textured quad. More...

#include <flint/graphics/rectangle-shape.h>

+ Inheritance diagram for Flint::RectangleShape:
+ Collaboration diagram for Flint::RectangleShape:

Public Member Functions

 RectangleShape (Vec2f size, Color fill={255, 255, 255, 255})
 Construct a rectangle with the given dimensions and fill color.
 
void setSize (Vec2f newSize)
 Set the rectangle dimensions.
 
void setOrigin (Vec2f newOrigin)
 Set the local pivot point used for rotation and positioning.
 
void setScale (Vec2f newScale)
 Apply a per-axis scale factor.
 
void setRotation (float newRotation)
 Set the rotation angle.
 
Vec2f getSize () const
 Get the current dimensions in world-space units.
 
const Vec2f & getOrigin () const
 Get the current local origin pivot point.
 
const Vec2f & getScale () const
 Get the current scale factors.
 
float getRotation () const
 Get the current rotation angle in radians.
 
FloatRect getGlobalBounds () const override
 Get the axis-aligned bounding box of the rectangle in world space.
 
void emit (RenderQueue &queue) const override
 Emit this drawable's rendering work for the current frame.
 
- Public Member Functions inherited from Flint::Shape
virtual void setPosition (Vec2f newPosition)
 Set the world-space position of the shape.
 
virtual void setFillColor (Color color)
 Set the fill (interior) color.
 
virtual void setOutlineColor (Color color)
 Set the outline (stroke) color.
 
virtual void setOutlineThickness (float thickness)
 Set the outline stroke thickness in pixels.
 
virtual Vec2f getPosition () const
 Return the current world-space position.
 
virtual Color getFillColor () const
 Return the current fill color.
 
virtual Color getOutlineColor () const
 Return the current outline color.
 
virtual float getOutlineThickness () const
 Return the current outline thickness in pixels.
 
- Public Member Functions inherited from Flint::Drawable
void setGPUTexture (GPUTexture *texture)
 Associate a texture with this drawable.
 
GPUTexture * getGPUTexture () const
 Get the associated GPU texture.
 

Additional Inherited Members

- Protected Attributes inherited from Flint::Shape
Vec2f m_position {0, 0}
 
Color m_fillColor {255, 255, 255, 255}
 
Color m_outlineColor {0, 0, 0, 0}
 
float m_outlineThickness {0.f}
 
- Protected Attributes inherited from Flint::Drawable
GPUTexture * m_gpuTexture = nullptr
 Non-owning reference to the GPU texture asset.
 

Detailed Description

A 2D axis-aligned rectangle rendered as a textured quad.

Inherits position, fill/outline color, and outline thickness from Shape. Supports independent scaling, rotation, and origin pivot offset.

Definition at line 20 of file rectangle-shape.h.


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