Difference between revisions of "Hardware and OS"

From GiderosMobile
 
(3 intermediate revisions by 2 users not shown)
Line 21: Line 21:
 
== Multitouch ==
 
== 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.
 
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.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
local function onTouchesBegin(event)
 
local function onTouchesBegin(event)
 
   local isTwoFinger = (#event.allTouches == 2)
 
   local isTwoFinger = (#event.allTouches == 2)
 
end
 
end
</source>
+
</syntaxhighlight>
  
 
== Gyroscope ==
 
== Gyroscope ==
Line 35: Line 35:
 
== Vibration ==
 
== Vibration ==
 
Gideros Studio provides a function for vibration. Consider the following example:
 
Gideros Studio provides a function for vibration. Consider the following example:
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
application:vibrate()  
 
application:vibrate()  
</source>
+
</syntaxhighlight>
  
 
The vibration period is 300 ms for Android. For iOS, device vibrates for a duration which is determined by the operating system.
 
The vibration period is 300 ms for Android. For iOS, device vibrates for a duration which is determined by the operating system.
Line 43: Line 43:
 
== Disabling screen dimming ==
 
== 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:
 
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:
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
-- disable screen dimming and device sleeping
 
-- disable screen dimming and device sleeping
 
application:setKeepAwake(true)
 
application:setKeepAwake(true)
 
-- enable screen dimming and device sleeping
 
-- enable screen dimming and device sleeping
 
application:setKeepAwake(false)
 
application:setKeepAwake(false)
</source>
+
</syntaxhighlight>
  
 
'''Note:''' this function has no effect on desktop player.
 
'''Note:''' this function has no effect on desktop player.
Line 54: Line 54:
  
 
'''PREV.''': [[Profiling]]<br/>
 
'''PREV.''': [[Profiling]]<br/>
'''NEXT''': [[Making a Plugin]]
+
'''NEXT''': [[Exporting to a Player]]
 +
 
 +
 
 +
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 23:26, 18 November 2023

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.

local function onTouchesBegin(event)
  local isTwoFinger = (#event.allTouches == 2)
end

Gyroscope

Accelerometer

GPS and location

Vibration

Gideros Studio provides a function for vibration. Consider the following example:

application:vibrate()

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:

-- disable screen dimming and device sleeping
application:setKeepAwake(true)
-- enable screen dimming and device sleeping
application:setKeepAwake(false)

Note: this function has no effect on desktop player.


PREV.: Profiling
NEXT: Exporting to a Player