Platformer
Platformer
Public Member Functions | Private Attributes | List of all members
LambdaComponent Class Reference

A class for adding a function to the given component's update loop. More...

#include <LambdaComponent.hpp>

Inheritance diagram for LambdaComponent:
Inheritance graph
Collaboration diagram for LambdaComponent:
Collaboration graph

Public Member Functions

 LambdaComponent (std::function< void(GameObject &)> fun)
 Construts a new lambda component. More...
 
virtual void Update ()
 Updates this component.
 
- Public Member Functions inherited from Component
void SetParentGameObject (std::weak_ptr< GameObject > g)
 Sets the given GameObject as this component's parent. More...
 
virtual void Init ()
 Initializes this component.
 
std::shared_ptr< GameObjectGetGameObject ()
 Gets a shared ptr reference to this component's GameObject. More...
 

Private Attributes

std::function< void(GameObject &)> fun
 The function to be called when updating.
 

Additional Inherited Members

- Protected Attributes inherited from Component
std::weak_ptr< GameObjectgameObject
 This component's parent GameObject.
 

Detailed Description

A class for adding a function to the given component's update loop.

Constructor & Destructor Documentation

◆ LambdaComponent()

LambdaComponent::LambdaComponent ( std::function< void(GameObject &)>  fun)

Construts a new lambda component.

Parameters
funThe function to be called when updating

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