Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
Touch Class Reference

Encapsulates the Touch information, such as touch point, id and so on, and provides the methods that commonly used. More...

Inherits Ref.

Public Types

enum  DispatchMode { , ONE_BY_ONE }
 Dispatch mode, how the touches are dispatched. More...
 

Public Member Functions

 Touch ()
 Constructor.
 
 Touch ()
 Constructor.
 
Vec2 getLocation () const
 Returns the current touch location in OpenGL coordinates. More...
 
var getLocation ()
 Returns the current touch location in OpenGL coordinates. More...
 
local getLocation ()
 Returns the current touch location in OpenGL coordinates. More...
 
Vec2 getPreviousLocation () const
 Returns the previous touch location in OpenGL coordinates. More...
 
var getPreviousLocation ()
 Returns the previous touch location in OpenGL coordinates. More...
 
local getPreviousLocation ()
 Returns the previous touch location in OpenGL coordinates. More...
 
Vec2 getStartLocation () const
 Returns the start touch location in OpenGL coordinates. More...
 
var getStartLocation ()
 Returns the start touch location in OpenGL coordinates. More...
 
local getStartLocation ()
 Returns the start touch location in OpenGL coordinates. More...
 
Vec2 getDelta () const
 Returns the delta of 2 current touches locations in screen coordinates. More...
 
Vec2 getLocationInView () const
 Returns the current touch location in screen coordinates. More...
 
Vec2 getPreviousLocationInView () const
 Returns the previous touch location in screen coordinates. More...
 
var getPreviousLocationInView ()
 Returns the previous touch location in screen coordinates. More...
 
local getPreviousLocationInView ()
 Returns the previous touch location in screen coordinates. More...
 
Vec2 getStartLocationInView () const
 Returns the start touch location in screen coordinates. More...
 
var getStartLocationInView ()
 Returns the start touch location in screen coordinates. More...
 
local getStartLocationInView ()
 Returns the start touch location in screen coordinates. More...
 
void setTouchInfo (int id, float x, float y)
 Set the touch infomation. More...
 
void setTouchInfo (int id, float x, float y, float force, float maxForce)
 Set the touch infomation. More...
 
int getID () const
 Get touch id. More...
 
var getId ()
 Get touch id. More...
 
local getId ()
 Get touch id. More...
 
float getCurrentForce () const
 Returns the current touch force for 3d touch. More...
 
var getCurrentForce ()
 Returns the current touch force for 3d touch. More...
 
local getCurrentForce ()
 Returns the current touch force for 3d touch. More...
 
float getMaxForce () const
 Returns the maximum touch force for 3d touch.
 
var getMaxForce ()
 Returns the maximum touch force for 3d touch.
 
local getMaxForce ()
 Returns the maximum touch force for 3d touch.
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

Detailed Description

Encapsulates the Touch information, such as touch point, id and so on, and provides the methods that commonly used.

Member Function Documentation

Vec2 getLocation ( ) const

Returns the current touch location in OpenGL coordinates.

The current touch location in OpenGL coordinates.

var getLocation ( )

Returns the current touch location in OpenGL coordinates.

The current touch location in OpenGL coordinates.

local getLocation ( )

Returns the current touch location in OpenGL coordinates.

The current touch location in OpenGL coordinates.

Vec2 getPreviousLocation ( ) const

Returns the previous touch location in OpenGL coordinates.

The previous touch location in OpenGL coordinates.

var getPreviousLocation ( )

Returns the previous touch location in OpenGL coordinates.

The previous touch location in OpenGL coordinates.

local getPreviousLocation ( )

Returns the previous touch location in OpenGL coordinates.

The previous touch location in OpenGL coordinates.

Vec2 getStartLocation ( ) const

Returns the start touch location in OpenGL coordinates.

The start touch location in OpenGL coordinates.

var getStartLocation ( )

Returns the start touch location in OpenGL coordinates.

