Răsfoiți Sursa

Merge branch 'master' of github.com:taylor001/crown

Daniele Bartolini 10 ani în urmă
părinte
comite
987e7f5845
6 a modificat fișierele cu 330 adăugiri și 289 ștergeri
  1. 17 11
      docs/lua_api.txt
  2. 13 1
      docs/style.css
  3. 94 90
      src/input/input_types.h
  4. 89 79
      src/lua/lua_input.cpp
  5. 89 80
      src/main/main_linux.cpp
  6. 28 28
      src/main/main_windows.cpp

+ 17 - 11
docs/lua_api.txt

@@ -793,7 +793,13 @@ Keyboard
 Keyboard Button Names
 ~~~~~~~~~~~~~~~~~~~~~
 
-	tab, enter, escape, space, backspace, kp_0, kp_1, kp_2, kp_3, kp_4, kp_5, kp_6, kp_7, kp_8, kp_9, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, home, left, up, right, down, page_up, page_down, lcontrol, rcontrol, lshift, rshift, caps_lock, lalt, ralt, lsuper, rsuper, num_0, num_1, num_2, num_3, num_4, num_5, num_6, num_7, num_8, num_9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
+	* ``tab``, ``enter``, ``escape``, ``space``, ``backspace``
+	* ``num_lock``, ``numpad_enter``, ``numpad_.``, ``numpad_*``, ``numpad_+``, ``numpad_-``, ``numpad_/``, ``numpad_0``, ``numpad_1``, ``numpad_2``, ``numpad_3``, ``numpad_4``, ``numpad_5``, ``numpad_6``, ``numpad_7``, ``numpad_8``, ``numpad_9``
+	* ``f1``, ``f2``, ``f3``, ``f4``, ``f5``, ``f6``, ``f7``, ``f8``, ``f9``, ``f10``, ``f11``, ``f12``
+	* ``home``, ``left``, ``up``, ``right``, ``down``, ``page_up``, ``page_down``, ``delete``, ``end``
+	* ``left_ctrl``, ``right_ctrl``, ``left_shift``, ``right_shift``, ``caps_lock``, ``left_alt``, ``right_alt``, ``left_super``, ``right_super``
+	* ``0``, ``1``, ``2``, ``3``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``
+	* ``a``, ``b``, ``c``, ``d``, ``e``, ``f``, ``g``, ``h``, ``i``, ``j``, ``k``, ``l``, ``m``, ``n``, ``o``, ``p``, ``q``, ``r``, ``s``, ``t``, ``u``, ``v``, ``w``, ``x``, ``y``, ``z``
 
 Mouse
 -----
@@ -836,14 +842,14 @@ Mouse
 Mouse Button Names
 ~~~~~~~~~~~~~~~~~~
 
-	left, middle, right, extra_1, extra_2
+	``left``, ``middle``, ``right``, ``extra_1``, ``extra_2``
 
 Mouse Axis Names
 ~~~~~~~~~~~~~~~~
 
-	* cursor: Returns the cursor position (x, y) in screen coordinates.
-	* cursor_delta: Returns the delta of the cursor position (x, y) since last frame.
-	* wheel: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.
+	* ``cursor``: Returns the cursor position (x, y) in screen coordinates.
+	* ``cursor_delta``: Returns the delta of the cursor position (x, y) since last frame.
+	* ``wheel``: Returns the movement of the mouse wheel in the y axis. Positive values of y mean upward scrolling, negative values mean downward scrolling.
 
 Touch
 -----
@@ -917,16 +923,16 @@ Pad1, Pad2, Pad3, Pad4
 Pad Button Names
 ~~~~~~~~~~~~~~~~
 
-	* up, down, left, right
-	* start, back, guide
-	* left_thumb, right_thumb
-	* left_shoulder, right_shoulder
-	* a, b, x, y
+	* ``up``, ``down``, ``left``, ``right``
+	* ``start``, ``back``, ``guide``
+	* ``left_thumb``, ``right_thumb``
+	* ``left_shoulder``, ``right_shoulder``
+	* ``a``, ``b``, ``x``, ``y``
 
 Pad Axis Names
 ~~~~~~~~~~~~~~
 
-	* left, right: Returns the direction (x, y) of the left or right thumbstick [-1; +1]. The z component represents the left or right trigger [0; +1].
+	* ``left``, ``right``: Returns the direction (x, y) of the left or right thumbstick [-1; +1]. The z component represents the left or right trigger [0; +1].
 
 Window
 ======

+ 13 - 1
docs/style.css

@@ -5,11 +5,23 @@
 
 @import url(html4css1.css);
 
