Sample Code - How to interact with touch gestures and the trackpad

by Retired ‎08-03-2010 11:29 AM - edited ‎09-20-2010 05:07 PM (10,797 Views)

The attached sample is intended for devices with touch screen and track pad only. The goal of the program is to demonstrate the touch gestures and interactions of track pad and touch screen gestures. The touch screen is used to control the target. The optical joystick is used to control a gauge that determines the speed with which a projectile is released at the target.  The release of the projectile is triggered by clicking the optical joystick or a track pad SWIPE_NORTH gesture. The program is intended to operate in Landscape mode only. The pinch gesture can be used to enlarge the target which will in turn increase the size of the projectile when fired.

 

The following files are provided:

 

•GameControlDemoMain.java:  The main program that sets up the GameDisplayScreen.

 

•GameDisplayScreen.java:  Intercepts the touch events from the track pad and the touch screen and provides a paint method to draw them on the screen.

 

•Projectile.java: Information pertaining to the projectile object including the speed and the trajectory.

 

•MeterGaugeControl.java: Information pertaining to the meter gauge that controls the speed of the projectile.