Shkyera Engine
Easy to use, game engine for Python
|
A base component for handling shapes within a game or application. More...
#include <ShapeComponent.hpp>
Public Member Functions | |
void | setRenderer (std::shared_ptr< Renderer > renderer) |
Set the renderer for this shape component. More... | |
virtual void | drawShape ()=0 |
Draw the shape. More... | |
Component (std::shared_ptr< GameObject > object) | |
Constructor for ShapeComponent. More... | |
Public Member Functions inherited from shkyera::Component | |
Component (std::shared_ptr< GameObject > object) | |
Constructor to initialize a component with a shared pointer to a game object. More... | |
std::shared_ptr< GameObject > | getObject () |
Get the shared pointer to the game object to which this component is attached. More... | |
Static Public Member Functions | |
static void | addShape (std::shared_ptr< ShapeComponent > shape) |
Add a shape component to the list of managed shapes. More... | |
static void | removeShape (std::shared_ptr< ShapeComponent > shape) |
Remove a shape component from the list of managed shapes. More... | |
static std::vector< std::shared_ptr< ShapeComponent > > | getShapes () |
Get the list of managed shape components. More... | |
Protected Attributes | |
std::shared_ptr< Renderer > | _renderer |
Protected Attributes inherited from shkyera::Component | |
std::shared_ptr< GameObject > | _object |
The game object to which this component is attached. More... | |
Static Private Attributes | |
static std::vector< std::shared_ptr< ShapeComponent > > | _shapes = {} |
A base component for handling shapes within a game or application.
The ShapeComponent class is an abstract base class that defines methods for handling shapes and managing rendering. Specific shape components should derive from this class to implement their own drawing logic.
|
static |
Add a shape component to the list of managed shapes.
shape | A shared pointer to the ShapeComponent to be added. |
shkyera::Component::Component |
Constructor for ShapeComponent.
parent | The parent Component, if any. |
|
pure virtual |
Draw the shape.
This pure virtual method should be implemented by subclasses to define the drawing behavior for their specific shape type.
Implemented in shkyera::ShapeRectangleComponent, shkyera::ShapeLineComponent, and shkyera::ShapeCircleComponent.
|
static |
Get the list of managed shape components.
|
static |
Remove a shape component from the list of managed shapes.
shape | A shared pointer to the ShapeComponent to be removed. |
void shkyera::ShapeComponent::setRenderer | ( | std::shared_ptr< Renderer > | renderer | ) |
Set the renderer for this shape component.
renderer | A shared pointer to the Renderer used for rendering. |
|
protected |
|
staticprivate |