Alternative Sources of User Input

  • Lee Stemkoski


In previous chapters, your games have been controlled with traditional desktop computer hardware: a keyboard and a mouse. In this chapter, you’ll explore two alternative sources of user input: gamepad controllers and touch-screen controls. If you do not have access to a gamepad with a USB connector (as discussed later in this chapter), you can still follow along; the code will still compile, and you’ll leave keyboard controls as a feedback (a good practice to consider in general for the convenience of your game’s players). Similarly, even if you don’t have access to device that’s touch-screen capable, learning about the associated design considerations is still worthwhile. Furthermore, touch events and mouse events are handled by the same methods in LibGDX; you can simulate single-touch input (but not multitouch input) with the mouse. On the other hand, if neither gamepad nor touch-based input is of interest to you, this entire chapter may be omitted without loss of continuity.


Controller Class Game World Discrete Input Public Void Mouse Event 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Supplementary material (22 mb) (zip 22564 kb)

Copyright information

© Lee Stemkoski 2015

Authors and Affiliations

  • Lee Stemkoski
    • 1
  1. 1.NYUS

Personalised recommendations