Dismiss Notice



3 MONTHS VIP - 10$; 6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$


Dismiss Notice
The registration is approved by the Administrator. It takes about 1 day to approve your registration
Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Tilt Control Mechanisms with source code

Discussion in 'Delphi Android And IOS' started by N0body, Sep 18, 2014.

  1. N0body

    N0bodyN0body is a Verified Member DelphiFan Administrator Staff Member DF Staff

    A motion sensing Accelerometer demo in Delphi XE6 and XE7 Firemonkey allows you to track the tilt of your device. The component that the Accelerometer demo uses is called TMotionSensor. Different devices have different capabilities but the Android and iOS devices that I tested only reported Acceleration X, Acceleration Y, and Acceleration Z. The demo also lists Angle X, Angle Y, Angle Z, Motion, and Speed which it exposes through TMotionSensor.Sensor.AvailableProperties. You can use the X, Y, and Z numbers to build a control mechanism based on the tilt of the device. I added two different pieces of code using the accelerometer numbers to the demo. The first is basically a ball that rolls around on the screen when you tilt the device. The ball is confined within a circle so that it does not disappear off of the screen. You could change the confined space of the ball from the circle to the size of the screen and turn it into a game. The second control detects the tilt of the device and displays a circle which represents a direction (left, right, up, down). You could use this tilt direction detection to fire events within your app (like sliding components on and off the screen or controlling the placement and rotation of an object). The tricky part of the accelerometer is that you have to swap the X and Y depending on if your device is in Landscape or Portrait mode. The code should also work in Appmethod.

    Download HERE

Share This Page

Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.
Donate Help To Us and Be VIP
6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$
Social Block