December 2011
Beginner
693 pages
19h 56m
English
Using a couple of convenient methods, the Input interface we designed in Chapter 3 grants us access to the accelerometer, the touchscreen, and the keyboard in polling and event modes. The idea of putting all the code for an implementation of that interface into a single file is a bit nasty, so we outsource all the input event handling to handler classes. The Input implementation will use those handlers to pretend that it is actually performing all the work.
Let's start with the easiest of all handlers, the AccelerometerHandler. Listing 5–5 shows you its code.
Listing 5–5. AccelerometerHandler.java; Performing All the Accelerometer Handling
package com.badlogic.androidgames.framework.impl; ...Read now
Unlock full access