Key "code names"?
by Jason McIntosh · in Torque Game Builder · 03/30/2005 (10:47 pm) · 13 replies
Is there a listing of what the "names" of keys are in relation to, for example, the bind command? For instance,
Thanks!
GlobalActionMap.bind(keyboard, "tilde", ToggleConsole);What are the names of the other keys (like "tilde" in this example)? I'm specifically looking for the enter key on the keypad.
Thanks!
About the author
#2
03/30/2005 (11:14 pm)
{ "f1", SI_KEY, KEY_F1 },
{ "f2", SI_KEY, KEY_F2 },
{ "f3", SI_KEY, KEY_F3 },
{ "f4", SI_KEY, KEY_F4 },
{ "f5", SI_KEY, KEY_F5 },
{ "f6", SI_KEY, KEY_F6 },
{ "f7", SI_KEY, KEY_F7 },
{ "f8", SI_KEY, KEY_F8 },
{ "f9", SI_KEY, KEY_F9 },
{ "f10", SI_KEY, KEY_F10 },
{ "f11", SI_KEY, KEY_F11 },
{ "f12", SI_KEY, KEY_F12 },
{ "f13", SI_KEY, KEY_F13 },
{ "f14", SI_KEY, KEY_F14 },
{ "f15", SI_KEY, KEY_F15 },
{ "f16", SI_KEY, KEY_F16 },
{ "f17", SI_KEY, KEY_F17 },
{ "f18", SI_KEY, KEY_F18 },
{ "f19", SI_KEY, KEY_F19 },
{ "f20", SI_KEY, KEY_F20 },
{ "f21", SI_KEY, KEY_F21 },
{ "f22", SI_KEY, KEY_F22 },
{ "f23", SI_KEY, KEY_F23 },
{ "f24", SI_KEY, KEY_F24 },
{ "numlock", SI_KEY, KEY_NUMLOCK },
{ "scrolllock", SI_KEY, KEY_SCROLLLOCK },
#3
03/30/2005 (11:14 pm)
{ "lshift", SI_KEY, KEY_LSHIFT },
{ "rshift", SI_KEY, KEY_RSHIFT },
{ "lcontrol", SI_KEY, KEY_LCONTROL },
{ "rcontrol", SI_KEY, KEY_RCONTROL },
{ "lalt", SI_KEY, KEY_LALT },
{ "ralt", SI_KEY, KEY_RALT },
{ "tilde", SI_KEY, KEY_TILDE },
{ "minus", SI_KEY, KEY_MINUS },
{ "equals", SI_KEY, KEY_EQUALS },
{ "lbracket", SI_KEY, KEY_LBRACKET },
{ "rbracket", SI_KEY, KEY_RBRACKET },
{ "backslash", SI_KEY, KEY_BACKSLASH },
{ "semicolon", SI_KEY, KEY_SEMICOLON },
{ "apostrophe", SI_KEY, KEY_APOSTROPHE },
{ "comma", SI_KEY, KEY_COMMA },
{ "period", SI_KEY, KEY_PERIOD },
{ "slash", SI_KEY, KEY_SLASH },
{ "lessthan", SI_KEY, KEY_OEM_102 },
//-------------------------------------- BUTTON EVENTS
// Joystick/Mouse buttons
{ "button0", SI_BUTTON, KEY_BUTTON0 },
{ "button1", SI_BUTTON, KEY_BUTTON1 },
{ "button2", SI_BUTTON, KEY_BUTTON2 },
{ "button3", SI_BUTTON, KEY_BUTTON3 },
{ "button4", SI_BUTTON, KEY_BUTTON4 },
{ "button5", SI_BUTTON, KEY_BUTTON5 },
{ "button6", SI_BUTTON, KEY_BUTTON6 },
{ "button7", SI_BUTTON, KEY_BUTTON7 },
{ "button8", SI_BUTTON, KEY_BUTTON8 },
{ "button9", SI_BUTTON, KEY_BUTTON9 },
{ "button10", SI_BUTTON, KEY_BUTTON10 },
{ "button11", SI_BUTTON, KEY_BUTTON11 },
{ "button12", SI_BUTTON, KEY_BUTTON12 },
{ "button13", SI_BUTTON, KEY_BUTTON13 },
{ "button14", SI_BUTTON, KEY_BUTTON14 },
{ "button15", SI_BUTTON, KEY_BUTTON15 },
{ "button16", SI_BUTTON, KEY_BUTTON16 },
{ "button17", SI_BUTTON, KEY_BUTTON17 },
{ "button18", SI_BUTTON, KEY_BUTTON18 },
{ "button19", SI_BUTTON, KEY_BUTTON19 },
{ "button20", SI_BUTTON, KEY_BUTTON20 },
{ "button21", SI_BUTTON, KEY_BUTTON21 },
{ "button22", SI_BUTTON, KEY_BUTTON22 },
{ "button23", SI_BUTTON, KEY_BUTTON23 },
{ "button24", SI_BUTTON, KEY_BUTTON24 },
{ "button25", SI_BUTTON, KEY_BUTTON25 },
{ "button26", SI_BUTTON, KEY_BUTTON26 },
{ "button27", SI_BUTTON, KEY_BUTTON27 },
{ "button28", SI_BUTTON, KEY_BUTTON28 },
{ "button29", SI_BUTTON, KEY_BUTTON29 },
{ "button30", SI_BUTTON, KEY_BUTTON30 },
{ "button31", SI_BUTTON, KEY_BUTTON31 },
//-------------------------------------- MOVE EVENTS
// Mouse/Joystick axes:
{ "xaxis", SI_MOVE, SI_XAXIS },
{ "yaxis", SI_MOVE, SI_YAXIS },
{ "zaxis", SI_MOVE, SI_ZAXIS },
{ "rxaxis", SI_MOVE, SI_RXAXIS },
{ "ryaxis", SI_MOVE, SI_RYAXIS },
{ "rzaxis", SI_MOVE, SI_RZAXIS },
{ "slider", SI_MOVE, SI_SLIDER },
#4
Hope that helps.
03/30/2005 (11:15 pm)
//-------------------------------------- POV EVENTS
// Joystick POV:
{ "xpov", SI_POV, SI_XPOV },
{ "ypov", SI_POV, SI_YPOV },
{ "upov", SI_POV, SI_UPOV },
{ "dpov", SI_POV, SI_DPOV },
{ "lpov", SI_POV, SI_LPOV },
{ "rpov", SI_POV, SI_RPOV },
{ "xpov2", SI_POV, SI_XPOV2 },
{ "ypov2", SI_POV, SI_YPOV2 },
{ "upov2", SI_POV, SI_UPOV2 },
{ "dpov2", SI_POV, SI_DPOV2 },
{ "lpov2", SI_POV, SI_LPOV2 },
{ "rpov2", SI_POV, SI_RPOV2 },
//-------------------------------------- MISCELLANEOUS EVENTS
//
{ "anykey", SI_KEY, KEY_ANYKEY },
{ "nomatch", SI_UNKNOWN, 0xFFFFFFFF }
};Hope that helps.
#5
03/30/2005 (11:16 pm)
Ah, THANK YOU! I was digging through the code for the past 20 minutes trying to find that.
#6
I like how there is literally an anykey in TAP. ;)
03/31/2005 (12:47 am)
Yeah, pretty much what's in actionmap.cc is what you want to use.I like how there is literally an anykey in TAP. ;)
#7
I'm using:
If change the key from "ctrl" to "a" then it all works as expected.
03/31/2005 (1:26 am)
I've got a minor problem with using the CTRL key as an 'action' key though. I think T2D keeps thinking it's a modifier key (as in CTRL + something else) rather than a key press in its own right.I'm using:
PlayerMap.bindCmd(keyboard, "ctrl", "playerFire();", "playerFireStop();");
If change the key from "ctrl" to "a" then it all works as expected.
#10
03/31/2005 (4:26 am)
The "anykey" binding is any key that isn't already mapped. Makes perfect sense, but it drove me crazy during splash screen testing when I kept hitting the Enter key and nothing was happening :-) Multiple actionmaps was the solution, but I almost changed it to "Hit almost any key to continue" :-)
#11
03/31/2005 (6:00 am)
Yeah I found the same thing out with another language. The anykey is useful though. Like terry said
#12
03/31/2005 (7:25 am)
All else fails, look at the source :)
#13
03/31/2005 (12:33 pm)
Quote:Haha, I'd love to see that in a game =)
but I almost changed it to "Hit almost any key to continue"
Torque Owner Lennart Steinke
But you can take a look at the source of engine/sim/actionMap.cc pretty near the end you'll find this:
CodeMapping gVirtualMap[] = { //-------------------------------------- KEYBOARD EVENTS // { "backspace", SI_KEY, KEY_BACKSPACE }, { "tab", SI_KEY, KEY_TAB }, { "return", SI_KEY, KEY_RETURN }, { "enter", SI_KEY, KEY_RETURN }, { "shift", SI_KEY, KEY_SHIFT }, { "ctrl", SI_KEY, KEY_CONTROL }, { "alt", SI_KEY, KEY_ALT }, { "pause", SI_KEY, KEY_PAUSE }, { "capslock", SI_KEY, KEY_CAPSLOCK }, { "escape", SI_KEY, KEY_ESCAPE }, { "space", SI_KEY, KEY_SPACE }, { "pagedown", SI_KEY, KEY_PAGE_DOWN }, { "pageup", SI_KEY, KEY_PAGE_UP }, { "end", SI_KEY, KEY_END }, { "home", SI_KEY, KEY_HOME }, { "left", SI_KEY, KEY_LEFT }, { "up", SI_KEY, KEY_UP }, { "right", SI_KEY, KEY_RIGHT }, { "down", SI_KEY, KEY_DOWN }, { "print", SI_KEY, KEY_PRINT }, { "insert", SI_KEY, KEY_INSERT }, { "delete", SI_KEY, KEY_DELETE }, { "help", SI_KEY, KEY_HELP }, { "win_lwindow", SI_KEY, KEY_WIN_LWINDOW }, { "win_rwindow", SI_KEY, KEY_WIN_RWINDOW }, { "win_apps", SI_KEY, KEY_WIN_APPS }, { "cmd", SI_KEY, KEY_ALT }, { "opt", SI_KEY, KEY_MAC_OPT }, { "lopt", SI_KEY, KEY_MAC_LOPT }, { "ropt", SI_KEY, KEY_MAC_ROPT }, { "numpad0", SI_KEY, KEY_NUMPAD0 }, { "numpad1", SI_KEY, KEY_NUMPAD1 }, { "numpad2", SI_KEY, KEY_NUMPAD2 }, { "numpad3", SI_KEY, KEY_NUMPAD3 }, { "numpad4", SI_KEY, KEY_NUMPAD4 }, { "numpad5", SI_KEY, KEY_NUMPAD5 }, { "numpad6", SI_KEY, KEY_NUMPAD6 }, { "numpad7", SI_KEY, KEY_NUMPAD7 }, { "numpad8", SI_KEY, KEY_NUMPAD8 }, { "numpad9", SI_KEY, KEY_NUMPAD9 }, { "numpadmult", SI_KEY, KEY_MULTIPLY }, { "numpadadd", SI_KEY, KEY_ADD }, { "numpadsep", SI_KEY, KEY_SEPARATOR }, { "numpadminus", SI_KEY, KEY_SUBTRACT }, { "numpaddecimal", SI_KEY, KEY_DECIMAL }, { "numpaddivide", SI_KEY, KEY_DIVIDE }, { "numpadenter", SI_KEY, KEY_NUMPADENTER },