Scheduler is responsible for triggering the scheduled callbacks. More...
#include <CCScheduler.h>
Public Member Functions | |
Scheduler () | |
~Scheduler (void) | |
float | getTimeScale (void) |
void | setTimeScale (float fTimeScale) |
Modifies the time of all scheduled callbacks. More... | |
void | update (float dt) |
'update' the scheduler. More... | |
void | scheduleSelector (SEL_SCHEDULE selector, Object *target, float fInterval, unsigned int repeat, float delay, bool bPaused) |
The scheduled method will be called every 'interval' seconds. More... | |
void | scheduleSelector (SEL_SCHEDULE selector, Object *target, float fInterval, bool bPaused) |
calls scheduleSelector with kRepeatForever and a 0 delay More... | |
void | scheduleUpdateForTarget (Object *target, int nPriority, bool bPaused) |
Schedules the 'update' selector for a given target with a given priority. More... | |
bool | isScheduledForTarget (SEL_SCHEDULE selector, Object *target) |
Checks whether a selector for a given taget is scheduled. More... | |
void | unscheduleSelector (SEL_SCHEDULE selector, Object *target) |
Unschedule a selector for a given target. More... | |
void | unscheduleUpdateForTarget (const Object *target) |
Unschedules the update selector for a given target. More... | |
void | unscheduleAllForTarget (Object *target) |
Unschedules all selectors for a given target. More... | |
void | unscheduleAll (void) |
Unschedules all selectors from all targets. More... | |
void | unscheduleAllWithMinPriority (int nMinPriority) |
Unschedules all selectors from all targets with a minimum priority. More... | |
unsigned int | scheduleScriptFunc (unsigned int nHandler, float fInterval, bool bPaused) |
The scheduled script callback will be called every 'interval' seconds. More... | |
void | unscheduleScriptEntry (unsigned int uScheduleScriptEntryID) |
Unschedule a script entry. More... | |
void | pauseTarget (Object *target) |
Pauses the target. More... | |
void | resumeTarget (Object *target) |
Resumes the target. More... | |
bool | isTargetPaused (Object *target) |
Returns whether or not the target is paused. More... | |
Set * | pauseAllTargets () |
Pause all selectors from all targets. More... | |
Set * | pauseAllTargetsWithMinPriority (int nMinPriority) |
Pause all selectors from all targets with a minimum priority. More... | |
void | resumeTargets (Set *targetsToResume) |
Resume selectors on a set of targets. More... | |
Public Member Functions inherited from Object | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
void | release () |
Release the ownership immediately. More... | |
void | retain () |
Retains the ownership. More... | |
Object * | autorelease () |
Release the ownership sometime soon automatically. More... | |
bool | isSingleReference () const |
Returns a boolean value that indicates whether there is only one reference to the object. More... | |
unsigned int | retainCount () const |
Returns the object's current reference count. More... | |
virtual bool | isEqual (const Object *object) |
Returns a boolean value that indicates whether this object and a given object are equal. More... | |
virtual void | acceptVisitor (DataVisitor &visitor) |
Static Public Attributes | |
static const int | PRIORITY_SYSTEM |
static const int | PRIORITY_NON_SYSTEM_MIN |
Protected Attributes | |
float | _timeScale |
struct _listEntry * | _updatesNegList |
struct _listEntry * | _updates0List |
struct _listEntry * | _updatesPosList |
struct _hashUpdateEntry * | _hashForUpdates |
struct _hashSelectorEntry * | _hashForTimers |
struct _hashSelectorEntry * | _currentTarget |
bool | _currentTargetSalvaged |
bool | _updateHashLocked |
Array * | _scriptHandlerEntries |
Protected Attributes inherited from Object | |
unsigned int | _reference |
count of references More... | |
var | _reference |
count of references More... | |
local | _reference |
count of references More... | |
unsigned int | _autoReleaseCount |
count of autorelease More... | |
var | _autoReleaseCount |
count of autorelease More... | |
local | _autoReleaseCount |
count of autorelease More... | |
Additional Inherited Members | |
Public Attributes inherited from Object | |
unsigned int | _ID |
object id, ScriptSupport need public _ID More... | |
int | _luaID |
Lua reference id. More... | |
Scheduler is responsible for triggering the scheduled callbacks.
You should not use NSTimer. Instead use this class.
There are 2 different types of callbacks (selectors):
The 'custom selectors' should be avoided when possible. It is faster, and consumes less memory to use the 'update selector'.
Scheduler | ( | ) |
~Scheduler | ( | void | ) |
|
inline |
bool isScheduledForTarget | ( | SEL_SCHEDULE | selector, |
Object * | target | ||
) |
Checks whether a selector for a given taget is scheduled.
bool isTargetPaused | ( | Object * | target) |
Returns whether or not the target is paused.
Set* pauseAllTargets | ( | ) |
Pause all selectors from all targets.
You should NEVER call this method, unless you know what you are doing.
Set* pauseAllTargetsWithMinPriority | ( | int | nMinPriority) |
Pause all selectors from all targets with a minimum priority.
You should only call this with kPriorityNonSystemMin or higher.
void pauseTarget | ( | Object * | target) |
Pauses the target.
All scheduled selectors/update for a given target won't be 'ticked' until the target is resumed. If the target is not present, nothing happens.
void resumeTarget | ( | Object * | target) |
Resumes the target.
The 'target' will be unpaused, so all schedule selectors/update will be 'ticked' again. If the target is not present, nothing happens.
void resumeTargets | ( | Set * | targetsToResume) |
Resume selectors on a set of targets.
This can be useful for undoing a call to pauseAllSelectors.
unsigned int scheduleScriptFunc | ( | unsigned int | nHandler, |
float | fInterval, | ||
bool | bPaused | ||
) |
The scheduled script callback will be called every 'interval' seconds.
If paused is true, then it won't be called until it is resumed. If 'interval' is 0, it will be called every frame. return schedule script entry ID, used for unscheduleScriptFunc().
void scheduleSelector | ( | SEL_SCHEDULE | selector, |
Object * | target, | ||
float | fInterval, | ||
unsigned int | repeat, | ||
float | delay, | ||
bool | bPaused | ||
) |
The scheduled method will be called every 'interval' seconds.
If paused is true, then it won't be called until it is resumed. If 'interval' is 0, it will be called every frame, but if so, it's recommended to use 'scheduleUpdateForTarget:' instead. If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again. repeat let the action be repeated repeat + 1 times, use kRepeatForever to let the action run continuously delay is the amount of time the action will wait before it'll start
void scheduleSelector | ( | SEL_SCHEDULE | selector, |
Object * | target, | ||
float | fInterval, | ||
bool | bPaused | ||
) |
calls scheduleSelector with kRepeatForever and a 0 delay
void scheduleUpdateForTarget | ( | Object * | target, |
int | nPriority, | ||
bool | bPaused | ||
) |
Schedules the 'update' selector for a given target with a given priority.
The 'update' selector will be called every frame. The lower the priority, the earlier it is called.
|
inline |
Modifies the time of all scheduled callbacks.
You can use this property to create a 'slow motion' or 'fast forward' effect. Default is 1.0. To create a 'slow motion' effect, use values below 1.0. To create a 'fast forward' effect, use values higher than 1.0.
void unscheduleAll | ( | void | ) |
Unschedules all selectors from all targets.
You should NEVER call this method, unless you know what you are doing.
void unscheduleAllForTarget | ( | Object * | target) |
Unschedules all selectors for a given target.
This also includes the "update" selector.
void unscheduleAllWithMinPriority | ( | int | nMinPriority) |
Unschedules all selectors from all targets with a minimum priority.
You should only call this with kPriorityNonSystemMin or higher.
void unscheduleScriptEntry | ( | unsigned int | uScheduleScriptEntryID) |
Unschedule a script entry.
void unscheduleSelector | ( | SEL_SCHEDULE | selector, |
Object * | target | ||
) |
Unschedule a selector for a given target.
If you want to unschedule the "update", use unscheudleUpdateForTarget.
void unscheduleUpdateForTarget | ( | const Object * | target) |
Unschedules the update selector for a given target.
|
virtual |
'update' the scheduler.
You should NEVER call this method, unless you know what you are doing.
Reimplemented from Object.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
static |