android.gameengine.icadroids.input
Class MotionSensor

java.lang.Object
  extended by android.gameengine.icadroids.input.MotionSensor

public class MotionSensor
extends java.lang.Object

Motion Sensor is used to receive certain statics about certain motionEvent note that this only works on real phones and not in emulator. Some of these functions will not work if you do not have the required sensor in your phone.
Use of MotionSensor in your game: use the static variables to read the state of the sensors. All other methods are for communication between game engine and android device.

Author:
Roel See http://developer.android.com/reference/android/hardware/SensorEvent.html

Field Summary
static float pitch
          the y rotation of the phone
static float roll
          the z rotation of the phone
static boolean tiltDown
          this var is TRUE when the phone has been tilted Down
static boolean tiltLeft
          this var is TRUE when the phone has been tilted Left
static boolean tiltRight
          this var is TRUE when the phone has been tilted Right
static boolean tiltUp
          this var is TRUE when the phone has been tilted Up
static boolean use
          Set this to TRUE if you want to use the MotionSensor and be able to ask for input.
static float xAcceleration
          This variable contains the x Acceleration of the phone.
static float yAcceleration
          This variable contains the y Acceleration of the phone.
static float yaw
          the x rotation of the phone
static float zAcceleration
          This variable contains the Z Acceleration of the phone , minus the gravity
 
Constructor Summary
MotionSensor()
           
 
Method Summary
static void handleOnPause(SensorEventListener listener)
          DO NOT CALL THIS METHOD.
static void handleOnResume(SensorEventListener listener)
          DO NOT CALL THIS METHOD.
static void handleSensorChange(SensorEvent event)
          DO NOT CALL THIS METHOD.
static void initialize(SensorManager newSensorManager)
          Start the MotionSensor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

use

public static boolean use
Set this to TRUE if you want to use the MotionSensor and be able to ask for input.


xAcceleration

public static float xAcceleration
This variable contains the x Acceleration of the phone.


yAcceleration

public static float yAcceleration
This variable contains the y Acceleration of the phone.


zAcceleration

public static float zAcceleration
This variable contains the Z Acceleration of the phone , minus the gravity


yaw

public static float yaw
the x rotation of the phone


pitch

public static float pitch
the y rotation of the phone


roll

public static float roll
the z rotation of the phone


tiltUp

public static boolean tiltUp
this var is TRUE when the phone has been tilted Up


tiltDown

public static boolean tiltDown
this var is TRUE when the phone has been tilted Down


tiltLeft

public static boolean tiltLeft
this var is TRUE when the phone has been tilted Left


tiltRight

public static boolean tiltRight
this var is TRUE when the phone has been tilted Right

Constructor Detail

MotionSensor

public MotionSensor()
Method Detail

initialize

public static void initialize(SensorManager newSensorManager)
Start the MotionSensor. This will be done by the GameEngine, game programmers do NOT have to this themselves!

Parameters:
newSensorManager -

handleOnResume

public static void handleOnResume(SensorEventListener listener)
DO NOT CALL THIS METHOD.

This method is called by the game engine to handle listening to sensor events.

Parameters:
listener -

handleOnPause

public static void handleOnPause(SensorEventListener listener)
DO NOT CALL THIS METHOD.

This method is called by the game engine to handle listening to sensor events.

Parameters:
listener -

handleSensorChange

public static void handleSensorChange(SensorEvent event)
DO NOT CALL THIS METHOD.

This method is called by the game engine to handle sensor events.

Parameters:
event -