cocos2d-x  2.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCTimer Class Reference

Light-weight timer. More...

#include <CCScheduler.h>

Inheritance diagram for CCTimer:
CCObject CCCopying

Public Member Functions

 CCTimer (void)
float getInterval (void) const
 get interval in seconds More...
 
void setInterval (float fInterval)
 set interval in seconds More...
 
SEL_SCHEDULE getSelector () const
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 ()
- Public Member Functions inherited from CCObject
 CCObject (void)
virtual ~CCObject (void)
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)
- 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...
 

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

Additional Inherited Members

- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID

Detailed Description

Light-weight timer.

Constructor & Destructor Documentation

CCTimer ( void  )

Member Function Documentation

float getInterval ( void  ) const

get interval in seconds

int getScriptHandler ( )
inline
SEL_SCHEDULE getSelector ( ) const
bool initWithScriptHandler ( int  nHandler,
float  fSeconds 
)

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

bool initWithTarget ( CCObject pTarget,
SEL_SCHEDULE  pfnSelector 
)

Initializes a timer with a target and a selector.

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.

void setInterval ( float  fInterval)

set interval in seconds

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

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

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

Allocates a timer with a target and a selector.

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

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

void update ( float  dt)
virtual

triggers the timer

Reimplemented from CCObject.

Member Data Documentation

bool m_bRunForever
protected
bool m_bUseDelay
protected
float m_fDelay
protected
float m_fElapsed
protected
float m_fInterval
protected
int m_nScriptHandler
protected
SEL_SCHEDULE m_pfnSelector
protected
CCObject* m_pTarget
protected
unsigned int m_uRepeat
protected
unsigned int m_uTimesExecuted
protected

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