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 keyboard and mouse input


With the exception of karaoke and guitar games like Rock Band or Guitar Hero, it is generally a pretty bad idea to require a specialized controller or other input device for a video game. So, unless you have the marketing budget for advertising your new and special controller, you should always opt to use the most common and most widely available devices.

On consoles you would therefore aim for the standard gamepad, while the most widespread input measure for PC games is a combination of keyboard and mouse. Because Panda3D is targeted towards PC game production, in this example, you will learn how to handle input data received from the latter input method.

Getting ready

This recipe will of course be using our standard application skeleton that we created in the first chapter. Additionally, we will reuse the FollowCam class from the recipe Making the camera smoothly follow an object in Chapter 2, Creating and Building Scenes. Be sure to implement that class...