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

A class for providing platform specific features. More...

Public Types

enum  TextAlign { ,
  TOP = 0x13, TOP_RIGHT = 0x12, RIGHT = 0x32, BOTTOM_RIGHT = 0x22,
  BOTTOM = 0x23, BOTTOM_LEFT = 0x21, LEFT = 0x31, TOP_LEFT = 0x11
}
 Defines the alignment of text. More...
 

Static Public Member Functions

static int getDPI ()
 Gets the DPI of device The DPI of device.
 
var getDPI ()
 Gets the DPI of device The DPI of device.
 
local getDPI ()
 Gets the DPI of device The DPI of device.
 
static void setAccelerometerEnabled (bool isEnabled)
 To enable or disable accelerometer.
 
static void setAccelerometerInterval (float interval)
 Sets the interval of accelerometer.
 
local setAccelerometerInterval ( local interval)
 Sets the interval of accelerometer.
 
static void setKeepScreenOn (bool keepScreenOn)
 Controls whether the screen should remain on. More...
 
var setKeepScreenOn ( var keepScreenOn)
 Controls whether the screen should remain on. More...
 
local setKeepScreenOn ( local keepScreenOn)
 Controls whether the screen should remain on. More...
 
static void vibrate (float duration)
 Vibrate for the specified amount of time. More...
 
static Data getTextureDataForText (const char *text, const FontDefinition &textDefinition, TextAlign align, int &width, int &height, bool &hasPremultipliedAlpha)
 Gets texture data for text.
 

Detailed Description

A class for providing platform specific features.

Member Function Documentation

static void setKeepScreenOn ( bool  keepScreenOn)
static

Controls whether the screen should remain on.

One flag indicating that the screen should remain on.

var setKeepScreenOn ( var  keepScreenOn)
static

Controls whether the screen should remain on.

One flag indicating that the screen should remain on.

local setKeepScreenOn ( local  keepScreenOn)
static

Controls whether the screen should remain on.

One flag indicating that the screen should remain on.

static void vibrate ( float  duration)
static

Vibrate for the specified amount of time.

If vibrate is not supported, then invoking this method has no effect. Some platforms limit to a maximum duration of 5 seconds. Duration is ignored on iOS due to API limitations.

Parameters
durationThe duration in seconds.
var vibrate ( var  duration)
static

Vibrate for the specified amount of time.

If vibrate is not supported, then invoking this method has no effect. Some platforms limit to a maximum duration of 5 seconds. Duration is ignored on iOS due to API limitations.

Parameters
durationThe duration in seconds.
local vibrate ( local  duration)
static

Vibrate for the specified amount of time.

If vibrate is not supported, then invoking this method has no effect. Some platforms limit to a maximum duration of 5 seconds. Duration is ignored on iOS due to API limitations.

Parameters
durationThe duration in seconds.

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