Keyboard
Last updated
Was this helpful?
Last updated
Was this helpful?
The Keyboard class provides functionality for getting input data from the physical keyboard. This class is automatically instantiated by and accessible through the . The Keyboard class is accessible both on a PC as well as on the Xbox 360.
There are many ways to get data from the keyboard. The following section of code is a series of if-statements which could be used to detect input from the keyboard. Add the following using statements:
In your CustomActivity method:
The Keyboard is commonly used to control objects like in-game characters and the . The following code can be used to quickly control any Add the following using statement:
Assuming positionedObject is a valid (or object inheriting from the class like a or ) add the following code in Update:
For more control over input controlling movement, see the following entry on .