Public Member Functions | Static Public Member Functions | Properties

CCScheduler Class Reference

#import "CCScheduler.h"

List of all members.

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

Detailed Description

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'.


Member Function Documentation

- (void) DEPRECATED_ATTRIBUTE  

unschedule all timers. You should NEVER call this method, unless you know what you are doing.

Deprecated:
Use scheduleAllSelectors instead. Will be removed in 1.0
Since:
v0.8
- (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.

Since:
v0.99.3
+ (void) purgeSharedScheduler  

purges the shared scheduler. It releases the retained instance.

Since:
v0.99.0
- (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.

Since:
v0.99.3
- (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.

Since:
v0.99.3
- (void) scheduleTimer: (CCTimer *)  DEPRECATED_ATTRIBUTE  

schedules a Timer. It will be fired in every frame.

Deprecated:
Use scheduleSelector:forTarget:interval:paused instead. Will be removed in 1.0
- (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.

Since:
v0.99.3
+ (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.

Since:
v0.99.3
- (void) unscheduleAllSelectorsForTarget: (id)  target  

Unschedules all selectors for a given target. This also includes the "update" selector.

Since:
v0.99.3
- (void) unscheduleSelector: (SEL)  selector
forTarget: (id)  target 

Unshedules a selector for a given target. If you want to unschedule the "update", use unscheudleUpdateForTarget.

Since:
v0.99.3
- (void) unscheduleTimer: (CCTimer *)  DEPRECATED_ATTRIBUTE  

unschedules an already scheduled Timer

Deprecated:
Use unscheduleSelector:forTarget. Will be removed in v1.0
- (void) unscheduleUpdateForTarget: (id)  target  

Unschedules the update selector for a given target

Since:
v0.99.3

Property Documentation

- (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.

Since:
v0.8
Warning:
It will affect EVERY scheduled selector / action.

The documentation for this class was generated from the following file: