1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

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 AdminDF, Sep 18, 2014.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan 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