#include <taskmanager.h>
Public Member Functions | |
TaskManager (Game &game) | |
void | startTask (const TaskPtr &task) |
void | stopTask (const TaskPtr &task) |
TaskPtr | getTask (Task *task) |
void | update () |
Game & | getGame () |
Handles task management.
Tasks are a way run game logic asynchronously.
void MutationOfJB::TaskManager::startTask | ( | const TaskPtr & | task | ) |
Adds the task to the internal list and starts it.
When the task is finished, it is automatically removed from the list. stopTask does not need to be called for that.
void MutationOfJB::TaskManager::stopTask | ( | const TaskPtr & | task | ) |
Stops the task and removes it from the internal list.
Call this only if you need to explicitly stop the task (usually before it's finished).
Gets task shared pointer from raw pointer.
Since task lifetime is under control of SharedPtr, raw pointers shouldn't be used. However, if only a raw pointer is available (e.g. this), the method can be used to obtain a SharedPtr.