Abstract
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 touchscreen controls. In particular, you will add these alternative sources of user input to the Starfish Collector game that has been featured in previous chapters. 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 fallback (a good practice to consider in general for the convenience of your game’s players). Similarly, even if you don’t have access to a device that’s touchscreen 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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
The control element typically referred to as a directional pad was referred to as a point-of-view control in traditional flight simulators, which explains the use of the POV acronym in the LibGDX source code.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2018 Lee Stemkoski
About this chapter
Cite this chapter
Stemkoski, L. (2018). Alternative Sources of User Input. In: Java Game Development with LibGDX. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3324-5_13
Download citation
DOI: https://doi.org/10.1007/978-1-4842-3324-5_13
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3323-8
Online ISBN: 978-1-4842-3324-5
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)