fysxasteroids/engine/keytable.h

167 lines
3.7 KiB
C
Raw Permalink Normal View History

2010-04-05 23:38:59 +02:00
#ifndef KEYTABLE_H
#define KEYTABLE_H
#include <SDL/SDL.h>
/** \brief Defines the key codes for mouse buttons
*
* With this enum we can treat mouse button events the same way as we treat
* keyboard events. To do so we define the left button as the last keyboard
* button.
*/
enum MouseButton {
MouseButtonUnknown = SDLK_LAST,
MouseButtonLeft,
MouseButtonMiddle,
MouseButtonRight,
MouseButtonWheelUp,
MouseButtonWheelDown,
MouseButtonLast
};
struct key_definition {
int keynum;
const char *keystr;
};
const int keytable_last = MouseButtonLast;
static const key_definition key_table[] = {
{SDLK_BACKSPACE, "backspace"},
{SDLK_TAB, "tab"},
// {SDLK_CLEAR, "12"},
{SDLK_RETURN, "return"},
{SDLK_PAUSE, "pause"},
{SDLK_ESCAPE, "escape"},
{SDLK_SPACE, "space"},
{SDLK_EXCLAIM, "exclaim"},
// {SDLK_QUOTEDBL, ""},
{SDLK_HASH, "#"},
{SDLK_DOLLAR, "$"},
{SDLK_AMPERSAND, "&"},
// {SDLK_QUOTE, "39"},
// {SDLK_LEFTPAREN, "("},
// {SDLK_RIGHTPAREN, ")"},
// {SDLK_ASTERISK, "*"},
{SDLK_PLUS, "+"},
{SDLK_COMMA, ","},
{SDLK_MINUS, "-"},
{SDLK_PERIOD, "."},
{SDLK_SLASH, "/"},
{SDLK_0, "0"},
{SDLK_1, "1"},
{SDLK_2, "2"},
{SDLK_3, "3"},
{SDLK_4, "4"},
{SDLK_5, "5"},
{SDLK_6, "6"},
{SDLK_7, "7"},
{SDLK_8, "8"},
{SDLK_9, "9"},
{SDLK_COLON, ":"},
{SDLK_SEMICOLON, ";"},
{SDLK_LESS, "<"},
{SDLK_EQUALS, "="},
{SDLK_GREATER, ">"},
{SDLK_QUESTION, "?"},
{SDLK_AT, "@"},
{SDLK_LEFTBRACKET, "["},
{SDLK_BACKSLASH, "\\"},
{SDLK_RIGHTBRACKET, "]"},
{SDLK_CARET, "^"},
{SDLK_UNDERSCORE, "_"},
{SDLK_BACKQUOTE, "`"},
{SDLK_a, "a"},
{SDLK_b, "b"},
{SDLK_c, "c"},
{SDLK_d, "d"},
{SDLK_e, "e"},
{SDLK_f, "f"},
{SDLK_g, "g"},
{SDLK_h, "h"},
{SDLK_i, "i"},
{SDLK_j, "j"},
{SDLK_k, "k"},
{SDLK_l, "l"},
{SDLK_m, "m"},
{SDLK_n, "n"},
{SDLK_o, "o"},
{SDLK_p, "p"},
{SDLK_q, "q"},
{SDLK_r, "r"},
{SDLK_s, "s"},
{SDLK_t, "t"},
{SDLK_u, "u"},
{SDLK_v, "v"},
{SDLK_w, "w"},
{SDLK_x, "x"},
{SDLK_y, "y"},
{SDLK_z, "z"},
{SDLK_KP0, "keypad_0"},
{SDLK_KP1, "keypad_1"},
{SDLK_KP2, "keypad_2"},
{SDLK_KP3, "keypad_3"},
{SDLK_KP4, "keypad_4"},
{SDLK_KP5, "keypad_5"},
{SDLK_KP6, "keypad_6"},
{SDLK_KP7, "keypad_7"},
{SDLK_KP8, "keypad_8"},
{SDLK_KP9, "keypad_9"},
{SDLK_KP_PERIOD, "keypad_period"},
{SDLK_KP_DIVIDE, "keypad_devide"},
{SDLK_KP_MULTIPLY, "keypad_multiply"},
{SDLK_KP_MINUS, "keypad_minus"},
{SDLK_KP_PLUS, "keypad_plus"},
{SDLK_KP_ENTER, "keypad_enter"},
{SDLK_KP_EQUALS, "keypad_equals"},
{SDLK_UP, "up"},
{SDLK_DOWN, "down"},
{SDLK_RIGHT, "right"},
{SDLK_LEFT, "left"},
{SDLK_INSERT, "insert"},
{SDLK_HOME, "home"},
{SDLK_END, "end"},
{SDLK_PAGEUP, "pageup"},
{SDLK_PAGEDOWN, "pagedown"},
{SDLK_F1, "f1"},
{SDLK_F2, "f2"},
{SDLK_F3, "f3"},
{SDLK_F4, "f4"},
{SDLK_F5, "f5"},
{SDLK_F6, "f6"},
{SDLK_F7, "f7"},
{SDLK_F8, "f8"},
{SDLK_F9, "f9"},
{SDLK_F10, "f10"},
{SDLK_F11, "f11"},
{SDLK_F12, "f12"},
{SDLK_F13, "f13"},
{SDLK_F14, "f14"},
{SDLK_F15, "f15"},
{SDLK_NUMLOCK, "numlock"},
{SDLK_CAPSLOCK, "capslock"},
{SDLK_SCROLLOCK, "scrollock"},
{SDLK_RSHIFT, "right_shift"},
{SDLK_LSHIFT, "left_shift"},
{SDLK_RCTRL, "right_ctrl"},
{SDLK_LCTRL, "left_ctrl"},
{SDLK_RALT, "right_alt"},
{SDLK_LALT, "left_alt"},
{SDLK_RMETA, "right_meta"},
{SDLK_LMETA, "left_meta"},
{SDLK_LSUPER, "left_super"}, /* Left "Windows" key */
{SDLK_RSUPER, "right_super"}, /* Right "Windows" key */
{SDLK_MODE, "altgr"}, /* "Alt Gr" key */
{SDLK_COMPOSE, "compose"}, /* Multi-key compose key */
{SDLK_DELETE, "delete"},
{MouseButtonLeft, "mouse_left"},
{MouseButtonMiddle, "mouse_middle"},
{MouseButtonRight, "mouse_right"},
{MouseButtonWheelUp, "mouse_wheelup"},
{MouseButtonWheelDown, "mouse_wheeldown"},
{keytable_last, NULL}
};
#endif /* KEYTABLE_H */