Class CCScheduler

#include <Geode/cocos/CCScheduler.h>
classCCScheduler:publiccocos2d::CCObject{ ... }

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

  • 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’.
Examples0
Public static methods1
staticcocos2d::CCScheduler*get()

Get the shared scheduler from CCDirector

ℹ Geode addition

Public member functions19
floatgetTimeScale()
No description provided
voidsetTimeScale(
floatfTimeScale
)

Since v0.8

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.

⚠️ It will affect EVERY scheduled selector / action.

virtualvoidupdate()

‘update’ the scheduler. You should NEVER call this method, unless you know what you are doing.

voidscheduleSelector(,,
floatfInterval
,
uintrepeat
,
floatdelay
,
boolbPaused
)

Since v0.99.3, repeat and delay added in v1.1

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’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 kCCRepeatForever to let the action run continuously delay is the amount of time the action will wait before it’ll start

voidscheduleSelector(,,
floatfInterval
,
boolbPaused
)

calls scheduleSelector with kCCRepeatForever and a 0 delay

voidscheduleUpdateForTarget(,
intnPriority
,
boolbPaused
)

Since v0.99.3

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.

voidunscheduleSelector(,)

Since v0.99.3

Unschedule a selector for a given target. If you want to unschedule the “update”, use unscheudleUpdateForTarget.

voidunscheduleUpdateForTarget()

Since v0.99.3

Unschedules the update selector for a given target

voidunscheduleAllForTarget()

Since v0.99.3

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

voidunscheduleAll()

Since v0.99.3

Unschedules all selectors from all targets. You should NEVER call this method, unless you know what you are doing.

voidunscheduleAllWithMinPriority(
intnMinPriority
)

Since v2.0.0

Unschedules all selectors from all targets with a minimum priority. You should only call this with kCCPriorityNonSystemMin or higher.

uintscheduleScriptFunc(
uintnHandler
,
floatfInterval
,
boolbPaused
)

The scheduled script callback 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. return schedule script entry ID, used for unscheduleScriptFunc().

voidunscheduleScriptEntry(
uintuScheduleScriptEntryID
)

Unschedule a script entry.

voidpauseTarget()

Since v0.99.3

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.

voidresumeTarget()

Since v0.99.3

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.

boolisTargetPaused()

Since v1.0.0

Returns whether or not the target is paused

cocos2d::CCSet*pauseAllTargets()

Since v2.0.0

Pause all selectors from all targets. You should NEVER call this method, unless you know what you are doing.

cocos2d::CCSet*pauseAllTargetsWithMinPriority(
intnMinPriority
)

Since v2.0.0

Pause all selectors from all targets with a minimum priority. You should only call this with kCCPriorityNonSystemMin or higher.

voidresumeTargets(
cocos2d::CCSet*targetsToResume
)

Since v2.0.0

Resume selectors on a set of targets. This can be useful for undoing a call to pauseAllSelectors.

Fields0
Protected member functions0
Protected fields10
floatm_fTimeScale
;
No description provided
cocos2d::_listEntry*m_pUpdatesNegList
;
No description provided
cocos2d::_listEntry*m_pUpdates0List
;
No description provided
cocos2d::_listEntry*m_pUpdatesPosList
;
No description provided
;
No description provided
;
No description provided
;
No description provided
boolm_bCurrentTargetSalvaged
;
No description provided
boolm_bUpdateHashLocked
;
No description provided
cocos2d::CCArray*m_pScriptHandlerEntries
;
No description provided