Game Development Reference
In-Depth Information
public boolean
isKeyPressed(
int
keyCode) {
return
keyHandler.isKeyPressed(keyCode);
}
public boolean
isTouchDown(
int
pointer) {
return
touchHandler.isTouchDown(pointer);
}
public int
getTouchX(
int
pointer) {
return
touchHandler.getTouchX(pointer);
}
public int
getTouchY(
int
pointer) {
return
touchHandler.getTouchY(pointer);
}
public float
getAccelX() {
return
accelHandler.getAccelX();
}
public float
getAccelY() {
return
accelHandler.getAccelY();
}
public float
getAccelZ() {
return
accelHandler.getAccelZ();
}
public
List<TouchEvent>getTouchEvents() {
return
touchHandler.getTouchEvents();
}
public
List<KeyEvent>getKeyEvents() {
return
keyHandler.getKeyEvents();
}
}
The rest of this class is self-explanatory. Each method call is delegated to the appropriate
handler, which does the actual work. With this, we have finished the input API of our game
framework. Next, we'll discuss graphics.
AndroidGraphics and AndroidPixmap: Double Rainbow
It's time to get back to our most beloved topic, graphics programming. In Chapter 3, we defined
two interfaces called
Graphics
and
Pixmap
. Now, we're going to implement them based on what
you learned in Chapter 4. However, there's one thing we have yet to consider: how to handle
different screen sizes and resolutions.