Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9 Programming Input Devices

CHAPTER 9
PROGRAMMING INPUT DEVICES

by Mike McShaffry

image

Even though user interface programming seems easy, it’s actually quite tricky, which is ironic since most game companies assign the user interface code to their greenest programmers. It’s a simple matter under almost any platform to read a keyboard, mouse, or gamepad. Most programmers take this input, like the X,Y coordinate of a mouse, and use it to directly modify the game state, such as where the player is looking in a first-person shooter. This technique works all too well until you want to do something like switch out that mouse for a USB gamepad or perhaps change how the controls are interpreted by the game. Maybe your player wants to switch the up/down or Y-axis of the camera controls from normal to inverted, like I prefer.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint