Abstract base class for 2-D geometric shapes.
More...
#include <flint/graphics/shape.h>
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.
◆ getFillColor()
| virtual Color Flint::Shape::getFillColor |
( |
| ) |
const |
|
inlinevirtual |
Return the current fill color.
Definition at line 66 of file shape.h.
◆ getGlobalBounds()
| virtual FloatRect Flint::Shape::getGlobalBounds |
( |
| ) |
const |
|
inlinevirtual |
Return the axis-aligned bounding rectangle in world space.
The base implementation returns a rect sized to the associated Texture (if any) at the current position. Subclasses should override this with geometry-specific bounds.
- Returns
- World-space AABB as a FloatRect.
Reimplemented in Flint::CircleShape, and Flint::RectangleShape.
Definition at line 89 of file shape.h.
◆ getOutlineColor()
| virtual Color Flint::Shape::getOutlineColor |
( |
| ) |
const |
|
inlinevirtual |
Return the current outline color.
Definition at line 71 of file shape.h.
◆ getOutlineThickness()
| virtual float Flint::Shape::getOutlineThickness |
( |
| ) |
const |
|
inlinevirtual |
Return the current outline thickness in pixels.
Definition at line 76 of file shape.h.
◆ getPosition()
| virtual Vec2f Flint::Shape::getPosition |
( |
| ) |
const |
|
inlinevirtual |
Return the current world-space position.
Definition at line 61 of file shape.h.
◆ setFillColor()
| virtual void Flint::Shape::setFillColor |
( |
Color | color | ) |
|
|
inlinevirtual |
Set the fill (interior) color.
- Parameters
-
Definition at line 38 of file shape.h.
◆ setOutlineColor()
| virtual void Flint::Shape::setOutlineColor |
( |
Color | color | ) |
|
|
inlinevirtual |
Set the outline (stroke) color.
- Parameters
-
Definition at line 47 of file shape.h.
◆ setOutlineThickness()
| virtual void Flint::Shape::setOutlineThickness |
( |
float | thickness | ) |
|
|
inlinevirtual |
Set the outline stroke thickness in pixels.
- Parameters
-
| thickness | Thickness in pixels (0 = no outline). |
Definition at line 56 of file shape.h.
◆ setPosition()
| virtual void Flint::Shape::setPosition |
( |
Vec2f | newPosition | ) |
|
|
inlinevirtual |
Set the world-space position of the shape.
- Parameters
-
| newPosition | New position (top-left corner or center, depending on the shape). |
Definition at line 29 of file shape.h.
◆ m_fillColor
| Color Flint::Shape::m_fillColor {255, 255, 255, 255} |
|
protected |
◆ m_outlineColor
| Color Flint::Shape::m_outlineColor {0, 0, 0, 0} |
|
protected |
◆ m_outlineThickness
| float Flint::Shape::m_outlineThickness {0.f} |
|
protected |
◆ m_position
| Vec2f Flint::Shape::m_position {0, 0} |
|
protected |
The documentation for this class was generated from the following file: