Shkyera Engine
Easy to use, game engine for Python
shkyera::ShapeComponent Class Referenceabstract

A base component for handling shapes within a game or application. More...

#include <ShapeComponent.hpp>

Inheritance diagram for shkyera::ShapeComponent:
[legend]

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< GameObjectgetObject ()
 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 = {}
 

Detailed Description

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.

Member Function Documentation

◆ addShape()

void shkyera::ShapeComponent::addShape ( std::shared_ptr< ShapeComponent shape)
static

Add a shape component to the list of managed shapes.

Parameters
shapeA shared pointer to the ShapeComponent to be added.

◆ Component()

shkyera::Component::Component

Constructor for ShapeComponent.

Parameters
parentThe parent Component, if any.

◆ drawShape()

virtual void shkyera::ShapeComponent::drawShape ( )
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.

◆ getShapes()

std::vector< std::shared_ptr< ShapeComponent > > shkyera::ShapeComponent::getShapes ( )
static

Get the list of managed shape components.

Returns
A vector of shared pointers to ShapeComponent representing the managed shapes.

◆ removeShape()

void shkyera::ShapeComponent::removeShape ( std::shared_ptr< ShapeComponent shape)
static

Remove a shape component from the list of managed shapes.

Parameters
shapeA shared pointer to the ShapeComponent to be removed.

◆ setRenderer()

void shkyera::ShapeComponent::setRenderer ( std::shared_ptr< Renderer renderer)

Set the renderer for this shape component.

Parameters
rendererA shared pointer to the Renderer used for rendering.

Member Data Documentation

◆ _renderer

std::shared_ptr<Renderer> shkyera::ShapeComponent::_renderer
protected

◆ _shapes

std::vector< std::shared_ptr< ShapeComponent > > shkyera::ShapeComponent::_shapes = {}
staticprivate

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