Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XNA Keys number 1

Tags:

key

xna

I need to ask when the number 1 key is pressed, NOT on the Numpad, but the number 1 that is over the Q (trying to make this as clear as possible).

I've been through all the available keys on the Keys array, but no one matches the one that I am looking for.

Is there a way to do this that I'm missing?

My code:

If (currentKeyboardState.IsKeyDown(Keys.1))
like image 755
lucassperperato Avatar asked Aug 11 '12 19:08

lucassperperato


2 Answers

Should be the Keys.D1 key. The number keys are D0-D9. The documentation is here.

The documentation says: Used for miscellaneous characters; it can vary by keyboard.

like image 199
Fox32 Avatar answered Oct 23 '22 23:10

Fox32


To clarify: Keys.D1 works (e.g. Keys.D[insert number here]).

if (keyState.IsKeyDown(Keys.D4))
{
Console.WriteLine("You pressed the 4 key above E and R!");
}
like image 43
Apophis117 Avatar answered Oct 23 '22 23:10

Apophis117