Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building your First Mobile Game using XNA 4.0

You're reading from   Building your First Mobile Game using XNA 4.0 A fast-paced, hands-on guide to building a 3D game for the Windows Phone 7 platform using XNA 4.0

Arrow left icon
Product type Paperback
Published in Jan 2013
Publisher Packt
ISBN-13 9781849687744
Length 158 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Thomas Goussaert Thomas Goussaert
Author Profile Icon Thomas Goussaert
Thomas Goussaert
Brecht Kets Brecht Kets
Author Profile Icon Brecht Kets
Brecht Kets
Arrow right icon
View More author details
Toc

Using keyboard


Sometimes it might be handy to have the player enter some text on the keyboard, for instance for entering the player name or the high score. Most Windows Phone 7 devices don't have a physical keyboard, so we will have to make an on-screen keyboard pop up. Luckily, this is very simple, as the static Guide class exposes this functionality. The Guide class has a static method BeginShowKeyboardInput . This method can be used to pop up the on screen keyboard. The fact that the method name starts with begin shows that it is an asynchronous method. This means the game keeps running the game loop cycles while the keyboard is visible. The method has six arguments:

  • The player index: This is because Windows Phone only supports one player, this will always be one.

  • The title of the dialog box.

  • The description of the dialog box.

  • The default text to show in the input text field.

  • The callback method that should be called when the operation is finished, by pressing the OK or Cancel button.

  • A state...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image