Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Handling input from an Xbox 360 controller


Having been sold together with millions of Xbox 360 game consoles, the Xbox 360 controller is one of the most widespread and well-known types of input devices for gamers. But it is not only console gamers who are able to use this kind of controller as it can easily be plugged into a Windows PC too. Apart from the device being recognized by the operating system, many PC games are officially supporting the Xbox 360 controller as a possible input device.

In case you want to create a game with support for this gamepad, this recipe is for you. But also if you intend to support any other type of joystick or game controller you will find interesting resources ahead because the API you are going to use is not bound to any device in particular. Nonetheless, this recipe will show you how to read data from the Xbox 360 controller's analog sticks and buttons, and will provide you with a minimal class that maps the raw button and axis indices to more meaningfully...