Difference between revisions of "Accelerometer.isAvailable"

From GiderosMobile
(Created page with "The Accelerometer class is used to access accelerometer data. <syntaxhighlight lang=lua style="border:3px"> --create instance local accelerometer = Accelerometer.new() --star...")
 
m (Text replacement - "</source" to "</syntaxhighlight")
 
(40 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The Accelerometer class is used to access accelerometer data.
+
'''Available since:''' Gideros 2012.8<br/>
 +
'''Class:''' [[Accelerometer]]<br/>
  
<syntaxhighlight lang=lua style="border:3px">
+
=== Description ===
--create instance
+
Returns ''true'' if accelerometer is available for this platform, ''false'' otherwise.
local accelerometer = Accelerometer.new()
 
--start receiving data
 
accelerometer:start()
 
---get values for example on each enter frame event
 
local x, y, z = accelerometer:getAcceleration()
 
print(x, y, z)
 
  
--once you don't need it, stop it
+
<syntaxhighlight lang="lua">
accelerometer:stop()
+
(bool) = Accelerometer.isAvailable()
 +
</syntaxhighlight>
 +
 
 +
=== Return values ===
 +
'''Returns''' (bool) ''true'' if accelerometer is available for this platform, ''false'' otherwise.
 +
 
 +
{{Accelerometer}}

Latest revision as of 18:00, 12 July 2023

Available since: Gideros 2012.8
Class: Accelerometer

Description

Returns true if accelerometer is available for this platform, false otherwise.

(bool) = Accelerometer.isAvailable()

Return values

Returns (bool) true if accelerometer is available for this platform, false otherwise.