cocos2d-x  3.0Beta0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Timer Class Reference

Light-weight timer. More...

#include <CCScheduler.h>

Inheritance diagram for Timer:
Object

Public Member Functions

 Timer (void)
bool initWithTarget (Object *target, SEL_SCHEDULE selector)
 Initializes a timer with a target and a selector. More...
 
var initWithTarget ( var target, var selector)
 Initializes a timer with a target and a selector. More...
 
local initWithTarget ( local target, local selector)
 Initializes a timer with a target and a selector. More...
 
bool initWithTarget (Object *target, SEL_SCHEDULE selector, float seconds, unsigned int repeat, float delay)
 Initializes a timer with a target, a selector and an interval in seconds, repeat in number of times to repeat, delay in seconds. More...
 
var initWithTarget ( var target, var selector, var seconds, var repeat, var delay)
 Initializes a timer with a target, a selector and an interval in seconds, repeat in number of times to repeat, delay in seconds. More...
 
local initWithTarget ( local target, local selector, local seconds, local repeat, local delay)
 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 handler, float seconds)
 Initializes a timer with a script callback function and an interval in seconds. More...
 
float getInterval () const
 get interval in seconds More...
 
var getInterval ()
 get interval in seconds More...
 
local getInterval ()
 get interval in seconds More...
 
void setInterval (float interval)
 set interval in seconds More...
 
var setInterval ( var interval)
 set interval in seconds More...
 
local setInterval ( local interval)
 set interval in seconds More...
 
SEL_SCHEDULE getSelector () const
void update (float dt)
 triggers the timer More...
 
var update ( var dt)
 triggers the timer More...
 
local update ( local dt)
 triggers the timer More...
 
int getScriptHandler () const
var getScriptHandler ()
local getScriptHandler ()
- Public Member Functions inherited from Object
 Object ()
 Constructor. More...
 
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
local retainCount ()
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)

Static Public Member Functions

static Timercreate (Object *target, SEL_SCHEDULE selector)
 Allocates a timer with a target and a selector. More...
 
static Timercreate (Object *target, SEL_SCHEDULE selector, float seconds)
 Allocates a timer with a target, a selector and an interval in seconds. More...
 
static TimercreateWithScriptHandler (int handler, float seconds)
 Allocates a timer with a script callback function and an interval in seconds. More...
 
static CC_DEPRECATED_ATTRIBUTE
Timer
timerWithTarget (Object *target, SEL_SCHEDULE selector)
local timerWithTarget ( local target, local selector)
static CC_DEPRECATED_ATTRIBUTE
Timer
timerWithTarget (Object *target, SEL_SCHEDULE selector, float seconds)
local timerWithTarget ( local target, local selector, local seconds)
static CC_DEPRECATED_ATTRIBUTE
Timer
timerWithScriptHandler (int handler, float seconds)
local timerWithScriptHandler ( local handler, local seconds)

Protected Attributes

Object_target
float _elapsed
var _elapsed
local _elapsed
bool _runForever
var _runForever
local _runForever
bool _useDelay
var _useDelay
local _useDelay
unsigned int _timesExecuted
var _timesExecuted
local _timesExecuted
unsigned int _repeat
var _repeat
local _repeat
float _delay
var _delay
local _delay
float _interval
var _interval
local _interval
SEL_SCHEDULE _selector
var _selector
local _selector
int _scriptHandler
var _scriptHandler
local _scriptHandler
- Protected Attributes inherited from Object
unsigned int _reference
 count of references More...
 
var _reference
 count of references More...
 
local _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 
var _autoReleaseCount
 count of autorelease More...
 
local _autoReleaseCount
 count of autorelease More...
 

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 
var _luaID
 Lua reference id. More...
 
local _luaID
 Lua reference id. More...
 

Detailed Description

Light-weight timer.

Constructor & Destructor Documentation

Timer ( void  )
var Timer (   )
local Timer (   )

Member Function Documentation

