home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 August / GSSH0804.iso / Action / Parsec47 / Parsec47.exe / p47 / import / SDL_keysym.d < prev    next >
Text File  |  2003-11-29  |  7KB  |  309 lines

  1. /*
  2.     SDL - Simple DirectMedia Layer
  3.     Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public
  16.     License along with this library; if not, write to the Free
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19.     Sam Lantinga
  20.     slouken@devolution.com
  21. */
  22.  
  23. /* What we really want is a mapping of every raw key on the keyboard.
  24.    To support international keyboards, we use the range 0xA1 - 0xFF
  25.    as international virtual keycodes.  We'll follow in the footsteps of X11...
  26.    The names of the keys
  27.  */
  28.  
  29. alias int SDLKey;
  30. enum {
  31.     /* The keyboard syms have been cleverly chosen to map to ASCII */
  32.     SDLK_UNKNOWN        = 0,
  33.     SDLK_FIRST        = 0,
  34.     SDLK_BACKSPACE        = 8,
  35.     SDLK_TAB        = 9,
  36.     SDLK_CLEAR        = 12,
  37.     SDLK_RETURN        = 13,
  38.     SDLK_PAUSE        = 19,
  39.     SDLK_ESCAPE        = 27,
  40.     SDLK_SPACE        = 32,
  41.     SDLK_EXCLAIM        = 33,
  42.     SDLK_QUOTEDBL        = 34,
  43.     SDLK_HASH        = 35,
  44.     SDLK_DOLLAR        = 36,
  45.     SDLK_AMPERSAND        = 38,
  46.     SDLK_QUOTE        = 39,
  47.     SDLK_LEFTPAREN        = 40,
  48.     SDLK_RIGHTPAREN        = 41,
  49.     SDLK_ASTERISK        = 42,
  50.     SDLK_PLUS        = 43,
  51.     SDLK_COMMA        = 44,
  52.     SDLK_MINUS        = 45,
  53.     SDLK_PERIOD        = 46,
  54.     SDLK_SLASH        = 47,
  55.     SDLK_0            = 48,
  56.     SDLK_1            = 49,
  57.     SDLK_2            = 50,
  58.     SDLK_3            = 51,
  59.     SDLK_4            = 52,
  60.     SDLK_5            = 53,
  61.     SDLK_6            = 54,
  62.     SDLK_7            = 55,
  63.     SDLK_8            = 56,
  64.     SDLK_9            = 57,
  65.     SDLK_COLON        = 58,
  66.     SDLK_SEMICOLON        = 59,
  67.     SDLK_LESS        = 60,
  68.     SDLK_EQUALS        = 61,
  69.     SDLK_GREATER        = 62,
  70.     SDLK_QUESTION        = 63,
  71.     SDLK_AT            = 64,
  72.     /* 
  73.        Skip uppercase letters
  74.      */
  75.     SDLK_LEFTBRACKET    = 91,
  76.     SDLK_BACKSLASH        = 92,
  77.     SDLK_RIGHTBRACKET    = 93,
  78.     SDLK_CARET        = 94,
  79.     SDLK_UNDERSCORE        = 95,
  80.     SDLK_BACKQUOTE        = 96,
  81.     SDLK_a            = 97,
  82.     SDLK_b            = 98,
  83.     SDLK_c            = 99,
  84.     SDLK_d            = 100,
  85.     SDLK_e            = 101,
  86.     SDLK_f            = 102,
  87.     SDLK_g            = 103,
  88.     SDLK_h            = 104,
  89.     SDLK_i            = 105,
  90.     SDLK_j            = 106,
  91.     SDLK_k            = 107,
  92.     SDLK_l            = 108,
  93.     SDLK_m            = 109,
  94.     SDLK_n            = 110,
  95.     SDLK_o            = 111,
  96.     SDLK_p            = 112,
  97.     SDLK_q            = 113,
  98.     SDLK_r            = 114,
  99.     SDLK_s            = 115,
  100.     SDLK_t            = 116,
  101.     SDLK_u            = 117,
  102.     SDLK_v            = 118,
  103.     SDLK_w            = 119,
  104.     SDLK_x            = 120,
  105.     SDLK_y            = 121,
  106.     SDLK_z            = 122,
  107.     SDLK_DELETE        = 127,
  108.     /* End of ASCII mapped keysyms */
  109.  
  110.     /* International keyboard syms */
  111.     SDLK_WORLD_0        = 160,        /* 0xA0 */
  112.     SDLK_WORLD_1        = 161,
  113.     SDLK_WORLD_2        = 162,
  114.     SDLK_WORLD_3        = 163,
  115.     SDLK_WORLD_4        = 164,
  116.     SDLK_WORLD_5        = 165,
  117.     SDLK_WORLD_6        = 166,
  118.     SDLK_WORLD_7        = 167,
  119.     SDLK_WORLD_8        = 168,
  120.     SDLK_WORLD_9        = 169,
  121.     SDLK_WORLD_10        = 170,
  122.     SDLK_WORLD_11        = 171,
  123.     SDLK_WORLD_12        = 172,
  124.     SDLK_WORLD_13        = 173,
  125.     SDLK_WORLD_14        = 174,
  126.     SDLK_WORLD_15        = 175,
  127.     SDLK_WORLD_16        = 176,
  128.     SDLK_WORLD_17        = 177,
  129.     SDLK_WORLD_18        = 178,
  130.     SDLK_WORLD_19        = 179,
  131.     SDLK_WORLD_20        = 180,
  132.     SDLK_WORLD_21        = 181,
  133.     SDLK_WORLD_22        = 182,
  134.     SDLK_WORLD_23        = 183,
  135.     SDLK_WORLD_24        = 184,
  136.     SDLK_WORLD_25        = 185,
  137.     SDLK_WORLD_26        = 186,
  138.     SDLK_WORLD_27        = 187,
  139.     SDLK_WORLD_28        = 188,
  140.     SDLK_WORLD_29        = 189,
  141.     SDLK_WORLD_30        = 190,
  142.     SDLK_WORLD_31        = 191,
  143.     SDLK_WORLD_32        = 192,
  144.     SDLK_WORLD_33        = 193,
  145.     SDLK_WORLD_34        = 194,
  146.     SDLK_WORLD_35        = 195,
  147.     SDLK_WORLD_36        = 196,
  148.     SDLK_WORLD_37        = 197,
  149.     SDLK_WORLD_38        = 198,
  150.     SDLK_WORLD_39        = 199,
  151.     SDLK_WORLD_40        = 200,
  152.     SDLK_WORLD_41        = 201,
  153.     SDLK_WORLD_42        = 202,
  154.     SDLK_WORLD_43        = 203,
  155.     SDLK_WORLD_44        = 204,
  156.     SDLK_WORLD_45        = 205,
  157.     SDLK_WORLD_46        = 206,
  158.     SDLK_WORLD_47        = 207,
  159.     SDLK_WORLD_48        = 208,
  160.     SDLK_WORLD_49        = 209,
  161.     SDLK_WORLD_50        = 210,
  162.     SDLK_WORLD_51        = 211,
  163.     SDLK_WORLD_52        = 212,
  164.     SDLK_WORLD_53        = 213,
  165.     SDLK_WORLD_54        = 214,
  166.     SDLK_WORLD_55        = 215,
  167.     SDLK_WORLD_56        = 216,
  168.     SDLK_WORLD_57        = 217,
  169.     SDLK_WORLD_58        = 218,
  170.     SDLK_WORLD_59        = 219,
  171.     SDLK_WORLD_60        = 220,
  172.     SDLK_WORLD_61        = 221,
  173.     SDLK_WORLD_62        = 222,
  174.     SDLK_WORLD_63        = 223,
  175.     SDLK_WORLD_64        = 224,
  176.     SDLK_WORLD_65        = 225,
  177.     SDLK_WORLD_66        = 226,
  178.     SDLK_WORLD_67        = 227,
  179.     SDLK_WORLD_68        = 228,
  180.     SDLK_WORLD_69        = 229,
  181.     SDLK_WORLD_70        = 230,
  182.     SDLK_WORLD_71        = 231,
  183.     SDLK_WORLD_72        = 232,
  184.     SDLK_WORLD_73        = 233,
  185.     SDLK_WORLD_74        = 234,
  186.     SDLK_WORLD_75        = 235,
  187.     SDLK_WORLD_76        = 236,
  188.     SDLK_WORLD_77        = 237,
  189.     SDLK_WORLD_78        = 238,
  190.     SDLK_WORLD_79        = 239,
  191.     SDLK_WORLD_80        = 240,
  192.     SDLK_WORLD_81        = 241,
  193.     SDLK_WORLD_82        = 242,
  194.     SDLK_WORLD_83        = 243,
  195.     SDLK_WORLD_84        = 244,
  196.     SDLK_WORLD_85        = 245,
  197.     SDLK_WORLD_86        = 246,
  198.     SDLK_WORLD_87        = 247,
  199.     SDLK_WORLD_88        = 248,
  200.     SDLK_WORLD_89        = 249,
  201.     SDLK_WORLD_90        = 250,
  202.     SDLK_WORLD_91        = 251,
  203.     SDLK_WORLD_92        = 252,
  204.     SDLK_WORLD_93        = 253,
  205.     SDLK_WORLD_94        = 254,
  206.     SDLK_WORLD_95        = 255,        /* 0xFF */
  207.  
  208.     /* Numeric keypad */
  209.     SDLK_KP0        = 256,
  210.     SDLK_KP1        = 257,
  211.     SDLK_KP2        = 258,
  212.     SDLK_KP3        = 259,
  213.     SDLK_KP4        = 260,
  214.     SDLK_KP5        = 261,
  215.     SDLK_KP6        = 262,
  216.     SDLK_KP7        = 263,
  217.     SDLK_KP8        = 264,
  218.     SDLK_KP9        = 265,
  219.     SDLK_KP_PERIOD        = 266,
  220.     SDLK_KP_DIVIDE        = 267,
  221.     SDLK_KP_MULTIPLY    = 268,
  222.     SDLK_KP_MINUS        = 269,
  223.     SDLK_KP_PLUS        = 270,
  224.     SDLK_KP_ENTER        = 271,
  225.     SDLK_KP_EQUALS        = 272,
  226.  
  227.     /* Arrows + Home/End pad */
  228.     SDLK_UP            = 273,
  229.     SDLK_DOWN        = 274,
  230.     SDLK_RIGHT        = 275,
  231.     SDLK_LEFT        = 276,
  232.     SDLK_INSERT        = 277,
  233.     SDLK_HOME        = 278,
  234.     SDLK_END        = 279,
  235.     SDLK_PAGEUP        = 280,
  236.     SDLK_PAGEDOWN        = 281,
  237.  
  238.     /* Function keys */
  239.     SDLK_F1            = 282,
  240.     SDLK_F2            = 283,
  241.     SDLK_F3            = 284,
  242.     SDLK_F4            = 285,
  243.     SDLK_F5            = 286,
  244.     SDLK_F6            = 287,
  245.     SDLK_F7            = 288,
  246.     SDLK_F8            = 289,
  247.     SDLK_F9            = 290,
  248.     SDLK_F10        = 291,
  249.     SDLK_F11        = 292,
  250.     SDLK_F12        = 293,
  251.     SDLK_F13        = 294,
  252.     SDLK_F14        = 295,
  253.     SDLK_F15        = 296,
  254.  
  255.     /* Key state modifier keys */
  256.     SDLK_NUMLOCK        = 300,
  257.     SDLK_CAPSLOCK        = 301,
  258.     SDLK_SCROLLOCK        = 302,
  259.     SDLK_RSHIFT        = 303,
  260.     SDLK_LSHIFT        = 304,
  261.     SDLK_RCTRL        = 305,
  262.     SDLK_LCTRL        = 306,
  263.     SDLK_RALT        = 307,
  264.     SDLK_LALT        = 308,
  265.     SDLK_RMETA        = 309,
  266.     SDLK_LMETA        = 310,
  267.     SDLK_LSUPER        = 311,        /* Left "Windows" key */
  268.     SDLK_RSUPER        = 312,        /* Right "Windows" key */
  269.     SDLK_MODE        = 313,        /* "Alt Gr" key */
  270.     SDLK_COMPOSE        = 314,        /* Multi-key compose key */
  271.  
  272.     /* Miscellaneous function keys */
  273.     SDLK_HELP        = 315,
  274.     SDLK_PRINT        = 316,
  275.     SDLK_SYSREQ        = 317,
  276.     SDLK_BREAK        = 318,
  277.     SDLK_MENU        = 319,
  278.     SDLK_POWER        = 320,        /* Power Macintosh power key */
  279.     SDLK_EURO        = 321,        /* Some european keyboards */
  280.     SDLK_UNDO        = 322,        /* Atari keyboard has Undo */
  281.  
  282.     /* Add any other keys here */
  283.  
  284.     SDLK_LAST
  285. }
  286.  
  287. /* Enumeration of valid key mods (possibly OR'd together) */
  288. alias int SDLMod;
  289. enum {
  290.     KMOD_NONE  = 0x0000,
  291.     KMOD_LSHIFT= 0x0001,
  292.     KMOD_RSHIFT= 0x0002,
  293.     KMOD_LCTRL = 0x0040,
  294.     KMOD_RCTRL = 0x0080,
  295.     KMOD_LALT  = 0x0100,
  296.     KMOD_RALT  = 0x0200,
  297.     KMOD_LMETA = 0x0400,
  298.     KMOD_RMETA = 0x0800,
  299.     KMOD_NUM   = 0x1000,
  300.     KMOD_CAPS  = 0x2000,
  301.     KMOD_MODE  = 0x4000,
  302.     KMOD_RESERVED = 0x8000
  303. }
  304.  
  305. const uint KMOD_CTRL    = (KMOD_LCTRL|KMOD_RCTRL);
  306. const uint KMOD_SHIFT    = (KMOD_LSHIFT|KMOD_RSHIFT);
  307. const uint KMOD_ALT        = (KMOD_LALT|KMOD_RALT);
  308. const uint KMOD_META    = (KMOD_LMETA|KMOD_RMETA);
  309.