O'Reilly logo

Developing Mobile Games with Moai SDK by Francisco Tufro

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

The next step in our journey is to add input handling. We have to create a file called input_manager.lua; it will be in charge of listening to input events and will be queried by our game when needed. We will create it so that it will be usable with both mouse devices and touchscreens.

Note

Generally speaking, all hosts are supposed to implement their own input schema. We won't see this in detail in this book, but so you understand where this comes from, take a look at the hosts that are shipped with Moai SDK.

Search for all the references to the AKUReserveInputDevice* and AKUSetInputDevice* method calls in moai-sdk/hosts/src/GlutHost.cpp.

We'll now inspect only the most important methods; please take a look at the full code in order to understand ...

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