|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
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 | |
| FLINT_API | RectangleShape (Vec2f size, Color fill={255, 255, 255, 255}) |
| Construct a rectangle with the given dimensions and fill color. | |
| FLINT_API 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. | |
| FLINT_API 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. | |
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 21 of file rectangle-shape.h.
Construct a rectangle with the given dimensions and fill color.
| size | World-space width (x) and height (y). |
| fill | Initial fill color (default: opaque white). |
|
overridevirtual |
Emit this drawable's rendering work for the current frame.
Called once after submitted drawables have been sorted by DrawLayer. Implementations must enqueue work through queue rather than issuing immediate GPU commands.
| queue | Queue receiving this drawable's rendering work. |
Implements Flint::Drawable.
|
inlinenodiscardoverridevirtual |
Get the axis-aligned bounding box of the rectangle in world space.
Reimplemented from Flint::Shape.
Definition at line 91 of file rectangle-shape.h.
|
inlinenodiscard |
Get the current local origin pivot point.
Definition at line 73 of file rectangle-shape.h.
|
inlinenodiscard |
Get the current rotation angle in radians.
Definition at line 83 of file rectangle-shape.h.
|
inlinenodiscard |
Get the current scale factors.
Definition at line 78 of file rectangle-shape.h.
|
inlinenodiscard |
Get the current dimensions in world-space units.
Definition at line 68 of file rectangle-shape.h.
|
inline |
Set the local pivot point used for rotation and positioning.
| newOrigin | Pivot offset in local object space. |
Definition at line 45 of file rectangle-shape.h.
|
inline |
Set the rotation angle.
| newRotation | Angle in radians (clockwise). |
Definition at line 63 of file rectangle-shape.h.
|
inline |
Apply a per-axis scale factor.
| newScale | Scale factors (1.0, 1.0 = original size). |
Definition at line 54 of file rectangle-shape.h.
| FLINT_API void Flint::RectangleShape::setSize | ( | Vec2f | newSize | ) |
Set the rectangle dimensions.
| newSize | New width and height in world-space units. |