The start touch location in OpenGL coordinates.

local getStartLocation ( )

Returns the start touch location in OpenGL coordinates.

The start touch location in OpenGL coordinates.

Vec2 getDelta ( ) const

Returns the delta of 2 current touches locations in screen coordinates.

The delta of 2 current touches locations in screen coordinates.

var getDelta ( )

Returns the delta of 2 current touches locations in screen coordinates.

The delta of 2 current touches locations in screen coordinates.

local getDelta ( )

Returns the delta of 2 current touches locations in screen coordinates.

The delta of 2 current touches locations in screen coordinates.

Vec2 getLocationInView ( ) const

Returns the current touch location in screen coordinates.

The current touch location in screen coordinates.

var getLocationInView ( )

Returns the current touch location in screen coordinates.

The current touch location in screen coordinates.

local getLocationInView ( )

Returns the current touch location in screen coordinates.

The current touch location in screen coordinates.

Vec2 getPreviousLocationInView ( ) const

Returns the previous touch location in screen coordinates.

The previous touch location in screen coordinates.

var getPreviousLocationInView ( )

Returns the previous touch location in screen coordinates.

The previous touch location in screen coordinates.

local getPreviousLocationInView ( )

Returns the previous touch location in screen coordinates.

The previous touch location in screen coordinates.

Vec2 getStartLocationInView ( ) const

Returns the start touch location in screen coordinates.

The start touch location in screen coordinates.

var getStartLocationInView ( )

Returns the start touch location in screen coordinates.

The start touch location in screen coordinates.

local getStartLocationInView ( )

Returns the start touch location in screen coordinates.

The start touch location in screen coordinates.

void setTouchInfo ( int  id,
float  x,
float  y 
)
inline

Set the touch infomation.

It always used to monitor touch event.

A given id A given x coordinate. A given y coordinate.

var setTouchInfo ( var  id,
var  x,
var  y 
)
inline

Set the touch infomation.

It always used to monitor touch event.

A given id A given x coordinate. A given y coordinate.

local setTouchInfo ( local  id,
local  x,
local  y 
)
inline

Set the touch infomation.

It always used to monitor touch event.

A given id A given x coordinate. A given y coordinate.

void setTouchInfo ( int  id,
float  x,
float  y,
float  force,
float  maxForce 
)
inline

Set the touch infomation.

It always used to monitor touch event. A given id A given x coordinate. A given y coordinate. The force value for 3d touch, if device won't support 3d touch or no 3d touch occurred it will be set to 0. The max possible force value for 3d touch, if device won't support 3d touch or no 3d touch occurred it will be set to 0.

var setTouchInfo ( var  id,
var  x,
var  y,
var  force,
var  maxForce 
)
inline

Set the touch infomation.

It always used to monitor touch event. A given id A given x coordinate. A given y coordinate. The force value for 3d touch, if device won't support 3d touch or no 3d touch occurred it will be set to 0. The max possible force value for 3d touch, if device won't support 3d touch or no 3d touch occurred it will be set to 0.

local setTouchInfo ( local  id,
local  x,
local  y,
local  force,
local  maxForce 
)
inline

Set the touch infomation.

It always used to monitor touch event. A given id A given x coordinate. A given y coordinate. The force value for 3d touch, if device won't support 3d touch or no 3d touch occurred it will be set to 0. The max possible force value for 3d touch, if device won't support 3d touch or no 3d touch occurred it will be set to 0.

int getID ( ) const
inline

Get touch id.

The id of touch.

var getId ( )
inline

Get touch id.

The id of touch.

local getId ( )
inline

Get touch id.

The id of touch.

float getCurrentForce ( ) const

Returns the current touch force for 3d touch.

The current touch force for 3d touch.

var getCurrentForce ( )

Returns the current touch force for 3d touch.

The current touch force for 3d touch.

local getCurrentForce ( )

Returns the current touch force for 3d touch.

The current touch force for 3d touch.


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