Difference between revisions of "Accelerometer.isAvailable"

From GiderosMobile
m (Text replacement - "</source" to "</syntaxhighlight")
 
(35 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=c style="border:3px dashed blue">
+
=== 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>
 
</syntaxhighlight>
 +
 +
=== Return values ===
 +
'''Returns''' (bool) ''true'' if accelerometer is available for this platform, ''false'' otherwise.
 +
 +
{{Accelerometer}}

Latest revision as of 17: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.