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...