cocos2d-iphone  1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
CCScheduler Interface Reference

#include <CCScheduler.h>

List of all members.

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

CCSchedulersharedScheduler ()
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

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):

  • update selector: the 'update' selector will be called every frame. You can customize the priority.
  • custom selector: A custom selector will be called every frame, or with a custom interval of time

The 'custom selectors' should be avoided when possible. It is faster, and consumes less memory to use the 'update selector'.


Member Function Documentation

BOOL CCScheduler::isTargetPaused: ( id  target) [virtual]

Returns whether or not the target is paused

Since:
v1.0.0
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.

Since:
v0.99.3
void CCScheduler::purgeSharedScheduler ( ) [static, virtual]

purges the shared scheduler. It releases the retained instance.

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

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

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

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

Since:
v0.99.3
void CCScheduler::unscheduleAllSelectorsForTarget: ( id  target) [virtual]

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

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

Since:
v0.99.3
void CCScheduler::unscheduleUpdateForTarget: ( id  target) [virtual]

Unschedules the update selector for a given target

Since:
v0.99.3

Property Documentation

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.

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

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