Description

The Gyroscope sample demonstrates how to use the Gyroscope in order to rotate a 3D cube when your device is tilted. This sample suports both iOS or Android devices. The sample uses the TOrientationSensor component and the TCustomOrientationSensor class to act like a gyroscope that rotates a 3D cube while you tilt your device.

Note: The TCustomOrientationSensor class supports Android, iOS and Windows platforms. However, each platform provides different orientation sensors and each type of sensor supports a different set of properties (see platform support for a completed list of platform, sensors and suported properties).

How to Use the Sample

Navigate to one of the locations given above and open:

Delphi: Gyroscope.dproj.

C++: Gyroscope.cbproj.

Select the target platform, iOS and Android supported.

Press F9 or choose Run > Run.

Interact with the sample:

There is a 3D cube displayed in the screen.

Tilt your device and see how the 3D cube rotates.

Files

File in Delphi

File in C++

Contains

Gyroscope.dproj

Gyroscope.cbproj

The project itself.

uMain.fmx

uMain.fmx

The main form where the components are located.

uMain.pas

GyroscopePCH.h, Gyroscope.cpp

Used to define and implement the sample.

Information.txt

Information.txt

Further information about the sample.

Classes

TGyroscopeForm is the main form that represents the main window of the sample. It contains the following components: