Chapter 4. Touch Input

WHAT'S IN THIS CHAPTER?

  • Understanding how to respond to touch events

  • Understanding the different types of touch inputs and gestures

  • Getting the proper layout of UI elements for touch-based interfaces

  • Interacting with the Soft Input Panel (SIP)

Touch input is a vital part of the Windows Phone 7 user experience, and the capability to support up to four simultaneous touch points offers a tremendous number of options for game development.

In this chapter, you will learn how to detect and respond to touch input in the form of simple taps and more-complex gestures. You will also learn how to create your own gestures. Also included in this chapter is an examination of some best practices to consider when designing your own touch-based games.

RESPONDING TO TOUCH EVENTS

Previously, one of the biggest hurdles in developing games for mobile devices was the inability to predict what type of hardware your mobile game would be running on. Being compatible with Windows Mobile was no guarantee. Some phones had two buttons on the front, and others had six spread all over the device.

With the introduction of Windows Phone 7, this problem has been largely eliminated. While Microsoft has allowed phone manufacturers some limited flexibility in the form factor, the overall experience is consistent and predictable from one device to the next.

Having to develop games for a device with only three buttons sounds rather limited — until you consider the touch screen. The touch screen offers tremendous ...

Get Professional Windows® Phone 7 Game Development: Creating Games using XNA Game Studio 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.