TaskSummary | | | Enumeration defining priority of a Task. | | Abstract class for tasks, which are runnable classes for use with TaskManager. | | | | Constructor, every task needs a name and priority. | | Virtual destructor, exists simply to make inheritance safe. | | | | Pure virtual, every child task must overload it’s own update(), when a task is active this is called every ‘frame.’ | | Virtual function, overload to define behavior when the task is started. | | Virtual function, overload to define behavior when the task is killed. | | Virtual function, overload to define behavior every time that the task is paused. | | Virtual function, overload to define behavior every time that the task is unpaused. | | Sets state of task to dead, dead tasks remove themselves from the TaskManager’s task pool. | | | | Get the name of the task. | | Get the priority of the task. | | Check if task is alive or not. | | Check if task is paused or not. | | Pointer to a task, used since Task is abstract and will always be accessed via a pointer. |
PriorityLevelEnumeration defining priority of a Task. ValuesPRI_LOWEST | Lowest priority available. | PRI_LOW | Lower-than-usual priority. | PRI_NORMAL | Normal priority, suitable for most tasks. | PRI_HIGH | Lower-than-usual priority. | PRI_HIGHEST | Highest priority available. |
TaskAbstract class for tasks, which are runnable classes for use with TaskManager. When writing a task, only update() needs to be overloaded. Summary | | | Constructor, every task needs a name and priority. | | Virtual destructor, exists simply to make inheritance safe. | | | | Pure virtual, every child task must overload it’s own update(), when a task is active this is called every ‘frame.’ | | Virtual function, overload to define behavior when the task is started. | | Virtual function, overload to define behavior when the task is killed. | | Virtual function, overload to define behavior every time that the task is paused. | | Virtual function, overload to define behavior every time that the task is unpaused. | | Sets state of task to dead, dead tasks remove themselves from the TaskManager’s task pool. | | | | Get the name of the task. | | Get the priority of the task. | | Check if task is alive or not. | | Check if task is paused or not. | | Pointer to a task, used since Task is abstract and will always be accessed via a pointer. |
TaskTask( | const std:: | string | & | name, | | | | | PriorityLevel | | priority | = | PRI_NORMAL | ) |
|
Constructor, every task needs a name and priority. Parametersname | Name for task, must be unique! | priority | Optional argument for desired priority for the Task, controls order in which tasks are run by the TaskManager. Default Priority is PRI_NORMAL |
~TaskVirtual destructor, exists simply to make inheritance safe.
updatevirtual void update( | scalar | timeDelta | )=0 |
|
Pure virtual, every child task must overload it’s own update(), when a task is active this is called every ‘frame.’ Parameters
onStartVirtual function, overload to define behavior when the task is started.
onKillVirtual function, overload to define behavior when the task is killed.
onPauseVirtual function, overload to define behavior every time that the task is paused. NoteChildren of onPause should call Task::onPause to let the task know it’s been paused.
onUnpauseVirtual function, overload to define behavior every time that the task is unpaused. NoteChildren of onUnpause should call Task::onUnpause to let the task know it’s been paused.
killSets state of task to dead, dead tasks remove themselves from the TaskManager’s task pool.
getNamestd::string getName() const |
Get the name of the task. ReturnName of task.
getPriorityGet the priority of the task. Returnpriority of task.
isAliveCheck if task is alive or not. Returntrue if task is alive, false if task has been killed
isPausedCheck if task is paused or not. Returntrue iff task is paused
TaskPtrPointer to a task, used since Task is abstract and will always be accessed via a pointer.
|