| Poster | : nanodeath | | Posts | : 3 | | Country | : USA | | City | : Seattle |
| | | | Posted by nanodeath on 09/08/2007 at 13:05:19
| | Hey Riemers,
I was going through this tutorial and I was sure there was a better, more XNA-ish way of handling keyboard input. And sure enough, there is -- and it's super easy! Here's what I changed since the last chapter to get keyboard input:
Create class variable KeyboardState keyboardState.
In Update(), add keyboardState = Keyboard.GetState(), and then call ReadKeyboard().
In ReadKeyboard(), define the following code: if(keyboardState.IsKeyDown(Keys.Delete))
{
angle += 0.03f;
} if(keyboardState.IsKeyDown(Keys.Insert))
{
angle -= 0.03f;
}
And a couple other things you had in your tutorial, but that's it. No new references or renaming. | |
|
|