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

A 2D circle rendered as a textured quad with a circle SDF shader. More...

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

+ Inheritance diagram for Flint::CircleShape:
+ Collaboration diagram for Flint::CircleShape:

Public Member Functions

FLINT_API CircleShape (float radius, Color fill={255, 255, 255, 255})
 Construct a circle with the given radius and fill color.
 
FLINT_API void setRadius (float radius)
 Set the circle radius.
 
void setOrigin (Vec2f newOrigin)
 Set the local pivot point used as the rotation and positioning origin.
 
void move (Vec2f delta)
 Translate the circle by delta.
 
void setAngle (float newAngle)
 Set the rotation angle.
 
float getRadius () const
 Get the current radius in world-space units.
 
const Vec2f & getOrigin () const
 Get the local origin pivot point.
 
float getAngle () const
 Return the current rotation angle in radians.
 
FloatRect getGlobalBounds () const override
 Get the axis-aligned bounding box of the circle 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.
 

Detailed Description

A 2D circle rendered as a textured quad with a circle SDF shader.

Inherits fill, outline, and position properties from Shape. Radius, rotation, and a local origin pivot are added on top.

Definition at line 17 of file circle-shape.h.

Constructor & Destructor Documentation

◆ CircleShape()

FLINT_API Flint::CircleShape::CircleShape ( float radius,
Color fill = {255, 255, 255, 255} )

Construct a circle with the given radius and fill color.

Parameters
radiusCircle radius in world-space units.
fillInitial fill color (default: opaque white).

Member Function Documentation

◆ emit()

FLINT_API void Flint::CircleShape::emit ( RenderQueue & queue) const
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.

Parameters
queueQueue receiving this drawable's rendering work.

Implements Flint::Drawable.

◆ getAngle()

float Flint::CircleShape::getAngle ( ) const
inlinenodiscard

Return the current rotation angle in radians.

Definition at line 74 of file circle-shape.h.

◆ getGlobalBounds()

FloatRect Flint::CircleShape::getGlobalBounds ( ) const
inlinenodiscardoverridevirtual

Get the axis-aligned bounding box of the circle in world space.

Returns
FloatRect Bounds including radius and outline thickness.

Reimplemented from Flint::Shape.

Definition at line 82 of file circle-shape.h.

◆ getOrigin()

const Vec2f & Flint::CircleShape::getOrigin ( ) const
inlinenodiscard

Get the local origin pivot point.

Definition at line 69 of file circle-shape.h.

◆ getRadius()

float Flint::CircleShape::getRadius ( ) const
inlinenodiscard

Get the current radius in world-space units.

Definition at line 64 of file circle-shape.h.

◆ move()

void Flint::CircleShape::move ( Vec2f delta)
inline

Translate the circle by delta.

Parameters
deltaWorld-space offset to add to the current position.

Definition at line 49 of file circle-shape.h.

◆ setAngle()

void Flint::CircleShape::setAngle ( float newAngle)
inline

Set the rotation angle.

Parameters
newAngleAngle in radians.

Definition at line 59 of file circle-shape.h.

◆ setOrigin()

void Flint::CircleShape::setOrigin ( Vec2f newOrigin)
inline

Set the local pivot point used as the rotation and positioning origin.

Parameters
newOriginPivot offset in the local object space.

Definition at line 40 of file circle-shape.h.

◆ setRadius()

FLINT_API void Flint::CircleShape::setRadius ( float radius)

Set the circle radius.

Parameters
radiusNew radius in world-space units.

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