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

A base class representing a user interface (UI) for a game object's component. More...

#include <UIComponent.hpp>

Inheritance diagram for shkyera::UIComponent:
[legend]

Public Member Functions

 UIComponent (std::string name, std::shared_ptr< GameObject > object)
 Constructor to create a UI component with a specified name and associated game object. More...
 
virtual void draw ()=0
 Abstract method to draw the UI component. More...
 

Static Public Member Functions

static void addComponentToObject (std::shared_ptr< GameObject > object, std::shared_ptr< UIComponent > component)
 Static method to add a UI component to a game object. More...
 
static std::vector< std::shared_ptr< UIComponent > > getComponentsOfObject (std::shared_ptr< GameObject > object)
 Static method to retrieve a list of UI components associated with a game object. More...
 

Protected Attributes

uint64_t _uuid
 A unique identifier for the UI component. More...
 
std::string _name
 The name of the UI component. More...
 
std::shared_ptr< GameObject_object
 The game object associated with the UI component. More...
 

Static Private Attributes

static std::unordered_map< std::shared_ptr< GameObject >, std::vector< std::shared_ptr< UIComponent > > > _objectComponents = {}
 

Detailed Description

A base class representing a user interface (UI) for a game object's component.

The UIComponent class defines the common interface for UI object components and provides functionality for managing and rendering them within the app.

Constructor & Destructor Documentation

◆ UIComponent()

shkyera::UIComponent::UIComponent ( std::string  name,
std::shared_ptr< GameObject object 
)

Constructor to create a UI component with a specified name and associated game object.

Parameters
nameThe name of the UI component.
objectA shared pointer to the game object associated with the UI component.

Member Function Documentation

◆ addComponentToObject()

void shkyera::UIComponent::addComponentToObject ( std::shared_ptr< GameObject object,
std::shared_ptr< UIComponent component 
)
static

Static method to add a UI component to a game object.

Parameters
objectA shared pointer to the game object.
componentA shared pointer to the UI component to add.

◆ draw()

virtual void shkyera::UIComponent::draw ( )
pure virtual

Abstract method to draw the UI component.

This method must be implemented by derived classes to render the UI component on the screen.

Implemented in shkyera::TransformUIComponent, shkyera::ShapeUIComponent, and shkyera::ScriptUIComponent.

◆ getComponentsOfObject()

std::vector< std::shared_ptr< UIComponent > > shkyera::UIComponent::getComponentsOfObject ( std::shared_ptr< GameObject object)
static

Static method to retrieve a list of UI components associated with a game object.

Parameters
objectA shared pointer to the game object.
Returns
A vector of shared pointers to UI components associated with the game object.

Member Data Documentation

◆ _name

std::string shkyera::UIComponent::_name
protected

The name of the UI component.

◆ _object

std::shared_ptr<GameObject> shkyera::UIComponent::_object
protected

The game object associated with the UI component.

◆ _objectComponents

std::unordered_map< std::shared_ptr< GameObject >, std::vector< std::shared_ptr< UIComponent > > > shkyera::UIComponent::_objectComponents = {}
staticprivate

◆ _uuid

uint64_t shkyera::UIComponent::_uuid
protected

A unique identifier for the UI component.


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