static Timer* create ( Object target,
SEL_SCHEDULE  selector 
)
static

Allocates a timer with a target and a selector.

var create ( var  target,
var  selector 
)
static

Allocates a timer with a target and a selector.

local create ( local  target,
local  selector 
)
static

Allocates a timer with a target and a selector.

static Timer* create ( Object target,
SEL_SCHEDULE  selector,
float  seconds 
)
static

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

var create ( var  target,
var  selector,
var  seconds 
)
static

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

local create ( local  target,
local  selector,
local  seconds 
)
static

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

static Timer*
createWithScriptHandler
( int  handler,
float  seconds 
)
static

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

float getInterval ( ) const

get interval in seconds

var getInterval ( )

get interval in seconds

local getInterval ( )

get interval in seconds

int getScriptHandler ( ) const
inline
var getScriptHandler ( )
inline
local getScriptHandler ( )
inline
SEL_SCHEDULE getSelector ( ) const
bool initWithScriptHandler ( int  handler,
float  seconds 
)

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

var initWithScriptHandler ( var  handler,
var  seconds 
)

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

local initWithScriptHandler ( local  handler,
local  seconds 
)

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

bool initWithTarget ( Object target,
SEL_SCHEDULE  selector 
)

Initializes a timer with a target and a selector.

var initWithTarget ( var  target,
var  selector 
)

Initializes a timer with a target and a selector.

local initWithTarget ( local  target,
local  selector 
)

Initializes a timer with a target and a selector.

bool initWithTarget ( Object target,
SEL_SCHEDULE  selector,
float  seconds,
unsigned int  repeat,
float  delay 
)

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

var initWithTarget ( var  target,
var  selector,
var  seconds,
var  repeat,
var  delay 
)

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

local initWithTarget ( local  target,
local  selector,
local  seconds,
local  repeat,
local  delay 
)

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

set interval in seconds

var setInterval ( var  interval)

set interval in seconds

local setInterval ( local  interval)

set interval in seconds

static CC_DEPRECATED_ATTRIBUTE
Timer* timerWithScriptHandler
( int  handler,
float  seconds 
)
inlinestatic
var timerWithScriptHandler ( var  handler,
var  seconds 
)
inlinestatic
local timerWithScriptHandler ( local  handler,
local  seconds 
)
inlinestatic
static CC_DEPRECATED_ATTRIBUTE
Timer* timerWithTarget
( Object target,
SEL_SCHEDULE  selector 
)
inlinestatic
var timerWithTarget ( var  target,
var  selector 
)
inlinestatic
local timerWithTarget ( local  target,
local  selector 
)
inlinestatic
static CC_DEPRECATED_ATTRIBUTE
Timer* timerWithTarget
( Object target,
SEL_SCHEDULE  selector,
float  seconds 
)
inlinestatic
var timerWithTarget ( var  target,
var  selector,
var  seconds 
)
inlinestatic
local timerWithTarget ( local  target,
local  selector,
local  seconds 
)
inlinestatic
void update ( float  dt)
virtual

triggers the timer

Reimplemented from Object.

var update ( var  dt)
virtual

triggers the timer

Reimplemented from Object.

local update ( local  dt)
virtual

triggers the timer

Reimplemented from Object.

Member Data Documentation

float _delay
protected
var _delay
protected
local _delay
protected
float _elapsed
protected
var _elapsed
protected
local _elapsed
protected
float _interval
protected
var _interval
protected
local _interval
protected
unsigned int _repeat
protected
var _repeat
protected
local _repeat
protected
bool _runForever
protected
var _runForever
protected
local _runForever
protected
int _scriptHandler
protected
var _scriptHandler
protected
local _scriptHandler
protected
SEL_SCHEDULE _selector
protected
var _selector
protected
local _selector
protected
Object* _target
protected
unsigned int _timesExecuted
protected
var _timesExecuted
protected
local _timesExecuted
protected
bool _useDelay
protected
var _useDelay
protected
local _useDelay
protected

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