android.gameengine.icadroids.input
Class TouchInput

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

public class TouchInput
extends java.lang.Object

TouchInput class that sets and handles the input and put the result in easy-to-use flags. Each flag can statically be accessed, they hold the values. Do not instantiate this class yourself, all you need are the static values.

Author:
Roel

Field Summary
static int fingerCount
          the number of touches in this multiple touch event
static int maxFingers
          Change this value to increase the amount of fingers you can use. defaults to 10.
static boolean onPress
          TRUE when device receives input ; FALSE otherwise
static boolean onRelease
          TRUE when device has no input/or loses input(ex: user removes his finger)
static boolean pinch
          TRUE when space between two fingers decreases.
static float scale
          gets the scaling factor that applies on zoom and pinch actions
static boolean use
          Wether or not you want to use the touch input or not , set this flag to true if you want to use it.
static float[] xPointer
          Use this when you want to check the locations of multiple touches.
static float xPos
          The X position of the point where the user touches the screen.
static float[] yPointer
          the Y value of multiple touches.
static float yPos
          The Y position of the point where the user touches the screen.
static boolean zoom
          TRUE when space between two fingers increase.
 
Constructor Summary
TouchInput()
           
 
Method Summary
 boolean onTouch(View v, MotionEvent event)
          DO NOT CALL THIS FUNCTION.
 
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
Wether or not you want to use the touch input or not , set this flag to true if you want to use it. Note that only one touch Listener may be active at the time.


maxFingers

public static int maxFingers
Change this value to increase the amount of fingers you can use. defaults to 10.


onPress

public static boolean onPress
TRUE when device receives input ; FALSE otherwise


onRelease

public static boolean onRelease
TRUE when device has no input/or loses input(ex: user removes his finger)


xPos

public static float xPos
The X position of the point where the user touches the screen. This position may be different from the position in the game world when using a viewport and zooming. Use GameEngine.translateToGamePosition to calculate the game position from the screen position.

See Also:
GameEngine.translateToGamePosition(float, float)

yPos

public static float yPos
The Y position of the point where the user touches the screen. This position may be different from the position in the game world when using a viewport and zooming. Use GameEngine.translateToGamePosition to calculate the game position from the screen position.

See Also:
GameEngine.translateToGamePosition(float, float)

zoom

public static boolean zoom
TRUE when space between two fingers increase.


pinch

public static boolean pinch
TRUE when space between two fingers decreases.


scale

public static float scale
gets the scaling factor that applies on zoom and pinch actions


xPointer

public static float[] xPointer
Use this when you want to check the locations of multiple touches. xPointer[0] is the first finger, xPointer[1] is the second etc.


yPointer

public static float[] yPointer
the Y value of multiple touches.


fingerCount

public static int fingerCount
the number of touches in this multiple touch event

Constructor Detail

TouchInput

public TouchInput()
Method Detail

onTouch

public boolean onTouch(View v,
                       MotionEvent event)
DO NOT CALL THIS FUNCTION.
This is the standard function android provides for touch events. That is, Android calls this function to inform the game about the status of the touch screen.
This class checks for the static values he need to change.

Parameters:
v - the View that android requires
event - the event that this function catches.