O'Reilly logo

Libgdx Cross-platform Game Development Cookbook by Alberto Cejas Sánchez, David Saltares Márquez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Input mapping for cross-platform development

Managing inputs in a relatively complex game that targets several platforms with different peripherals can become a massive headache. Keys, touch, mouse, gestures, analog sticks, on-screen sticks, and so on, the variety is just too overwhelming, not to mention that controllers by different manufacturers do not have the same button codes. Sometimes, device codes vary even across platforms!

Without an additional system to aid us in user-input issues, the game's logic code will become a sea of conditional blocks to handle each possibility.

Quite rapidly, an additional layer becomes imperative to spare us the need to worry about which user input peripheral is currently being used and to gain a few years of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required