souleng
Game engine providing full Python scripting support
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Component Struct Reference

#include <Component.hpp>

Inheritance diagram for Component:
Collision2DComponent ScriptComponent TextureComponent Transform PyScriptComponent TextTexture

Public Member Functions

virtual void Input ()
 Called once per frame to handle any new input.
 
virtual void Update (float deltaTime)
 
virtual void Render ()
 
void SetGameObject (std::weak_ptr< GameObject > ent)
 Sets the GameObject this component is attached to.
 
std::shared_ptr< GameObjectGetGameObject ()
 Retrieves the GameObject this component is attached to, behind a shared pointer.
 
template<typename T >
std::shared_ptr< T > GetComponent ()
 Alias for GetGameObject()->GetComponent<T>(), for easier scripting.
 

Static Public Member Functions

static ComponentType GetType ()
 Returns the type of this component to make querying GetComponent easier.
 

Protected Attributes

std::weak_ptr< GameObjectmGameObject
 

Detailed Description

Logical building block of the game engine. Components are attached to GameObjects and control everything from rendering, to physics, to input response, to general game logic.

Member Function Documentation

◆ Input()

virtual void Component::Input ( )
inlinevirtual

Called once per frame to handle any new input.

Reimplemented in ScriptComponent, Collision2DComponent, PyScriptComponent, TextureComponent, and Transform.

◆ Render()

virtual void Component::Render ( )
inlinevirtual

Called once per frame to render any necessary parts of this component to the screen

Reimplemented in ScriptComponent, TextTexture, Collision2DComponent, PyScriptComponent, TextureComponent, and Transform.

◆ Update()

virtual void Component::Update ( float deltaTime)
inlinevirtual

Called once per frame for any timing specific logic

Parameters
deltaTimeThe tick rate of the game, in seconds. Useful for things like velocity calculations

Reimplemented in ScriptComponent, Collision2DComponent, PyScriptComponent, TextureComponent, and Transform.


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