#import "CCScheduler.h"
Public Member Functions | |
(void) | - DEPRECATED_ATTRIBUTE |
(void) | - pauseTarget: |
(void) | - resumeTarget: |
(void) | - scheduleSelector:forTarget:interval:paused: |
(void) | - scheduleTimer: |
(void) | - scheduleUpdateForTarget:priority:paused: |
(void) | - tick: |
(void) | - unscheduleAllSelectors |
(void) | - unscheduleAllSelectorsForTarget: |
(void) | - unscheduleSelector:forTarget: |
(void) | - unscheduleTimer: |
(void) | - unscheduleUpdateForTarget: |
Static Public Member Functions | |
(void) | + purgeSharedScheduler |
(CCScheduler *) | + sharedScheduler |
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'.
- (void) DEPRECATED_ATTRIBUTE |
unschedule all timers. You should NEVER call this method, unless you know what you are doing.
- (void) pauseTarget: | (id) | 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) purgeSharedScheduler |
purges the shared scheduler. It releases the retained instance.
- (void) resumeTarget: | (id) | 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) scheduleSelector: | (SEL) | selector | ||
forTarget: | (id) | target | ||
interval: | (ccTime) | interval | ||
paused: | (BOOL) | paused | ||
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) scheduleTimer: | (CCTimer *) | DEPRECATED_ATTRIBUTE |
schedules a Timer. It will be fired in every frame.
- (void) scheduleUpdateForTarget: | (id) | target | ||
priority: | (int) | priority | ||
paused: | (BOOL) | paused | ||
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 *) sharedScheduler |
returns a shared instance of the Scheduler
- (void) tick: | (ccTime) | dt |
'tick' the scheduler. You should NEVER call this method, unless you know what you are doing.
- (void) unscheduleAllSelectors |
Unschedules all selectors from all targets. You should NEVER call this method, unless you know what you are doing.
- (void) unscheduleAllSelectorsForTarget: | (id) | target |
Unschedules all selectors for a given target. This also includes the "update" selector.
- (void) unscheduleSelector: | (SEL) | selector | ||
forTarget: | (id) | target | ||
Unshedules a selector for a given target. If you want to unschedule the "update", use unscheudleUpdateForTarget.
- (void) unscheduleTimer: | (CCTimer *) | DEPRECATED_ATTRIBUTE |
unschedules an already scheduled Timer
- (void) unscheduleUpdateForTarget: | (id) | target |
Unschedules the update selector for a given target
- (ccTime) 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.