#include <dustytasktree.h>
Public Member Functions | |
| TaskTree (irr::IrrlichtDevice *device, DustyEngine::DustyDriver *driver) | |
| Constructor does nothing but initialize the tree and create a root task. | |
| virtual | ~TaskTree () |
| Destructor will completely clear out the tree, deleting and drop()ing all tasks. | |
| void | AddTask (DustyEngine::Task *task, DustyEngine::Task *parent=NULL, irr::u32 priority=0, bool paused=false, bool executeMultiple=false, irr::u32 lifetimeExecutions=0, irr::u32 lifetimeMS=0) |
| AddTask adds a task to the tree. | |
| void | PauseTask (DustyEngine::Task *task, irr::u32 timeToStayPaused=0, irr::u32 timeToStayUnpaused=0) |
| void | UnpauseTask (DustyEngine::Task *task, irr::u32 timeToStayUnpaused=0, irr::u32 timeToStayPaused=0) |
| void | DestroyTask (DustyEngine::Task *task) |
| void | PauseChildren (DustyEngine::Task *task, irr::u32 timeToStayPaused=0, irr::u32 timeToStayUnpaused=0) |
| void | UnpauseChildren (DustyEngine::Task *task, irr::u32 timeToStayUnpaused=0, irr::u32 timeToStayPaused=0) |
| void | DestroyChildren (DustyEngine::Task *task) |
| void | ClearTree () |
| ClearTree() destroys all tasks in the tree. | |
| void | DoUpdates () |
| DoUpdates() updates all the tasks in the tree. | |
| void | PauseTree () |
| PauseTree() pauses the entire tree. | |
| void | UnpauseTree () |
| UnpauseTree() unpauses the entire tree. | |
| bool | IsPaused () |
| bool | IsRunning () |
| void | StopTree () |
| StopTree() will cause the tree to not update tasks when OnUpdate() is called. | |
| void | StartTree () |
| StartTree() will allow the tree to update tasks when OnUpdate() is called. | |
| irr::u32 | NumTasks () |
Protected Member Functions | |
| void | DeleteTasks () |
| void | UpdateChildren (DustyEngine::Task *task) |
| void | UpdateTask (DustyEngine::Task *task) |
| void | FlagTaskForDeletion (DustyEngine::Task *task) |
Protected Attributes | |
| DustyEngine::DummyTask * | root |
| irr::IrrlichtDevice * | irrlichtDevice |
| DustyEngine::DustyDriver * | dustyDriver |
| bool | isRunning |
| irr::u32 | numTasks |
| irr::core::list< DustyEngine::Task * > | tasksToDelete |
TaskTree maintains a tree of tasks. The tasks have a parent-affects-child relationship, meaning if the parent task is paused, the children of the parent will not execute. If a parent task is dropped from the tree, the children tasks will also be dropped. This is very useful in game development where one entity (or process) depends upon another for execution. Tasks in the tree are referenced by pointers to the task, but the task tree is responsible for all executions such as Pausing/Unpausing/Executing/Deleting them. The task tree guarantees seamless pausing/unpausing of tasks, as well as preorder execution of parent/children tasks.
Definition at line 52 of file dustytasktree.h.
|
||||||||||||
|
Constructor does nothing but initialize the tree and create a root task.
|
|
|
Destructor will completely clear out the tree, deleting and drop()ing all tasks.
|
|
||||||||||||||||||||||||||||||||
|
AddTask adds a task to the tree.
|
|
|
ClearTree() destroys all tasks in the tree.
|
|
|
|
|
|
DestroyChildren() destroys all the children of the task, but does not destroy the task. Also destroys childrens' children, and so on.
|
|
|
DestroyTask() will remove the task from the tree and also remove it from its parent. The Parent's OnRemoveChild() is called, and the task's OnDestruction() is called. All children of the task are also destroyed.
|
|
|
DoUpdates() updates all the tasks in the tree. DoUpdates() iterates through the tree in a pre-order fashion. It checks to see if a task is ready to be updated. A task is ready to be updated when time equal to or greater than the task's priority has passed (in milliseconds) or if the task is set to update every frame. If a task is ready to update, the task's OnUpdate() function is called. Any tasks that are set to be deleted will be deleted when this function is called, and again tasks will be deleted after the updates have completed (not the same ones, of course.) |
|
|
|
|
|
IsPaused() returns whether the tree has been paused by calling PauseTree() or not.
|
|
|
IsRunning() returns whether or not the tree has been stopped by StopTree() or is running.
Definition at line 124 of file dustytasktree.h. |
|
|
NumTasks() returns the number of tasks stored on the tree.
Definition at line 143 of file dustytasktree.h. |
|
||||||||||||||||
|
PauseChildren() pauses all the children of the task, but does not pause the task. Also pauses childrens' children, and so on.
|
|
||||||||||||||||
|
PauseTask() will pause the given task as well as all its children.
|
|
|
PauseTree() pauses the entire tree.
|
|
|
StartTree() will allow the tree to update tasks when OnUpdate() is called.
Definition at line 136 of file dustytasktree.h. |
|
|
StopTree() will cause the tree to not update tasks when OnUpdate() is called.
Definition at line 130 of file dustytasktree.h. |
|
||||||||||||||||
|
UnpauseChildren() unpauses all the children of the task, but does not unpause the task. Also unpauses childrens' children, and so on.
|
|
||||||||||||||||
|
UnpauseTask() will unpause the given task as well as all its children.
|
|
|
UnpauseTree() unpauses the entire tree.
|
|
|
|
|
|
|
|
|
Definition at line 157 of file dustytasktree.h. |
|
|
Definition at line 156 of file dustytasktree.h. |
|
|
Definition at line 159 of file dustytasktree.h. |
|
|
Definition at line 161 of file dustytasktree.h. |
|
|
Definition at line 154 of file dustytasktree.h. |
|
|
Definition at line 163 of file dustytasktree.h. |
1.4.6-NO