Hardware and OS

From GiderosMobile
Revision as of 14:28, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

The Ultimate Guide to Gideros Studio

Hardware and OS

Introduction to hardware system

Getting logical dimensions

Getting device dimensions

Getting system information

Getting and setting orientation

Localization and language

Handling touch and mouse input

Multitouch

The easiest way to detect if the player touches the screen with two fingers, is to control the length of event.allTouches array. If it is 2, then exactly 2 fingers is touching the screen. <syntaxhighlight lang="lua"> local function onTouchesBegin(event)

 local isTwoFinger = (#event.allTouches == 2)

end </source>

Gyroscope

Accelerometer

GPS and location

Vibration

Gideros Studio provides a function for vibration. Consider the following example: <syntaxhighlight lang="lua"> application:vibrate() </source>

The vibration period is 300 ms for Android. For iOS, device vibrates for a duration which is determined by the operating system.

Disabling screen dimming

Some games may require that player doesn't touch the screen for a long time, e.g. those using accelerometer and gyro to control the actors on the screen. In this case, the screen may dim, depending on the user's activity and device settings. To disable (or enable) screen dimming, use the following commands: <syntaxhighlight lang="lua"> -- disable screen dimming and device sleeping application:setKeepAwake(true) -- enable screen dimming and device sleeping application:setKeepAwake(false) </source>

Note: this function has no effect on desktop player.


PREV.: Profiling
NEXT: Making a Plugin