Potato Engine
Loading...
Searching...
No Matches
Tickable.cpp
Go to the documentation of this file.
1
2
5
6#include "Tickable.hpp"
7
8bool Tickable::isTicking() const {
9 return bTicking;
10}
11
12void Tickable::SetTicking(bool isEnabled) {
14
15 bTicking = isEnabled;
16
18
19 if (isEnabled) {
20 tickController->RegisterTick(EventDelegate<float>(this, &Tickable::Tick));
21 } else {
22 tickController->UnregisterTick(this);
23 }
24}
25
26void Tickable::Tick(float dt) {}
27Tickable::~Tickable() {}
Interface to handle tick events.
virtual bool RegisterTick(EventDelegate< float > delegate)=0
Registers a delegate to recieve tick updates.
virtual void UnregisterTick(void *object)=0
Unregisters an object from receiving tick events.
ITickController * GetTickController() const
Gets tick controller.
static PotatoEngine & Get()
Global access to engine object.
void SetTicking(bool isEnabled)
Sets tick state for object.
Definition Tickable.cpp:12
virtual void Tick(float dt)
Update tick event.
Definition Tickable.cpp:26
bool isTicking() const
Checks if object is ticking.
Definition Tickable.cpp:8
A wrapper that carries response delegate information.