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

Abstract base class for 2-D geometric shapes. More...

#include <flint/graphics/shape.h>

+ Inheritance diagram for Flint::Shape:
+ Collaboration diagram for Flint::Shape:

Public Member Functions

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.
 
virtual FloatRect getGlobalBounds () const
 Return the axis-aligned bounding rectangle in world space.
 
- Public Member Functions inherited from Flint::Drawable
virtual void emit (RenderQueue &queue) const =0
 Emit this drawable's rendering work for the current frame.
 
void setGPUTexture (GPUTexture *texture)
 Associate a texture with this drawable.
 
GPUTexture * getGPUTexture () const
 Get the associated GPU texture.
 

Protected Attributes

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

Abstract base class for 2-D geometric shapes.

Extends Drawable with position, fill color, outline color, and outline thickness. Concrete shapes (CircleShape, RectangleShape, etc.) implement the draw() overloads and override getGlobalBounds() to return their axis-aligned bounding rectangle in world space.

Definition at line 20 of file shape.h.


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