-* {
+.document {
 	font-family: sans-serif;
+	font-size: 11pt;
+	line-height: 145%;
+	color: #141414;
 }
 
 div.topic {
 	border: 1px solid #aaa;
 	background-color: #f9f9f9;
 }
+
+tt.literal {
+	background-color: #fafafa;
+	border-radius: 2px;
+	border-width: 1px;
+	border-style: solid;
+	border-color: #e7e7e7;
+	padding: 1px 7px 1px 7px;
+}

+ 94 - 90
src/input/input_types.h

@@ -20,102 +20,106 @@ struct KeyboardButton
 {
 	enum Enum
 	{
-		TAB       = 0x09,
-		ENTER     = 0x0d,
-		ESCAPE    = 0x1b,
-		SPACE     = 0x20,
-		BACKSPACE = 0x7f,
-
-		/* KeyPad */
-		KP_0      = 0x80,
-		KP_1      = 0x81,
-		KP_2      = 0x82,
-		KP_3      = 0x83,
-		KP_4      = 0x84,
-		KP_5      = 0x85,
-		KP_6      = 0x86,
-		KP_7      = 0x87,
-		KP_8      = 0x88,
-		KP_9      = 0x89,
+		TAB,
+		ENTER,
+		ESCAPE,
+		SPACE,
+		BACKSPACE,
+
+		/* Numpad */
+		NUM_LOCK,
+		NUMPAD_ENTER,
+		NUMPAD_DELETE,
+		NUMPAD_MULTIPLY,
+		NUMPAD_ADD,
+		NUMPAD_SUBTRACT,
+		NUMPAD_DIVIDE,
+		NUMPAD_0,
+		NUMPAD_1,
+		NUMPAD_2,
+		NUMPAD_3,
+		NUMPAD_4,
+		NUMPAD_5,
+		NUMPAD_6,
+		NUMPAD_7,
+		NUMPAD_8,
+		NUMPAD_9,
 
 		/* Function keys */
-		F1        = 0x90,
-		F2        = 0x91,
-		F3        = 0x92,
-		F4        = 0x93,
-		F5        = 0x94,
-		F6        = 0x95,
-		F7        = 0x96,
-		F8        = 0x97,
-		F9        = 0x98,
-		F10       = 0x99,
-		F11       = 0x9a,
-		F12       = 0x9b,
+		F1,
+		F2,
+		F3,
+		F4,
+		F5,
+		F6,
+		F7,
+		F8,
+		F9,
+		F10,
+		F11,
+		F12,
 
 		/* Other keys */
-		HOME      = 0xa0,
-		LEFT      = 0xa1,
-		UP        = 0xa2,
-		RIGHT     = 0xa3,
-		DOWN      = 0xa4,
-		PAGE_UP   = 0xa5,
-		PAGE_DOWN = 0xa6,
+		HOME,
+		LEFT,
+		UP,
+		RIGHT,
+		DOWN,
+		PAGE_UP,
+		PAGE_DOWN,
+		DELETE,
+		END,
 
 		/* Modifier keys */
-		LCONTROL  = 0xb0,
-		RCONTROL  = 0xb1,
-		LSHIFT    = 0xb2,
-		RSHIFT    = 0xb3,
-		CAPS_LOCK = 0xb4,
-		LALT      = 0xb5,
-		RALT      = 0xb6,
-		LSUPER    = 0xb7,
-		RSUPER    = 0xb8,
-
-		/* [0x30, 0x39] reserved for ASCII digits */
-		NUM_0     = 0x30,
-		NUM_1     = 0x31,
-		NUM_2     = 0x32,
-		NUM_3     = 0x33,
-		NUM_4     = 0x34,
-		NUM_5     = 0x35,
-		NUM_6     = 0x36,
-		NUM_7     = 0x37,
-		NUM_8     = 0x38,
-		NUM_9     = 0x39,
-
-		/* [0x41, 0x5a] reserved for ASCII alphabet */
-		A         = 0x41,
-		B         = 0x42,
-		C         = 0x43,
-		D         = 0x44,
-		E         = 0x45,
-		F         = 0x46,
-		G         = 0x47,
-		H         = 0x48,
-		I         = 0x49,
-		J         = 0x4a,
-		K         = 0x4b,
-		L         = 0x4c,
-		M         = 0x4d,
-		N         = 0x4e,
-		O         = 0x4f,
-		P         = 0x50,
-		Q         = 0x51,
-		R         = 0x52,
-		S         = 0x53,
-		T         = 0x54,
-		U         = 0x55,
-		V         = 0x56,
-		W         = 0x57,
-		X         = 0x58,
-		Y         = 0x59,
-		Z         = 0x5a,
-
-		/* [0x61, 0x7a] reserved for ASCII alphabet */
-
-		// The last key _must_ be <= 0xff
-		COUNT     = 0xff
+		LEFT_CTRL,
+		RIGHT_CTRL,
+		LEFT_SHIFT,
+		RIGHT_SHIFT,
+		CAPS_LOCK,
+		LEFT_ALT,
+		RIGHT_ALT,
+		LEFT_SUPER,
+		RIGHT_SUPER,
+
+		NUMBER_0,
+		NUMBER_1,
+		NUMBER_2,
+		NUMBER_3,
+		NUMBER_4,
+		NUMBER_5,
+		NUMBER_6,
+		NUMBER_7,
+		NUMBER_8,
+		NUMBER_9,
+
+		A,
+		B,
+		C,
+		D,
+		E,
+		F,
+		G,
+		H,
+		I,
+		J,
+		K,
+		L,
+		M,
+		N,
+		O,
+		P,
+		Q,
+		R,
+		S,
+		T,
+		U,
+		V,
+		W,
+		X,
+		Y,
+		Z,
+
+		COUNT
 	};
 };
 

+ 89 - 79
src/lua/lua_input.cpp

@@ -20,86 +20,96 @@ struct KeyboardButtonInfo
 
 static KeyboardButtonInfo s_keyboard_button[] =
 {
-	{ "tab",       KeyboardButton::TAB       },
-	{ "enter",     KeyboardButton::ENTER     },
-	{ "escape",    KeyboardButton::ESCAPE    },
-	{ "space",     KeyboardButton::SPACE     },
-	{ "backspace", KeyboardButton::BACKSPACE },
-	{ "kp_0",      KeyboardButton::KP_0      },
-	{ "kp_1",      KeyboardButton::KP_1      },
-	{ "kp_2",      KeyboardButton::KP_2      },
-	{ "kp_3",      KeyboardButton::KP_3      },
-	{ "kp_4",      KeyboardButton::KP_4      },
-	{ "kp_5",      KeyboardButton::KP_5      },
-	{ "kp_6",      KeyboardButton::KP_6      },
-	{ "kp_7",      KeyboardButton::KP_7      },
-	{ "kp_8",      KeyboardButton::KP_8      },
-	{ "kp_9",      KeyboardButton::KP_9      },
-	{ "f1",        KeyboardButton::F1        },
-	{ "f2",        KeyboardButton::F2        },
-	{ "f3",        KeyboardButton::F3        },
-	{ "f4",        KeyboardButton::F4        },
-	{ "f5",        KeyboardButton::F5        },
-	{ "f6",        KeyboardButton::F6        },
-	{ "f7",        KeyboardButton::F7        },
-	{ "f8",        KeyboardButton::F8        },
-	{ "f9",        KeyboardButton::F9        },
-	{ "f10",       KeyboardButton::F10       },
-	{ "f11",       KeyboardButton::F11       },
-	{ "f12",       KeyboardButton::F12       },
-	{ "home",      KeyboardButton::HOME      },
-	{ "left",      KeyboardButton::LEFT      },
-	{ "up",        KeyboardButton::UP        },
-	{ "right",     KeyboardButton::RIGHT     },
-	{ "down",      KeyboardButton::DOWN      },
-	{ "page_up",   KeyboardButton::PAGE_UP   },
-	{ "page_down", KeyboardButton::PAGE_DOWN },
-	{ "lcontrol",  KeyboardButton::LCONTROL  },
-	{ "rcontrol",  KeyboardButton::RCONTROL  },
-	{ "lshift",    KeyboardButton::LSHIFT    },
-	{ "rshift",    KeyboardButton::RSHIFT    },
-	{ "caps_lock", KeyboardButton::CAPS_LOCK },
-	{ "lalt",      KeyboardButton::LALT      },
-	{ "ralt",      KeyboardButton::RALT      },
-	{ "lsuper",    KeyboardButton::LSUPER    },
-	{ "rsuper",    KeyboardButton::RSUPER    },
-	{ "num_0",     KeyboardButton::NUM_0     },
-	{ "num_1",     KeyboardButton::NUM_1     },
-	{ "num_2",     KeyboardButton::NUM_2     },
-	{ "num_3",     KeyboardButton::NUM_3     },
-	{ "num_4",     KeyboardButton::NUM_4     },
-	{ "num_5",     KeyboardButton::NUM_5     },
-	{ "num_6",     KeyboardButton::NUM_6     },
-	{ "num_7",     KeyboardButton::NUM_7     },
-	{ "num_8",     KeyboardButton::NUM_8     },
-	{ "num_9",     KeyboardButton::NUM_9     },
-	{ "a",         KeyboardButton::A         },
-	{ "b",         KeyboardButton::B         },
-	{ "c",         KeyboardButton::C         },
-	{ "d",         KeyboardButton::D         },
-	{ "e",         KeyboardButton::E         },
-	{ "f",         KeyboardButton::F         },
-	{ "g",         KeyboardButton::G         },
-	{ "h",         KeyboardButton::H         },
-	{ "i",         KeyboardButton::I         },
-	{ "j",         KeyboardButton::J         },
-	{ "k",         KeyboardButton::K         },
-	{ "l",         KeyboardButton::L         },
-	{ "m",         KeyboardButton::M         },
-	{ "n",         KeyboardButton::N         },
-	{ "o",         KeyboardButton::O         },
-	{ "p",         KeyboardButton::P         },
-	{ "q",         KeyboardButton::Q         },
-	{ "r",         KeyboardButton::R         },
-	{ "s",         KeyboardButton::S         },
-	{ "t",         KeyboardButton::T         },
-	{ "u",         KeyboardButton::U         },
-	{ "v",         KeyboardButton::V         },
-	{ "w",         KeyboardButton::W         },
-	{ "x",         KeyboardButton::X         },
-	{ "y",         KeyboardButton::Y         },
-	{ "z",         KeyboardButton::Z         }
+	{ "tab",          KeyboardButton::TAB             },
+	{ "enter",        KeyboardButton::ENTER           },
+	{ "escape",       KeyboardButton::ESCAPE          },
+	{ "space",        KeyboardButton::SPACE           },
+	{ "backspace",    KeyboardButton::BACKSPACE       },
+	{ "num_lock",     KeyboardButton::NUM_LOCK        },
+	{ "numpad_enter", KeyboardButton::NUMPAD_ENTER    },
+	{ "numpad_.",     KeyboardButton::NUMPAD_DELETE   },
+	{ "numpad_*",     KeyboardButton::NUMPAD_MULTIPLY },
+	{ "numpad_+",     KeyboardButton::NUMPAD_ADD      },
+	{ "numpad_-",     KeyboardButton::NUMPAD_SUBTRACT },
+	{ "numpad_/",     KeyboardButton::NUMPAD_DIVIDE   },
+	{ "numpad_0",     KeyboardButton::NUMPAD_0        },
+	{ "numpad_1",     KeyboardButton::NUMPAD_1        },
+	{ "numpad_2",     KeyboardButton::NUMPAD_2        },
+	{ "numpad_3",     KeyboardButton::NUMPAD_3        },
+	{ "numpad_4",     KeyboardButton::NUMPAD_4        },
+	{ "numpad_5",     KeyboardButton::NUMPAD_5        },
+	{ "numpad_6",     KeyboardButton::NUMPAD_6        },
+	{ "numpad_7",     KeyboardButton::NUMPAD_7        },
+	{ "numpad_8",     KeyboardButton::NUMPAD_8        },
+	{ "numpad_9",     KeyboardButton::NUMPAD_9        },
+	{ "f1",           KeyboardButton::F1              },
+	{ "f2",           KeyboardButton::F2              },
+	{ "f3",           KeyboardButton::F3              },
+	{ "f4",           KeyboardButton::F4              },
+	{ "f5",           KeyboardButton::F5              },
+	{ "f6",           KeyboardButton::F6              },
+	{ "f7",           KeyboardButton::F7              },
+	{ "f8",           KeyboardButton::F8              },
+	{ "f9",           KeyboardButton::F9              },
+	{ "f10",          KeyboardButton::F10             },
+	{ "f11",          KeyboardButton::F11             },
+	{ "f12",          KeyboardButton::F12             },
+	{ "home",         KeyboardButton::HOME            },
+	{ "left",         KeyboardButton::LEFT            },
+	{ "up",           KeyboardButton::UP              },
+	{ "right",        KeyboardButton::RIGHT           },
+	{ "down",         KeyboardButton::DOWN            },
+	{ "page_up",      KeyboardButton::PAGE_UP         },
+	{ "page_down",    KeyboardButton::PAGE_DOWN       },
+	{ "delete",       KeyboardButton::DELETE          },
+	{ "end",          KeyboardButton::END             },
+	{ "left_ctrl",    KeyboardButton::LEFT_CTRL       },
+	{ "right_ctrl",   KeyboardButton::RIGHT_CTRL      },
+	{ "left_shift",   KeyboardButton::LEFT_SHIFT      },
+	{ "right_shift",  KeyboardButton::RIGHT_SHIFT     },
+	{ "caps_lock",    KeyboardButton::CAPS_LOCK       },
+	{ "left_alt",     KeyboardButton::LEFT_ALT        },
+	{ "right_alt",    KeyboardButton::RIGHT_ALT       },
+	{ "left_super",   KeyboardButton::LEFT_SUPER      },
+	{ "right_super",  KeyboardButton::RIGHT_SUPER     },
+	{ "0",            KeyboardButton::NUMBER_0        },
+	{ "1",            KeyboardButton::NUMBER_1        },
+	{ "2",            KeyboardButton::NUMBER_2        },
+	{ "3",            KeyboardButton::NUMBER_3        },
+	{ "4",            KeyboardButton::NUMBER_4        },
+	{ "5",            KeyboardButton::NUMBER_5        },
+	{ "6",            KeyboardButton::NUMBER_6        },
+	{ "7",            KeyboardButton::NUMBER_7        },
+	{ "8",            KeyboardButton::NUMBER_8        },
+	{ "9",            KeyboardButton::NUMBER_9        },
+	{ "a",            KeyboardButton::A               },
+	{ "b",            KeyboardButton::B               },
+	{ "c",            KeyboardButton::C               },
+	{ "d",            KeyboardButton::D               },
+	{ "e",            KeyboardButton::E               },
+	{ "f",            KeyboardButton::F               },
+	{ "g",            KeyboardButton::G               },
+	{ "h",            KeyboardButton::H               },
+	{ "i",            KeyboardButton::I               },
+	{ "j",            KeyboardButton::J               },
+	{ "k",            KeyboardButton::K               },
+	{ "l",            KeyboardButton::L               },
+	{ "m",            KeyboardButton::M               },
+	{ "n",            KeyboardButton::N               },
+	{ "o",            KeyboardButton::O               },
+	{ "p",            KeyboardButton::P               },
+	{ "q",            KeyboardButton::Q               },
+	{ "r",            KeyboardButton::R               },
+	{ "s",            KeyboardButton::S               },
+	{ "t",            KeyboardButton::T               },
+	{ "u",            KeyboardButton::U               },
+	{ "v",            KeyboardButton::V               },
+	{ "w",            KeyboardButton::W               },
+	{ "x",            KeyboardButton::X               },
+	{ "y",            KeyboardButton::Y               },
+	{ "z",            KeyboardButton::Z               }
 };
+CE_STATIC_ASSERT(CE_COUNTOF(s_keyboard_button) == KeyboardButton::COUNT);
 
 struct MouseButtonInfo
 {

+ 89 - 80
src/main/main_linux.cpp

@@ -76,86 +76,95 @@ static KeyboardButton::Enum x11_translate_key(KeySym x11_key)
 {
 	switch (x11_key)
 	{
-		case XK_BackSpace: return KeyboardButton::BACKSPACE;
-		case XK_Tab:       return KeyboardButton::TAB;
-		case XK_space:     return KeyboardButton::SPACE;
-		case XK_Escape:    return KeyboardButton::ESCAPE;
-		case XK_Return:    return KeyboardButton::ENTER;
-		case XK_F1:        return KeyboardButton::F1;
-		case XK_F2:        return KeyboardButton::F2;
-		case XK_F3:        return KeyboardButton::F3;
-		case XK_F4:        return KeyboardButton::F4;
-		case XK_F5:        return KeyboardButton::F5;
-		case XK_F6:        return KeyboardButton::F6;
-		case XK_F7:        return KeyboardButton::F7;
-		case XK_F8:        return KeyboardButton::F8;
-		case XK_F9:        return KeyboardButton::F9;
-		case XK_F10:       return KeyboardButton::F10;
-		case XK_F11:       return KeyboardButton::F11;
-		case XK_F12:       return KeyboardButton::F12;
-		case XK_Home:      return KeyboardButton::HOME;
-		case XK_Left:      return KeyboardButton::LEFT;
-		case XK_Up:        return KeyboardButton::UP;
-		case XK_Right:     return KeyboardButton::RIGHT;
-		case XK_Down:      return KeyboardButton::DOWN;
-		case XK_Page_Up:   return KeyboardButton::PAGE_UP;
-		case XK_Page_Down: return KeyboardButton::PAGE_DOWN;
-		case XK_Shift_L:   return KeyboardButton::LSHIFT;
-		case XK_Shift_R:   return KeyboardButton::RSHIFT;
-		case XK_Control_L: return KeyboardButton::LCONTROL;
-		case XK_Control_R: return KeyboardButton::RCONTROL;
-		case XK_Caps_Lock: return KeyboardButton::CAPS_LOCK;
-		case XK_Alt_L:     return KeyboardButton::LALT;
-		case XK_Alt_R:     return KeyboardButton::RALT;
-		case XK_Super_L:   return KeyboardButton::LSUPER;
-		case XK_Super_R:   return KeyboardButton::RSUPER;
-		case XK_KP_0:      return KeyboardButton::KP_0;
-		case XK_KP_1:      return KeyboardButton::KP_1;
-		case XK_KP_2:      return KeyboardButton::KP_2;
-		case XK_KP_3:      return KeyboardButton::KP_3;
-		case XK_KP_4:      return KeyboardButton::KP_4;
-		case XK_KP_5:      return KeyboardButton::KP_5;
-		case XK_KP_6:      return KeyboardButton::KP_6;
-		case XK_KP_7:      return KeyboardButton::KP_7;
-		case XK_KP_8:      return KeyboardButton::KP_8;
-		case XK_KP_9:      return KeyboardButton::KP_9;
-		case '0':          return KeyboardButton::NUM_0;
-		case '1':          return KeyboardButton::NUM_1;
-		case '2':          return KeyboardButton::NUM_2;
-		case '3':          return KeyboardButton::NUM_3;
-		case '4':          return KeyboardButton::NUM_4;
-		case '5':          return KeyboardButton::NUM_5;
-		case '6':          return KeyboardButton::NUM_6;
-		case '7':          return KeyboardButton::NUM_7;
-		case '8':          return KeyboardButton::NUM_8;
-		case '9':          return KeyboardButton::NUM_9;
-		case 'a':          return KeyboardButton::A;
-		case 'b':          return KeyboardButton::B;
-		case 'c':          return KeyboardButton::C;
-		case 'd':          return KeyboardButton::D;
-		case 'e':          return KeyboardButton::E;
-		case 'f':          return KeyboardButton::F;
-		case 'g':          return KeyboardButton::G;
-		case 'h':          return KeyboardButton::H;
-		case 'i':          return KeyboardButton::I;
-		case 'j':          return KeyboardButton::J;
-		case 'k':          return KeyboardButton::K;
-		case 'l':          return KeyboardButton::L;
-		case 'm':          return KeyboardButton::M;
-		case 'n':          return KeyboardButton::N;
-		case 'o':          return KeyboardButton::O;
-		case 'p':          return KeyboardButton::P;
-		case 'q':          return KeyboardButton::Q;
-		case 'r':          return KeyboardButton::R;
-		case 's':          return KeyboardButton::S;
-		case 't':          return KeyboardButton::T;
-		case 'u':          return KeyboardButton::U;
-		case 'v':          return KeyboardButton::V;
-		case 'w':          return KeyboardButton::W;
-		case 'x':          return KeyboardButton::X;
-		case 'y':          return KeyboardButton::Y;
-		case 'z':          return KeyboardButton::Z;
-		default:           return KeyboardButton::COUNT;
+		case XK_BackSpace:   return KeyboardButton::BACKSPACE;
+		case XK_Tab:         return KeyboardButton::TAB;
+		case XK_space:       return KeyboardButton::SPACE;
+		case XK_Escape:      return KeyboardButton::ESCAPE;
+		case XK_Return:      return KeyboardButton::ENTER;
+		case XK_F1:          return KeyboardButton::F1;
+		case XK_F2:          return KeyboardButton::F2;
+		case XK_F3:          return KeyboardButton::F3;
+		case XK_F4:          return KeyboardButton::F4;
+		case XK_F5:          return KeyboardButton::F5;
+		case XK_F6:          return KeyboardButton::F6;
+		case XK_F7:          return KeyboardButton::F7;
+		case XK_F8:          return KeyboardButton::F8;
+		case XK_F9:          return KeyboardButton::F9;
+		case XK_F10:         return KeyboardButton::F10;
+		case XK_F11:         return KeyboardButton::F11;
+		case XK_F12:         return KeyboardButton::F12;
+		case XK_Home:        return KeyboardButton::HOME;
+		case XK_Left:        return KeyboardButton::LEFT;
+		case XK_Up:          return KeyboardButton::UP;
+		case XK_Right:       return KeyboardButton::RIGHT;
+		case XK_Down:        return KeyboardButton::DOWN;
+		case XK_Page_Up:     return KeyboardButton::PAGE_UP;
+		case XK_Page_Down:   return KeyboardButton::PAGE_DOWN;
+		case XK_Delete:      return KeyboardButton::DELETE;
+		case XK_End:         return KeyboardButton::END;
+		case XK_Shift_L:     return KeyboardButton::LEFT_SHIFT;
+		case XK_Shift_R:     return KeyboardButton::RIGHT_SHIFT;
+		case XK_Control_L:   return KeyboardButton::LEFT_CTRL;
+		case XK_Control_R:   return KeyboardButton::RIGHT_CTRL;
+		case XK_Caps_Lock:   return KeyboardButton::CAPS_LOCK;
+		case XK_Alt_L:       return KeyboardButton::LEFT_ALT;
+		case XK_Alt_R:       return KeyboardButton::RIGHT_ALT;
+		case XK_Super_L:     return KeyboardButton::LEFT_SUPER;
+		case XK_Super_R:     return KeyboardButton::RIGHT_SUPER;
+		case XK_Num_Lock:    return KeyboardButton::NUM_LOCK;
+		case XK_KP_Enter:    return KeyboardButton::NUMPAD_ENTER;
+		case XK_KP_Delete:   return KeyboardButton::NUMPAD_DELETE;
+		case XK_KP_Multiply: return KeyboardButton::NUMPAD_MULTIPLY;
+		case XK_KP_Add:      return KeyboardButton::NUMPAD_ADD;
+		case XK_KP_Subtract: return KeyboardButton::NUMPAD_SUBTRACT;
+		case XK_KP_Divide:   return KeyboardButton::NUMPAD_DIVIDE;
+		case XK_KP_0:        return KeyboardButton::NUMPAD_0;
+		case XK_KP_1:        return KeyboardButton::NUMPAD_1;
+		case XK_KP_2:        return KeyboardButton::NUMPAD_2;
+		case XK_KP_3:        return KeyboardButton::NUMPAD_3;
+		case XK_KP_4:        return KeyboardButton::NUMPAD_4;
+		case XK_KP_5:        return KeyboardButton::NUMPAD_5;
+		case XK_KP_6:        return KeyboardButton::NUMPAD_6;
+		case XK_KP_7:        return KeyboardButton::NUMPAD_7;
+		case XK_KP_8:        return KeyboardButton::NUMPAD_8;
+		case XK_KP_9:        return KeyboardButton::NUMPAD_9;
+		case '0':            return KeyboardButton::NUMBER_0;
+		case '1':            return KeyboardButton::NUMBER_1;
+		case '2':            return KeyboardButton::NUMBER_2;
+		case '3':            return KeyboardButton::NUMBER_3;
+		case '4':            return KeyboardButton::NUMBER_4;
+		case '5':            return KeyboardButton::NUMBER_5;
+		case '6':            return KeyboardButton::NUMBER_6;
+		case '7':            return KeyboardButton::NUMBER_7;
+		case '8':            return KeyboardButton::NUMBER_8;
+		case '9':            return KeyboardButton::NUMBER_9;
+		case 'a':            return KeyboardButton::A;
+		case 'b':            return KeyboardButton::B;
+		case 'c':            return KeyboardButton::C;
+		case 'd':            return KeyboardButton::D;
+		case 'e':            return KeyboardButton::E;
+		case 'f':            return KeyboardButton::F;
+		case 'g':            return KeyboardButton::G;
+		case 'h':            return KeyboardButton::H;
+		case 'i':            return KeyboardButton::I;
+		case 'j':            return KeyboardButton::J;
+		case 'k':            return KeyboardButton::K;
+		case 'l':            return KeyboardButton::L;
+		case 'm':            return KeyboardButton::M;
+		case 'n':            return KeyboardButton::N;
+		case 'o':            return KeyboardButton::O;
+		case 'p':            return KeyboardButton::P;
+		case 'q':            return KeyboardButton::Q;
+		case 'r':            return KeyboardButton::R;
+		case 's':            return KeyboardButton::S;
+		case 't':            return KeyboardButton::T;
+		case 'u':            return KeyboardButton::U;
+		case 'v':            return KeyboardButton::V;
+		case 'w':            return KeyboardButton::W;
+		case 'x':            return KeyboardButton::X;
+		case 'y':            return KeyboardButton::Y;
+		case 'z':            return KeyboardButton::Z;
+		default:             return KeyboardButton::COUNT;
 	}
 }
 

+ 28 - 28
src/main/main_windows.cpp

@@ -51,35 +51,35 @@ static KeyboardButton::Enum win_translate_key(int32_t winkey)
 		case VK_DOWN:     return KeyboardButton::DOWN;
 		case VK_PRIOR:    return KeyboardButton::PAGE_UP;
 		case VK_NEXT:     return KeyboardButton::PAGE_DOWN;
-		case VK_LSHIFT:   return KeyboardButton::LSHIFT;
-		case VK_RSHIFT:   return KeyboardButton::RSHIFT;
-		case VK_LCONTROL: return KeyboardButton::LCONTROL;
-		case VK_RCONTROL: return KeyboardButton::RCONTROL;
+		case VK_LSHIFT:   return KeyboardButton::LEFT_SHIFT;
+		case VK_RSHIFT:   return KeyboardButton::RIGHT_SHIFT;
+		case VK_LCONTROL: return KeyboardButton::LEFT_CTRL;
+		case VK_RCONTROL: return KeyboardButton::RIGHT_CTRL;
 		case VK_CAPITAL:  return KeyboardButton::CAPS_LOCK;
-		case VK_LMENU:    return KeyboardButton::LALT;
-		case VK_RMENU:    return KeyboardButton::RALT;
-		case VK_LWIN:     return KeyboardButton::LSUPER;
-		case VK_RWIN:     return KeyboardButton::RSUPER;
-		case VK_NUMPAD0:  return KeyboardButton::KP_0;
-		case VK_NUMPAD1:  return KeyboardButton::KP_1;
-		case VK_NUMPAD2:  return KeyboardButton::KP_2;
-		case VK_NUMPAD3:  return KeyboardButton::KP_3;
-		case VK_NUMPAD4:  return KeyboardButton::KP_4;
-		case VK_NUMPAD5:  return KeyboardButton::KP_5;
-		case VK_NUMPAD6:  return KeyboardButton::KP_6;
-		case VK_NUMPAD7:  return KeyboardButton::KP_7;
-		case VK_NUMPAD8:  return KeyboardButton::KP_8;
-		case VK_NUMPAD9:  return KeyboardButton::KP_9;
-		case '0':         return KeyboardButton::NUM_0;
-		case '1':         return KeyboardButton::NUM_1;
-		case '2':         return KeyboardButton::NUM_2;
-		case '3':         return KeyboardButton::NUM_3;
-		case '4':         return KeyboardButton::NUM_4;
-		case '5':         return KeyboardButton::NUM_5;
-		case '6':         return KeyboardButton::NUM_6;
-		case '7':         return KeyboardButton::NUM_7;
-		case '8':         return KeyboardButton::NUM_8;
-		case '9':         return KeyboardButton::NUM_9;
+		case VK_LMENU:    return KeyboardButton::LEFT_ALT;
+		case VK_RMENU:    return KeyboardButton::RIGHT_ALT;
+		case VK_LWIN:     return KeyboardButton::LEFT_SUPER;
+		case VK_RWIN:     return KeyboardButton::RIGHT_SUPER;
+		case VK_NUMPAD0:  return KeyboardButton::NUMPAD_0;
+		case VK_NUMPAD1:  return KeyboardButton::NUMPAD_1;
+		case VK_NUMPAD2:  return KeyboardButton::NUMPAD_2;
+		case VK_NUMPAD3:  return KeyboardButton::NUMPAD_3;
+		case VK_NUMPAD4:  return KeyboardButton::NUMPAD_4;
+		case VK_NUMPAD5:  return KeyboardButton::NUMPAD_5;
+		case VK_NUMPAD6:  return KeyboardButton::NUMPAD_6;
+		case VK_NUMPAD7:  return KeyboardButton::NUMPAD_7;
+		case VK_NUMPAD8:  return KeyboardButton::NUMPAD_8;
+		case VK_NUMPAD9:  return KeyboardButton::NUMPAD_9;
+		case '0':         return KeyboardButton::NUMBER_0;
+		case '1':         return KeyboardButton::NUMBER_1;
+		case '2':         return KeyboardButton::NUMBER_2;
+		case '3':         return KeyboardButton::NUMBER_3;
+		case '4':         return KeyboardButton::NUMBER_4;
+		case '5':         return KeyboardButton::NUMBER_5;
+		case '6':         return KeyboardButton::NUMBER_6;
+		case '7':         return KeyboardButton::NUMBER_7;
+		case '8':         return KeyboardButton::NUMBER_8;
+		case '9':         return KeyboardButton::NUMBER_9;
 		case 'A':         return KeyboardButton::A;
 		case 'B':         return KeyboardButton::B;
 		case 'C':         return KeyboardButton::C;