This project is read-only.
How to Use the Keyboard Controller class

The keyboard Controller class is much like the Xbox Controller class. It is meant to make input easier however it is diffrent in one major way. In stead of having functions for each button on the keyboard each instance of the class is meant to handle 1 button.

Create an instance of the KeyboardControl Class

KeyboardControl myKeyboardControl = new KeyboardControl(Keys.Left)

this will create a new keyboard control that is bound to the left arrow key.

also like the XboxController we have to call the Update() function in order for the object to do us any good.

so in your games update function add the following code.


now our control is ready to be used. In your initialize function after you have instantiated the control you need to bind the function events. You do this by adding this line of code:

myKeyboardControl.Pressed += myFunction;

Other Properties

IsControlPressed - Boolean - this values tells whether or not the control is currently pressed.

Last edited Jul 24, 2010 at 3:08 AM by Aeal, version 1


No comments yet.