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

A Controller object represents a connected physical game controller. More...

Public Types

enum  Key
 Controllers' standard key Controller receives only standard key which contained within enum Key by default.
 

Public Member Functions

const std::string & getDeviceName () const
 Gets the name of this Controller object. More...
 
local getDeviceName ()
 Gets the name of this Controller object. More...
 
int getDeviceId () const
 Gets the Controller id. More...
 
bool isConnected () const
 Indicates whether the Controller is connected.
 
local isConnected ()
 Indicates whether the Controller is connected.
 
const KeyStatus & getKeyStatus (int keyCode)
 Get key status by key code. More...
 
local getKeyStatus ( local keyCode)
 Get key status by key code. More...
 
void receiveExternalKeyEvent (int externalKeyCode, bool receive)
 Activate receives key event from external key. More...
 
void setTag (int tag)
 Changes the tag that is used to identify the controller easily. More...
 
int getTag () const
 Returns a tag that is used to identify the controller easily. More...
 

Static Public Member Functions

static const std::vector
< Controller * > & 
getAllController ()
 Gets all Controller objects. More...
 
local getAllController ()
 Gets all Controller objects. More...
 
static ControllergetControllerByTag (int tag)
 Gets a Controller object with tag. More...
 
local getControllerByTag ( local tag)
 Gets a Controller object with tag. More...
 
static void startDiscoveryController ()
 Start discovering new controllers. More...
 
static void stopDiscoveryController ()
 Stop the discovery process. More...
 

Detailed Description

A Controller object represents a connected physical game controller.

Member Function Documentation

static const std::vector
<Controller*>
& getAllController
( )
inlinestatic

Gets all Controller objects.

all Controller objects.

local getAllController ( )
inlinestatic

Gets all Controller objects.

all Controller objects.

static Controller*
getControllerByTag
( int  tag)
static

Gets a Controller object with tag.

An identifier to find the controller. A Controller object.

local getControllerByTag ( local  tag)
static

Gets a Controller object with tag.

An identifier to find the controller. A Controller object.

static void
startDiscoveryController
( )
static

Start discovering new controllers.

The API only work on the IOS platform. Empty implementation on other platform.

local startDiscoveryController ( )
static

Start discovering new controllers.

The API only work on the IOS platform. Empty implementation on other platform.

static void stopDiscoveryController ( )
static

Stop the discovery process.

The API only work on the IOS platform.Empty implementation on other platform.

local stopDiscoveryController ( )
static

Stop the discovery process.

The API only work on the IOS platform.Empty implementation on other platform.

const std::string& getDeviceName ( ) const
inline

Gets the name of this Controller object.

The name of the Controller object. 8

local getDeviceName ( )
inline

Gets the name of this Controller object.

The name of the Controller object. 8

int getDeviceId ( ) const
inline

Gets the Controller id.

The Controller id.

local getDeviceId ( )
inline

Gets the Controller id.

The Controller id.

const KeyStatus& getKeyStatus ( int  keyCode)

Get key status by key code.

key status.

local getKeyStatus ( local  keyCode)

Get key status by key code.

key status.

void receiveExternalKeyEvent ( int  externalKeyCode,
bool  receive 
)

Activate receives key event from external key.

e.g. back,menu. Controller receives only standard key which contained within enum Key by default.

The API only work on the android platform for support diversified game controller.

External key code. True if external key event on this controller should be receive, false otherwise.

local receiveExternalKeyEvent ( local  externalKeyCode,
local  receive 
)

Activate receives key event from external key.

e.g. back,menu. Controller receives only standard key which contained within enum Key by default.

The API only work on the android platform for support diversified game controller.

External key code. True if external key event on this controller should be receive, false otherwise.

void setTag ( int  tag)
inline

Changes the tag that is used to identify the controller easily.

A integer that identifies the controller.

local setTag ( local  tag)
inline

Changes the tag that is used to identify the controller easily.

A integer that identifies the controller.

int getTag ( ) const
inline

Returns a tag that is used to identify the controller easily.

An integer that identifies the controller.

local getTag ( )
inline

Returns a tag that is used to identify the controller easily.

An integer that identifies the controller.


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