cocos2d-x  2.2.3-gd2.113-rev1ec524e
Loading...
Searching...
No Matches
CCTimer Class Reference

Light-weight timer. More...

#include <CCScheduler.h>

Inheritance diagram for CCTimer:
[legend]
Collaboration diagram for CCTimer:
[legend]

Public Member Functions

 CCTimer (void)
 ctor NA More...
 
float getInterval (void) const
 get interval in seconds More...
 
void setInterval (float fInterval)
 set interval in seconds More...
 
SEL_SCHEDULE getSelector () const
 NA. More...
 
bool initWithTarget (CCObject *pTarget, SEL_SCHEDULE pfnSelector)
 Initializes a timer with a target and a selector. More...
 
bool initWithTarget (CCObject *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds, unsigned int nRepeat, float fDelay)
 Initializes a timer with a target, a selector and an interval in seconds, repeat in number of times to repeat, delay in seconds. More...
 
bool initWithScriptHandler (int nHandler, float fSeconds)
 Initializes a timer with a script callback function and an interval in seconds. More...
 
void update (float dt)
 triggers the timer More...
 
int getScriptHandler ()
 NA. More...
 
- Public Member Functions inherited from CCObject
 CCObject (void)
 
virtual ~CCObject (void)
 NA. More...
 
void release (void)
 
void retain (void)
 
CCObjectautorelease (void)
 
CCObjectcopy (void)
 
bool isSingleReference (void) const
 
unsigned int retainCount (void) const
 
virtual bool isEqual (const CCObject *pObject)
 
virtual void acceptVisitor (CCDataVisitor &visitor)
 
virtual void update (float dt)
 
 CCObject (const CCObject &)
 
CCObjectoperator= (const CCObject &)
 
virtual void encodeWithCoder (DS_Dictionary *)
 
virtual bool canEncode ()
 
CCObjectType getObjType () const
 
virtual int getTag () const
 
virtual void setTag (int nTag)
 
void setObjType (CCObjectType)
 
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)
 

Static Public Member Functions

static CCTimertimerWithTarget (CCObject *pTarget, SEL_SCHEDULE pfnSelector)
 Allocates a timer with a target and a selector. More...
 
static CCTimertimerWithTarget (CCObject *pTarget, SEL_SCHEDULE pfnSelector, float fSeconds)
 Allocates a timer with a target, a selector and an interval in seconds. More...
 
static CCTimertimerWithScriptHandler (int nHandler, float fSeconds)
 Allocates a timer with a script callback function and an interval in seconds. More...
 
- Static Public Member Functions inherited from CCObject
static CCObjectcreateWithCoder (DS_Dictionary *)
 

Protected Attributes

CCObjectm_pTarget
 
float m_fElapsed
 
bool m_bRunForever
 
bool m_bUseDelay
 
unsigned int m_uTimesExecuted
 
unsigned int m_uRepeat
 
float m_fDelay
 
float m_fInterval
 
SEL_SCHEDULE m_pfnSelector
 
int m_nScriptHandler
 
- Protected Attributes inherited from CCObject
unsigned int m_uReference
 
unsigned int m_uAutoReleaseCount
 
int m_nTag
 
int m_eObjType
 
unsigned int m_uObjectIdxInArray
 

Additional Inherited Members

- Public Attributes inherited from CCObject
unsigned int m_uID
 
int m_nLuaID
 

Detailed Description

Light-weight timer.

Constructor & Destructor Documentation

◆ CCTimer()

CCTimer ( void  )

ctor NA

Member Function Documentation

◆ getInterval()

float getInterval ( void  ) const

get interval in seconds

◆ getScriptHandler()

int getScriptHandler ( )
inline

NA.

◆ getSelector()

SEL_SCHEDULE getSelector ( ) const

NA.

◆ initWithScriptHandler()

bool initWithScriptHandler ( int  nHandler,
float  fSeconds 
)

Initializes a timer with a script callback function and an interval in seconds.

◆ initWithTarget() [1/2]

bool initWithTarget ( CCObject pTarget,
SEL_SCHEDULE  pfnSelector 
)

Initializes a timer with a target and a selector.

NA

◆ initWithTarget() [2/2]

bool initWithTarget ( CCObject pTarget,
SEL_SCHEDULE  pfnSelector,
float  fSeconds,
unsigned int  nRepeat,
float  fDelay 
)

Initializes a timer with a target, a selector and an interval in seconds, repeat in number of times to repeat, delay in seconds.

NA

◆ setInterval()

void setInterval ( float  fInterval)

set interval in seconds

◆ timerWithScriptHandler()

static CCTimer * timerWithScriptHandler ( int  nHandler,
float  fSeconds 
)
static

Allocates a timer with a script callback function and an interval in seconds.

◆ timerWithTarget() [1/2]

static CCTimer * timerWithTarget ( CCObject pTarget,
SEL_SCHEDULE  pfnSelector 
)
static

Allocates a timer with a target and a selector.

NA

◆ timerWithTarget() [2/2]

static CCTimer * timerWithTarget ( CCObject pTarget,
SEL_SCHEDULE  pfnSelector,
float  fSeconds 
)
static

Allocates a timer with a target, a selector and an interval in seconds.

NA

◆ update()

void update ( float  dt)
virtual

triggers the timer

Reimplemented from CCObject.

Member Data Documentation

◆ m_bRunForever

bool m_bRunForever
protected

◆ m_bUseDelay

bool m_bUseDelay
protected

◆ m_fDelay

float m_fDelay
protected

◆ m_fElapsed

float m_fElapsed
protected

◆ m_fInterval

float m_fInterval
protected

◆ m_nScriptHandler

int m_nScriptHandler
protected

◆ m_pfnSelector

SEL_SCHEDULE m_pfnSelector
protected

◆ m_pTarget

CCObject* m_pTarget
protected

◆ m_uRepeat

unsigned int m_uRepeat
protected

◆ m_uTimesExecuted

unsigned int m_uTimesExecuted
protected

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