|
cocos2d-iphone
1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
|
#include <CCScheduler.h>
Public Member Functions | |
| void | tick: (ccTime dt) |
| void | scheduleSelector:forTarget:interval:paused: (SEL selector,[forTarget] id target,[interval] ccTime interval,[paused] BOOL paused) |
| void | scheduleUpdateForTarget:priority:paused: (id target,[priority] NSInteger priority,[paused] BOOL paused) |
| void | unscheduleSelector:forTarget: (SEL selector,[forTarget] id target) |
| void | unscheduleUpdateForTarget: (id target) |
| void | unscheduleAllSelectorsForTarget: (id target) |
| void | unscheduleAllSelectors () |
| void | pauseTarget: (id target) |
| void | resumeTarget: (id target) |
| BOOL | isTargetPaused: (id target) |
Static Public Member Functions | |
| CCScheduler * | sharedScheduler () |
| void | purgeSharedScheduler () |
Protected Attributes | |
| ccTime | timeScale_ |
| struct _listEntry * | updatesNeg |
| struct _listEntry * | updates0 |
| struct _listEntry * | updatesPos |
| struct _hashUpdateEntry * | hashForUpdates |
| struct _hashSelectorEntry * | hashForSelectors |
| struct _hashSelectorEntry * | currentTarget |
| BOOL | currentTargetSalvaged |
| TICK_IMP | impMethod |
| SEL | updateSelector |
| BOOL | updateHashLocked |
Properties | |
| ccTime | timeScale |
Scheduler is responsible of 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'.
| BOOL CCScheduler::isTargetPaused: | ( | id | target | ) | [virtual] |
Returns whether or not the target is paused
| void CCScheduler::pauseTarget: | ( | id | target | ) | [virtual] |
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 CCScheduler::purgeSharedScheduler | ( | ) | [static, virtual] |
purges the shared scheduler. It releases the retained instance.
| void CCScheduler::resumeTarget: | ( | id | target | ) | [virtual] |
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 CCScheduler::scheduleSelector:forTarget:interval:paused: | ( | SEL | selector, |
| [forTarget] id | target, | ||
| [interval] ccTime | interval, | ||
| [paused] BOOL | paused | ||
| ) | [virtual] |
The scheduled method will be called every 'interval' seconds. If paused is YES, then it won't be called until it is resumed. If 'interval' is 0, it will be called every frame, but if so, it recommened to use 'scheduleUpdateForTarget:' instead. If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again.
| void CCScheduler::scheduleUpdateForTarget:priority:paused: | ( | id | target, |
| [priority] NSInteger | priority, | ||
| [paused] BOOL | paused | ||
| ) | [virtual] |
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.
| CCScheduler * CCScheduler::sharedScheduler | ( | ) | [static, virtual] |
returns a shared instance of the Scheduler
| void CCScheduler::tick: | ( | ccTime | dt | ) | [virtual] |
'tick' the scheduler. You should NEVER call this method, unless you know what you are doing.
| void CCScheduler::unscheduleAllSelectors | ( | ) | [virtual] |
Unschedules all selectors from all targets. You should NEVER call this method, unless you know what you are doing.
| void CCScheduler::unscheduleAllSelectorsForTarget: | ( | id | target | ) | [virtual] |
Unschedules all selectors for a given target. This also includes the "update" selector.
| void CCScheduler::unscheduleSelector:forTarget: | ( | SEL | selector, |
| [forTarget] id | target | ||
| ) | [virtual] |
Unshedules a selector for a given target. If you want to unschedule the "update", use unscheudleUpdateForTarget.
| void CCScheduler::unscheduleUpdateForTarget: | ( | id | target | ) | [virtual] |
Unschedules the update selector for a given target
ccTime CCScheduler::timeScale [read, write, assign] |
Modifies the time of all scheduled callbacks. You can use this property to create a 'slow motion' or 'fast fordward' effect. Default is 1.0. To create a 'slow motion' effect, use values below 1.0. To create a 'fast fordward' effect, use values higher than 1.0.