diff --git a/other/sdl/sdl.lua b/other/sdl/sdl.lua index 33552a8f7..71070d100 100644 --- a/other/sdl/sdl.lua +++ b/other/sdl/sdl.lua @@ -9,10 +9,10 @@ SDL = { option.use_winlib = 0 option.lib_path = nil - if ExecuteSilent("pkg-config sdl") == 0 then + if ExecuteSilent("pkg-config sdl2") == 0 then option.value = true option.use_pkgconfig = true - elseif ExecuteSilent("sdl-config") > 0 and ExecuteSilent("sdl-config --cflags") == 0 then + elseif ExecuteSilent("sdl2-config") > 0 and ExecuteSilent("sdl2-config --cflags") == 0 then option.value = true option.use_sdlconfig = true end @@ -28,11 +28,11 @@ SDL = { local apply = function(option, settings) if option.use_pkgconfig == true then - settings.cc.flags:Add("`pkg-config --cflags sdl`") - settings.link.flags:Add("`pkg-config --libs sdl`") + settings.cc.flags:Add("`pkg-config --cflags sdl2`") + settings.link.flags:Add("`pkg-config --libs sdl2`") elseif option.use_sdlconfig == true then - settings.cc.flags:Add("`sdl-config --cflags`") - settings.link.flags:Add("`sdl-config --libs`") + settings.cc.flags:Add("`sdl2-config --cflags`") + settings.link.flags:Add("`sdl2-config --libs`") elseif option.use_winlib > 0 then settings.cc.includes:Add(SDL.basepath .. "/include") if option.use_winlib == 32 then @@ -40,8 +40,8 @@ SDL = { else settings.link.libpath:Add(SDL.basepath .. "/lib64") end - settings.link.libs:Add("SDL") - settings.link.libs:Add("SDLmain") + settings.link.libs:Add("SDL2") + settings.link.libs:Add("SDL2main") end end @@ -55,7 +55,7 @@ SDL = { local display = function(option) if option.value == true then if option.use_pkgconfig == true then return "using pkg-config" end - if option.use_sdlconfig == true then return "using sdl-config" end + if option.use_sdlconfig == true then return "using sdl2-config" end if option.use_winlib == 32 then return "using supplied win32 libraries" end if option.use_winlib == 64 then return "using supplied win64 libraries" end return "using unknown method" diff --git a/scripts/SDL_keysym.h b/scripts/SDL_keysym.h deleted file mode 100644 index ff44a035f..000000000 --- a/scripts/SDL_keysym.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2006 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -#ifndef _SDL_keysym_h -#define _SDL_keysym_h - -/* What we really want is a mapping of every raw key on the keyboard. - To support international keyboards, we use the range 0xA1 - 0xFF - as international virtual keycodes. We'll follow in the footsteps of X11... - The names of the keys - */ - -typedef enum { - /* The keyboard syms have been cleverly chosen to map to ASCII */ - SDLK_UNKNOWN = 0, - SDLK_FIRST = 0, - SDLK_BACKSPACE = 8, - SDLK_TAB = 9, - SDLK_CLEAR = 12, - SDLK_RETURN = 13, - SDLK_PAUSE = 19, - SDLK_ESCAPE = 27, - SDLK_SPACE = 32, - SDLK_EXCLAIM = 33, - SDLK_QUOTEDBL = 34, - SDLK_HASH = 35, - SDLK_DOLLAR = 36, - SDLK_AMPERSAND = 38, - SDLK_QUOTE = 39, - SDLK_LEFTPAREN = 40, - SDLK_RIGHTPAREN = 41, - SDLK_ASTERISK = 42, - SDLK_PLUS = 43, - SDLK_COMMA = 44, - SDLK_MINUS = 45, - SDLK_PERIOD = 46, - SDLK_SLASH = 47, - SDLK_0 = 48, - SDLK_1 = 49, - SDLK_2 = 50, - SDLK_3 = 51, - SDLK_4 = 52, - SDLK_5 = 53, - SDLK_6 = 54, - SDLK_7 = 55, - SDLK_8 = 56, - SDLK_9 = 57, - SDLK_COLON = 58, - SDLK_SEMICOLON = 59, - SDLK_LESS = 60, - SDLK_EQUALS = 61, - SDLK_GREATER = 62, - SDLK_QUESTION = 63, - SDLK_AT = 64, - /* - Skip uppercase letters - */ - SDLK_LEFTBRACKET = 91, - SDLK_BACKSLASH = 92, - SDLK_RIGHTBRACKET = 93, - SDLK_CARET = 94, - SDLK_UNDERSCORE = 95, - SDLK_BACKQUOTE = 96, - SDLK_a = 97, - SDLK_b = 98, - SDLK_c = 99, - SDLK_d = 100, - SDLK_e = 101, - SDLK_f = 102, - SDLK_g = 103, - SDLK_h = 104, - SDLK_i = 105, - SDLK_j = 106, - SDLK_k = 107, - SDLK_l = 108, - SDLK_m = 109, - SDLK_n = 110, - SDLK_o = 111, - SDLK_p = 112, - SDLK_q = 113, - SDLK_r = 114, - SDLK_s = 115, - SDLK_t = 116, - SDLK_u = 117, - SDLK_v = 118, - SDLK_w = 119, - SDLK_x = 120, - SDLK_y = 121, - SDLK_z = 122, - SDLK_DELETE = 127, - /* End of ASCII mapped keysyms */ - - /* International keyboard syms */ - SDLK_WORLD_0 = 160, /* 0xA0 */ - SDLK_WORLD_1 = 161, - SDLK_WORLD_2 = 162, - SDLK_WORLD_3 = 163, - SDLK_WORLD_4 = 164, - SDLK_WORLD_5 = 165, - SDLK_WORLD_6 = 166, - SDLK_WORLD_7 = 167, - SDLK_WORLD_8 = 168, - SDLK_WORLD_9 = 169, - SDLK_WORLD_10 = 170, - SDLK_WORLD_11 = 171, - SDLK_WORLD_12 = 172, - SDLK_WORLD_13 = 173, - SDLK_WORLD_14 = 174, - SDLK_WORLD_15 = 175, - SDLK_WORLD_16 = 176, - SDLK_WORLD_17 = 177, - SDLK_WORLD_18 = 178, - SDLK_WORLD_19 = 179, - SDLK_WORLD_20 = 180, - SDLK_WORLD_21 = 181, - SDLK_WORLD_22 = 182, - SDLK_WORLD_23 = 183, - SDLK_WORLD_24 = 184, - SDLK_WORLD_25 = 185, - SDLK_WORLD_26 = 186, - SDLK_WORLD_27 = 187, - SDLK_WORLD_28 = 188, - SDLK_WORLD_29 = 189, - SDLK_WORLD_30 = 190, - SDLK_WORLD_31 = 191, - SDLK_WORLD_32 = 192, - SDLK_WORLD_33 = 193, - SDLK_WORLD_34 = 194, - SDLK_WORLD_35 = 195, - SDLK_WORLD_36 = 196, - SDLK_WORLD_37 = 197, - SDLK_WORLD_38 = 198, - SDLK_WORLD_39 = 199, - SDLK_WORLD_40 = 200, - SDLK_WORLD_41 = 201, - SDLK_WORLD_42 = 202, - SDLK_WORLD_43 = 203, - SDLK_WORLD_44 = 204, - SDLK_WORLD_45 = 205, - SDLK_WORLD_46 = 206, - SDLK_WORLD_47 = 207, - SDLK_WORLD_48 = 208, - SDLK_WORLD_49 = 209, - SDLK_WORLD_50 = 210, - SDLK_WORLD_51 = 211, - SDLK_WORLD_52 = 212, - SDLK_WORLD_53 = 213, - SDLK_WORLD_54 = 214, - SDLK_WORLD_55 = 215, - SDLK_WORLD_56 = 216, - SDLK_WORLD_57 = 217, - SDLK_WORLD_58 = 218, - SDLK_WORLD_59 = 219, - SDLK_WORLD_60 = 220, - SDLK_WORLD_61 = 221, - SDLK_WORLD_62 = 222, - SDLK_WORLD_63 = 223, - SDLK_WORLD_64 = 224, - SDLK_WORLD_65 = 225, - SDLK_WORLD_66 = 226, - SDLK_WORLD_67 = 227, - SDLK_WORLD_68 = 228, - SDLK_WORLD_69 = 229, - SDLK_WORLD_70 = 230, - SDLK_WORLD_71 = 231, - SDLK_WORLD_72 = 232, - SDLK_WORLD_73 = 233, - SDLK_WORLD_74 = 234, - SDLK_WORLD_75 = 235, - SDLK_WORLD_76 = 236, - SDLK_WORLD_77 = 237, - SDLK_WORLD_78 = 238, - SDLK_WORLD_79 = 239, - SDLK_WORLD_80 = 240, - SDLK_WORLD_81 = 241, - SDLK_WORLD_82 = 242, - SDLK_WORLD_83 = 243, - SDLK_WORLD_84 = 244, - SDLK_WORLD_85 = 245, - SDLK_WORLD_86 = 246, - SDLK_WORLD_87 = 247, - SDLK_WORLD_88 = 248, - SDLK_WORLD_89 = 249, - SDLK_WORLD_90 = 250, - SDLK_WORLD_91 = 251, - SDLK_WORLD_92 = 252, - SDLK_WORLD_93 = 253, - SDLK_WORLD_94 = 254, - SDLK_WORLD_95 = 255, /* 0xFF */ - - /* Numeric keypad */ - SDLK_KP0 = 256, - SDLK_KP1 = 257, - SDLK_KP2 = 258, - SDLK_KP3 = 259, - SDLK_KP4 = 260, - SDLK_KP5 = 261, - SDLK_KP6 = 262, - SDLK_KP7 = 263, - SDLK_KP8 = 264, - SDLK_KP9 = 265, - SDLK_KP_PERIOD = 266, - SDLK_KP_DIVIDE = 267, - SDLK_KP_MULTIPLY = 268, - SDLK_KP_MINUS = 269, - SDLK_KP_PLUS = 270, - SDLK_KP_ENTER = 271, - SDLK_KP_EQUALS = 272, - - /* Arrows + Home/End pad */ - SDLK_UP = 273, - SDLK_DOWN = 274, - SDLK_RIGHT = 275, - SDLK_LEFT = 276, - SDLK_INSERT = 277, - SDLK_HOME = 278, - SDLK_END = 279, - SDLK_PAGEUP = 280, - SDLK_PAGEDOWN = 281, - - /* Function keys */ - SDLK_F1 = 282, - SDLK_F2 = 283, - SDLK_F3 = 284, - SDLK_F4 = 285, - SDLK_F5 = 286, - SDLK_F6 = 287, - SDLK_F7 = 288, - SDLK_F8 = 289, - SDLK_F9 = 290, - SDLK_F10 = 291, - SDLK_F11 = 292, - SDLK_F12 = 293, - SDLK_F13 = 294, - SDLK_F14 = 295, - SDLK_F15 = 296, - - /* Key state modifier keys */ - SDLK_NUMLOCK = 300, - SDLK_CAPSLOCK = 301, - SDLK_SCROLLOCK = 302, - SDLK_RSHIFT = 303, - SDLK_LSHIFT = 304, - SDLK_RCTRL = 305, - SDLK_LCTRL = 306, - SDLK_RALT = 307, - SDLK_LALT = 308, - SDLK_RMETA = 309, - SDLK_LMETA = 310, - SDLK_LSUPER = 311, /* Left "Windows" key */ - SDLK_RSUPER = 312, /* Right "Windows" key */ - SDLK_MODE = 313, /* "Alt Gr" key */ - SDLK_COMPOSE = 314, /* Multi-key compose key */ - - /* Miscellaneous function keys */ - SDLK_HELP = 315, - SDLK_PRINT = 316, - SDLK_SYSREQ = 317, - SDLK_BREAK = 318, - SDLK_MENU = 319, - SDLK_POWER = 320, /* Power Macintosh power key */ - SDLK_EURO = 321, /* Some european keyboards */ - SDLK_UNDO = 322, /* Atari keyboard has Undo */ - - /* Add any other keys here */ - - SDLK_LAST -} SDLKey; - -/* Enumeration of valid key mods (possibly OR'd together) */ -typedef enum { - KMOD_NONE = 0x0000, - KMOD_LSHIFT= 0x0001, - KMOD_RSHIFT= 0x0002, - KMOD_LCTRL = 0x0040, - KMOD_RCTRL = 0x0080, - KMOD_LALT = 0x0100, - KMOD_RALT = 0x0200, - KMOD_LMETA = 0x0400, - KMOD_RMETA = 0x0800, - KMOD_NUM = 0x1000, - KMOD_CAPS = 0x2000, - KMOD_MODE = 0x4000, - KMOD_RESERVED = 0x8000 -} SDLMod; - -#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) -#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) -#define KMOD_ALT (KMOD_LALT|KMOD_RALT) -#define KMOD_META (KMOD_LMETA|KMOD_RMETA) - -#endif /* _SDL_keysym_h */ diff --git a/scripts/SDL_scancode.h b/scripts/SDL_scancode.h new file mode 100644 index 000000000..d3f874811 --- /dev/null +++ b/scripts/SDL_scancode.h @@ -0,0 +1,401 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_scancode.h + * + * Defines keyboard scancodes. + */ + +#ifndef _SDL_scancode_h +#define _SDL_scancode_h + +#include "SDL_stdinc.h" + +/** + * \brief The SDL keyboard scancode representation. + * + * Values of this type are used to represent keyboard keys, among other places + * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the + * SDL_Event structure. + * + * The values in this enumeration are based on the USB usage page standard: + * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf + */ +typedef enum +{ + SDL_SCANCODE_UNKNOWN = 0, + + /** + * \name Usage page 0x07 + * + * These values are from usage page 0x07 (USB keyboard page). + */ + /*@{*/ + + SDL_SCANCODE_A = 4, + SDL_SCANCODE_B = 5, + SDL_SCANCODE_C = 6, + SDL_SCANCODE_D = 7, + SDL_SCANCODE_E = 8, + SDL_SCANCODE_F = 9, + SDL_SCANCODE_G = 10, + SDL_SCANCODE_H = 11, + SDL_SCANCODE_I = 12, + SDL_SCANCODE_J = 13, + SDL_SCANCODE_K = 14, + SDL_SCANCODE_L = 15, + SDL_SCANCODE_M = 16, + SDL_SCANCODE_N = 17, + SDL_SCANCODE_O = 18, + SDL_SCANCODE_P = 19, + SDL_SCANCODE_Q = 20, + SDL_SCANCODE_R = 21, + SDL_SCANCODE_S = 22, + SDL_SCANCODE_T = 23, + SDL_SCANCODE_U = 24, + SDL_SCANCODE_V = 25, + SDL_SCANCODE_W = 26, + SDL_SCANCODE_X = 27, + SDL_SCANCODE_Y = 28, + SDL_SCANCODE_Z = 29, + + SDL_SCANCODE_1 = 30, + SDL_SCANCODE_2 = 31, + SDL_SCANCODE_3 = 32, + SDL_SCANCODE_4 = 33, + SDL_SCANCODE_5 = 34, + SDL_SCANCODE_6 = 35, + SDL_SCANCODE_7 = 36, + SDL_SCANCODE_8 = 37, + SDL_SCANCODE_9 = 38, + SDL_SCANCODE_0 = 39, + + SDL_SCANCODE_RETURN = 40, + SDL_SCANCODE_ESCAPE = 41, + SDL_SCANCODE_BACKSPACE = 42, + SDL_SCANCODE_TAB = 43, + SDL_SCANCODE_SPACE = 44, + + SDL_SCANCODE_MINUS = 45, + SDL_SCANCODE_EQUALS = 46, + SDL_SCANCODE_LEFTBRACKET = 47, + SDL_SCANCODE_RIGHTBRACKET = 48, + SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return + * key on ISO keyboards and at the right end + * of the QWERTY row on ANSI keyboards. + * Produces REVERSE SOLIDUS (backslash) and + * VERTICAL LINE in a US layout, REVERSE + * SOLIDUS and VERTICAL LINE in a UK Mac + * layout, NUMBER SIGN and TILDE in a UK + * Windows layout, DOLLAR SIGN and POUND SIGN + * in a Swiss German layout, NUMBER SIGN and + * APOSTROPHE in a German layout, GRAVE + * ACCENT and POUND SIGN in a French Mac + * layout, and ASTERISK and MICRO SIGN in a + * French Windows layout. + */ + SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code + * instead of 49 for the same key, but all + * OSes I've seen treat the two codes + * identically. So, as an implementor, unless + * your keyboard generates both of those + * codes and your OS treats them differently, + * you should generate SDL_SCANCODE_BACKSLASH + * instead of this code. As a user, you + * should not rely on this code because SDL + * will never generate it with most (all?) + * keyboards. + */ + SDL_SCANCODE_SEMICOLON = 51, + SDL_SCANCODE_APOSTROPHE = 52, + SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI + * and ISO keyboards). Produces GRAVE ACCENT and + * TILDE in a US Windows layout and in US and UK + * Mac layouts on ANSI keyboards, GRAVE ACCENT + * and NOT SIGN in a UK Windows layout, SECTION + * SIGN and PLUS-MINUS SIGN in US and UK Mac + * layouts on ISO keyboards, SECTION SIGN and + * DEGREE SIGN in a Swiss German layout (Mac: + * only on ISO keyboards), CIRCUMFLEX ACCENT and + * DEGREE SIGN in a German layout (Mac: only on + * ISO keyboards), SUPERSCRIPT TWO and TILDE in a + * French Windows layout, COMMERCIAL AT and + * NUMBER SIGN in a French Mac layout on ISO + * keyboards, and LESS-THAN SIGN and GREATER-THAN + * SIGN in a Swiss German, German, or French Mac + * layout on ANSI keyboards. + */ + SDL_SCANCODE_COMMA = 54, + SDL_SCANCODE_PERIOD = 55, + SDL_SCANCODE_SLASH = 56, + + SDL_SCANCODE_CAPSLOCK = 57, + + SDL_SCANCODE_F1 = 58, + SDL_SCANCODE_F2 = 59, + SDL_SCANCODE_F3 = 60, + SDL_SCANCODE_F4 = 61, + SDL_SCANCODE_F5 = 62, + SDL_SCANCODE_F6 = 63, + SDL_SCANCODE_F7 = 64, + SDL_SCANCODE_F8 = 65, + SDL_SCANCODE_F9 = 66, + SDL_SCANCODE_F10 = 67, + SDL_SCANCODE_F11 = 68, + SDL_SCANCODE_F12 = 69, + + SDL_SCANCODE_PRINTSCREEN = 70, + SDL_SCANCODE_SCROLLLOCK = 71, + SDL_SCANCODE_PAUSE = 72, + SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but + does send code 73, not 117) */ + SDL_SCANCODE_HOME = 74, + SDL_SCANCODE_PAGEUP = 75, + SDL_SCANCODE_DELETE = 76, + SDL_SCANCODE_END = 77, + SDL_SCANCODE_PAGEDOWN = 78, + SDL_SCANCODE_RIGHT = 79, + SDL_SCANCODE_LEFT = 80, + SDL_SCANCODE_DOWN = 81, + SDL_SCANCODE_UP = 82, + + SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards + */ + SDL_SCANCODE_KP_DIVIDE = 84, + SDL_SCANCODE_KP_MULTIPLY = 85, + SDL_SCANCODE_KP_MINUS = 86, + SDL_SCANCODE_KP_PLUS = 87, + SDL_SCANCODE_KP_ENTER = 88, + SDL_SCANCODE_KP_1 = 89, + SDL_SCANCODE_KP_2 = 90, + SDL_SCANCODE_KP_3 = 91, + SDL_SCANCODE_KP_4 = 92, + SDL_SCANCODE_KP_5 = 93, + SDL_SCANCODE_KP_6 = 94, + SDL_SCANCODE_KP_7 = 95, + SDL_SCANCODE_KP_8 = 96, + SDL_SCANCODE_KP_9 = 97, + SDL_SCANCODE_KP_0 = 98, + SDL_SCANCODE_KP_PERIOD = 99, + + SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO + * keyboards have over ANSI ones, + * located between left shift and Y. + * Produces GRAVE ACCENT and TILDE in a + * US or UK Mac layout, REVERSE SOLIDUS + * (backslash) and VERTICAL LINE in a + * US or UK Windows layout, and + * LESS-THAN SIGN and GREATER-THAN SIGN + * in a Swiss German, German, or French + * layout. */ + SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */ + SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, + * not a physical key - but some Mac keyboards + * do have a power key. */ + SDL_SCANCODE_KP_EQUALS = 103, + SDL_SCANCODE_F13 = 104, + SDL_SCANCODE_F14 = 105, + SDL_SCANCODE_F15 = 106, + SDL_SCANCODE_F16 = 107, + SDL_SCANCODE_F17 = 108, + SDL_SCANCODE_F18 = 109, + SDL_SCANCODE_F19 = 110, + SDL_SCANCODE_F20 = 111, + SDL_SCANCODE_F21 = 112, + SDL_SCANCODE_F22 = 113, + SDL_SCANCODE_F23 = 114, + SDL_SCANCODE_F24 = 115, + SDL_SCANCODE_EXECUTE = 116, + SDL_SCANCODE_HELP = 117, + SDL_SCANCODE_MENU = 118, + SDL_SCANCODE_SELECT = 119, + SDL_SCANCODE_STOP = 120, + SDL_SCANCODE_AGAIN = 121, /**< redo */ + SDL_SCANCODE_UNDO = 122, + SDL_SCANCODE_CUT = 123, + SDL_SCANCODE_COPY = 124, + SDL_SCANCODE_PASTE = 125, + SDL_SCANCODE_FIND = 126, + SDL_SCANCODE_MUTE = 127, + SDL_SCANCODE_VOLUMEUP = 128, + SDL_SCANCODE_VOLUMEDOWN = 129, +/* not sure whether there's a reason to enable these */ +/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */ +/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */ +/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */ + SDL_SCANCODE_KP_COMMA = 133, + SDL_SCANCODE_KP_EQUALSAS400 = 134, + + SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see + footnotes in USB doc */ + SDL_SCANCODE_INTERNATIONAL2 = 136, + SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */ + SDL_SCANCODE_INTERNATIONAL4 = 138, + SDL_SCANCODE_INTERNATIONAL5 = 139, + SDL_SCANCODE_INTERNATIONAL6 = 140, + SDL_SCANCODE_INTERNATIONAL7 = 141, + SDL_SCANCODE_INTERNATIONAL8 = 142, + SDL_SCANCODE_INTERNATIONAL9 = 143, + SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */ + SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */ + SDL_SCANCODE_LANG3 = 146, /**< Katakana */ + SDL_SCANCODE_LANG4 = 147, /**< Hiragana */ + SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */ + SDL_SCANCODE_LANG6 = 149, /**< reserved */ + SDL_SCANCODE_LANG7 = 150, /**< reserved */ + SDL_SCANCODE_LANG8 = 151, /**< reserved */ + SDL_SCANCODE_LANG9 = 152, /**< reserved */ + + SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ + SDL_SCANCODE_SYSREQ = 154, + SDL_SCANCODE_CANCEL = 155, + SDL_SCANCODE_CLEAR = 156, + SDL_SCANCODE_PRIOR = 157, + SDL_SCANCODE_RETURN2 = 158, + SDL_SCANCODE_SEPARATOR = 159, + SDL_SCANCODE_OUT = 160, + SDL_SCANCODE_OPER = 161, + SDL_SCANCODE_CLEARAGAIN = 162, + SDL_SCANCODE_CRSEL = 163, + SDL_SCANCODE_EXSEL = 164, + + SDL_SCANCODE_KP_00 = 176, + SDL_SCANCODE_KP_000 = 177, + SDL_SCANCODE_THOUSANDSSEPARATOR = 178, + SDL_SCANCODE_DECIMALSEPARATOR = 179, + SDL_SCANCODE_CURRENCYUNIT = 180, + SDL_SCANCODE_CURRENCYSUBUNIT = 181, + SDL_SCANCODE_KP_LEFTPAREN = 182, + SDL_SCANCODE_KP_RIGHTPAREN = 183, + SDL_SCANCODE_KP_LEFTBRACE = 184, + SDL_SCANCODE_KP_RIGHTBRACE = 185, + SDL_SCANCODE_KP_TAB = 186, + SDL_SCANCODE_KP_BACKSPACE = 187, + SDL_SCANCODE_KP_A = 188, + SDL_SCANCODE_KP_B = 189, + SDL_SCANCODE_KP_C = 190, + SDL_SCANCODE_KP_D = 191, + SDL_SCANCODE_KP_E = 192, + SDL_SCANCODE_KP_F = 193, + SDL_SCANCODE_KP_XOR = 194, + SDL_SCANCODE_KP_POWER = 195, + SDL_SCANCODE_KP_PERCENT = 196, + SDL_SCANCODE_KP_LESS = 197, + SDL_SCANCODE_KP_GREATER = 198, + SDL_SCANCODE_KP_AMPERSAND = 199, + SDL_SCANCODE_KP_DBLAMPERSAND = 200, + SDL_SCANCODE_KP_VERTICALBAR = 201, + SDL_SCANCODE_KP_DBLVERTICALBAR = 202, + SDL_SCANCODE_KP_COLON = 203, + SDL_SCANCODE_KP_HASH = 204, + SDL_SCANCODE_KP_SPACE = 205, + SDL_SCANCODE_KP_AT = 206, + SDL_SCANCODE_KP_EXCLAM = 207, + SDL_SCANCODE_KP_MEMSTORE = 208, + SDL_SCANCODE_KP_MEMRECALL = 209, + SDL_SCANCODE_KP_MEMCLEAR = 210, + SDL_SCANCODE_KP_MEMADD = 211, + SDL_SCANCODE_KP_MEMSUBTRACT = 212, + SDL_SCANCODE_KP_MEMMULTIPLY = 213, + SDL_SCANCODE_KP_MEMDIVIDE = 214, + SDL_SCANCODE_KP_PLUSMINUS = 215, + SDL_SCANCODE_KP_CLEAR = 216, + SDL_SCANCODE_KP_CLEARENTRY = 217, + SDL_SCANCODE_KP_BINARY = 218, + SDL_SCANCODE_KP_OCTAL = 219, + SDL_SCANCODE_KP_DECIMAL = 220, + SDL_SCANCODE_KP_HEXADECIMAL = 221, + + SDL_SCANCODE_LCTRL = 224, + SDL_SCANCODE_LSHIFT = 225, + SDL_SCANCODE_LALT = 226, /**< alt, option */ + SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */ + SDL_SCANCODE_RCTRL = 228, + SDL_SCANCODE_RSHIFT = 229, + SDL_SCANCODE_RALT = 230, /**< alt gr, option */ + SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */ + + SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered + * by any of the above, but since there's a + * special KMOD_MODE for it I'm adding it here + */ + + /*@}*//*Usage page 0x07*/ + + /** + * \name Usage page 0x0C + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /*@{*/ + + SDL_SCANCODE_AUDIONEXT = 258, + SDL_SCANCODE_AUDIOPREV = 259, + SDL_SCANCODE_AUDIOSTOP = 260, + SDL_SCANCODE_AUDIOPLAY = 261, + SDL_SCANCODE_AUDIOMUTE = 262, + SDL_SCANCODE_MEDIASELECT = 263, + SDL_SCANCODE_WWW = 264, + SDL_SCANCODE_MAIL = 265, + SDL_SCANCODE_CALCULATOR = 266, + SDL_SCANCODE_COMPUTER = 267, + SDL_SCANCODE_AC_SEARCH = 268, + SDL_SCANCODE_AC_HOME = 269, + SDL_SCANCODE_AC_BACK = 270, + SDL_SCANCODE_AC_FORWARD = 271, + SDL_SCANCODE_AC_STOP = 272, + SDL_SCANCODE_AC_REFRESH = 273, + SDL_SCANCODE_AC_BOOKMARKS = 274, + + /*@}*//*Usage page 0x0C*/ + + /** + * \name Walther keys + * + * These are values that Christian Walther added (for mac keyboard?). + */ + /*@{*/ + + SDL_SCANCODE_BRIGHTNESSDOWN = 275, + SDL_SCANCODE_BRIGHTNESSUP = 276, + SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display + switch, video mode switch */ + SDL_SCANCODE_KBDILLUMTOGGLE = 278, + SDL_SCANCODE_KBDILLUMDOWN = 279, + SDL_SCANCODE_KBDILLUMUP = 280, + SDL_SCANCODE_EJECT = 281, + SDL_SCANCODE_SLEEP = 282, + + SDL_SCANCODE_APP1 = 283, + SDL_SCANCODE_APP2 = 284, + + /*@}*//*Walther keys*/ + + /* Add any other keys here. */ + + SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes + for array bounds */ +} SDL_Scancode; + +#endif /* _SDL_scancode_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/scripts/gen_keys.py b/scripts/gen_keys.py index 51a659d73..3325f27c3 100644 --- a/scripts/gen_keys.py +++ b/scripts/gen_keys.py @@ -9,16 +9,27 @@ for i in range(0, 512): print >>f, "#ifndef ENGINE_KEYS_H" print >>f, "#define ENGINE_KEYS_H" + +# KEY_EXECUTE already exists on windows platforms +print >>f, "#if defined(CONF_FAMILY_WINDOWS)" +print >>f, " #undef KEY_EXECUTE" +print >>f, "#endif" + print >>f, '/* AUTO GENERATED! DO NOT EDIT MANUALLY! */' print >>f, "enum" print >>f, "{" +print >>f, "\tKEY_FIRST = 0," + highestid = 0 -for line in open("scripts/SDL_keysym.h"): +for line in open("scripts/SDL_scancode.h"): l = line.strip().split("=") - if len(l) == 2 and "SDLK_" in line: - key = l[0].strip().replace("SDLK_", "KEY_") + if len(l) == 2 and "SDL_SCANCODE_" in line: + key = l[0].strip().replace("SDL_SCANCODE_", "KEY_") + value = int(l[1].split(",")[0].strip()) + if key[0:2] == "/*": + continue print >>f, "\t%s = %d,"%(key, value) keynames[value] = key.replace("KEY_", "").lower() @@ -53,7 +64,7 @@ print >>f, '#endif' print >>f, '' print >>f, "#include " print >>f, "" -print >>f, "const char g_aaKeyStrings[512][16] =" +print >>f, "const char g_aaKeyStrings[512][20] =" print >>f, "{" for n in keynames: print >>f, '\t"%s",'%n diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 539b4f51b..ccb443ed0 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -1,6 +1,11 @@ - +#include #include "SDL.h" #include "SDL_opengl.h" +#if defined(CONF_PLATFORM_MACOSX) +#include "OpenGL/glu.h" +#else +#include "GL/glu.h" +#endif #include @@ -16,9 +21,6 @@ void CGraphicsBackend_Threaded::ThreadFunc(void *pUser) { - #ifdef CONF_PLATFORM_MACOSX - CAutoreleasePool AutoreleasePool; - #endif CGraphicsBackend_Threaded *pThis = (CGraphicsBackend_Threaded *)pUser; while(!pThis->m_Shutdown) @@ -26,6 +28,9 @@ void CGraphicsBackend_Threaded::ThreadFunc(void *pUser) pThis->m_Activity.wait(); if(pThis->m_pBuffer) { + #ifdef CONF_PLATFORM_MACOSX + CAutoreleasePool AutoreleasePool; + #endif pThis->m_pProcessor->RunBuffer(pThis->m_pBuffer); sync_barrier(); pThis->m_pBuffer = 0x0; @@ -505,8 +510,9 @@ bool CCommandProcessorFragment_OpenGL::RunCommand(const CCommandBuffer::SCommand void CCommandProcessorFragment_SDL::Cmd_Init(const SCommand_Init *pCommand) { - m_GLContext = pCommand->m_Context; - GL_MakeCurrent(m_GLContext); + m_GLContext = pCommand->m_GLContext; + m_pWindow = pCommand->m_pWindow; + SDL_GL_MakeCurrent(m_pWindow, m_GLContext); // set some default settings glEnable(GL_BLEND); @@ -522,12 +528,12 @@ void CCommandProcessorFragment_SDL::Cmd_Init(const SCommand_Init *pCommand) void CCommandProcessorFragment_SDL::Cmd_Shutdown(const SCommand_Shutdown *pCommand) { - GL_ReleaseContext(m_GLContext); + SDL_GL_MakeCurrent(NULL, NULL); } void CCommandProcessorFragment_SDL::Cmd_Swap(const CCommandBuffer::SCommand_Swap *pCommand) { - GL_SwapBuffers(m_GLContext); + SDL_GL_SwapWindow(m_pWindow); if(pCommand->m_Finish) glFinish(); @@ -535,35 +541,38 @@ void CCommandProcessorFragment_SDL::Cmd_Swap(const CCommandBuffer::SCommand_Swap void CCommandProcessorFragment_SDL::Cmd_VideoModes(const CCommandBuffer::SCommand_VideoModes *pCommand) { - // TODO: fix this code on osx or windows - SDL_Rect **ppModes = SDL_ListModes(NULL, SDL_OPENGL|SDL_GL_DOUBLEBUFFER|SDL_FULLSCREEN); - if(ppModes == NULL) + SDL_DisplayMode mode; + int maxModes = SDL_GetNumDisplayModes(pCommand->m_Screen), + numModes = 0; + + for(int i = 0; i < maxModes; i++) { - // no modes - *pCommand->m_pNumModes = 0; - } - else if(ppModes == (SDL_Rect**)-1) - { - // no modes - *pCommand->m_pNumModes = 0; - } - else - { - int NumModes = 0; - for(int i = 0; ppModes[i]; ++i) + if(SDL_GetDisplayMode(pCommand->m_Screen, i, &mode) < 0) { - if(NumModes == pCommand->m_MaxModes) - break; - pCommand->m_pModes[NumModes].m_Width = ppModes[i]->w; - pCommand->m_pModes[NumModes].m_Height = ppModes[i]->h; - pCommand->m_pModes[NumModes].m_Red = 8; - pCommand->m_pModes[NumModes].m_Green = 8; - pCommand->m_pModes[NumModes].m_Blue = 8; - NumModes++; + dbg_msg("gfx", "unable to get display mode: %s", SDL_GetError()); + continue; } - *pCommand->m_pNumModes = NumModes; + bool alreadyFound = false; + for(int j = 0; j < numModes; j++) + { + if(pCommand->m_pModes[j].m_Width == mode.w && pCommand->m_pModes[j].m_Height == mode.h) + { + alreadyFound = true; + break; + } + } + if(alreadyFound) + continue; + + pCommand->m_pModes[numModes].m_Width = mode.w; + pCommand->m_pModes[numModes].m_Height = mode.h; + pCommand->m_pModes[numModes].m_Red = 8; + pCommand->m_pModes[numModes].m_Green = 8; + pCommand->m_pModes[numModes].m_Blue = 8; + numModes++; } + *pCommand->m_pNumModes = numModes; } CCommandProcessorFragment_SDL::CCommandProcessorFragment_SDL() @@ -610,7 +619,7 @@ void CCommandProcessor_SDL_OpenGL::RunBuffer(CCommandBuffer *pBuffer) // ------------ CGraphicsBackend_SDL_OpenGL -int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *pWidth, int *pHeight, int FsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight) +int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int Screen, int *pWidth, int *pHeight, int FsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight) { if(!SDL_WasInit(SDL_INIT_VIDEO)) { @@ -626,44 +635,43 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *pWidth, int *pHeig #endif } - const SDL_VideoInfo *pInfo = SDL_GetVideoInfo(); - SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); // prevent stuck mouse cursor sdl-bug when loosing fullscreen focus in windows + SDL_Rect ScreenBounds; + if(SDL_GetDisplayBounds(Screen, &ScreenBounds) < 0) + { + dbg_msg("gfx", "unable to get current screen bounds: %s", SDL_GetError()); + return -1; + } // use current resolution as default if(*pWidth == 0 || *pHeight == 0) { - *pWidth = pInfo->current_w; - *pHeight = pInfo->current_h; + *pWidth = ScreenBounds.w; + *pHeight = ScreenBounds.h; } // store desktop resolution for settings reset button - *pDesktopWidth = pInfo->current_w; - *pDesktopHeight = pInfo->current_h; - - // set flags - int SdlFlags = SDL_OPENGL; - if(Flags&IGraphicsBackend::INITFLAG_RESIZABLE) - SdlFlags |= SDL_RESIZABLE; - - if(pInfo->hw_available) // ignore_convention - SdlFlags |= SDL_HWSURFACE; - else - SdlFlags |= SDL_SWSURFACE; - - if(pInfo->blit_hw) // ignore_convention - SdlFlags |= SDL_HWACCEL; + *pDesktopWidth = ScreenBounds.w; + *pDesktopHeight = ScreenBounds.h; dbg_assert(!(Flags&IGraphicsBackend::INITFLAG_BORDERLESS) || !(Flags&IGraphicsBackend::INITFLAG_FULLSCREEN), "only one of borderless and fullscreen may be activated at the same time"); + // set flags + int SdlFlags = SDL_WINDOW_OPENGL; + if(Flags&IGraphicsBackend::INITFLAG_RESIZABLE) + SdlFlags |= SDL_WINDOW_RESIZABLE; if(Flags&IGraphicsBackend::INITFLAG_BORDERLESS) - SdlFlags |= SDL_NOFRAME; - + SdlFlags |= SDL_WINDOW_BORDERLESS; if(Flags&IGraphicsBackend::INITFLAG_FULLSCREEN) - SdlFlags |= SDL_FULLSCREEN; + #if defined(CONF_FAMILY_WINDOWS) + SdlFlags |= SDL_WINDOW_FULLSCREEN; + #else + SdlFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + #endif // set gl attributes + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); if(FsaaSamples) { SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); @@ -675,20 +683,29 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *pWidth, int *pHeig SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); } - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, Flags&IGraphicsBackend::INITFLAG_VSYNC ? 1 : 0); + m_pWindow = SDL_CreateWindow( + pName, + SDL_WINDOWPOS_UNDEFINED_DISPLAY(0), + SDL_WINDOWPOS_UNDEFINED_DISPLAY(0), + *Width, + *Height, + SdlFlags); - // set caption - SDL_WM_SetCaption(pName, pName); - - // create window - m_pScreenSurface = SDL_SetVideoMode(*pWidth, *pHeight, 0, SdlFlags); - if(!m_pScreenSurface) + if(m_pWindow == NULL) { - dbg_msg("gfx", "unable to set video mode: %s", SDL_GetError()); - //*pCommand->m_pResult = -1; + dbg_msg("gfx", "unable to create window: %s", SDL_GetError()); return -1; - } + } + + SDL_GetWindowSize(m_pWindow, Width, Height); + + m_GLContext = SDL_GL_CreateContext(m_pWindow); + + if(m_GLContext == NULL) + { + dbg_msg("gfx", "unable to create OpenGL context: %s", SDL_GetError()); + return -1; + } #if defined(CONF_FAMILY_WINDOWS) glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D"); @@ -699,11 +716,9 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *pWidth, int *pHeig } #endif - SDL_ShowCursor(0); + SDL_GL_SetSwapInterval(Flags&IGraphicsBackend::INITFLAG_VSYNC ? 1 : 0); - // fetch gl contexts and release the context from this thread - m_GLContext = GL_GetCurrentContext(); - GL_ReleaseContext(m_GLContext); + SDL_GL_MakeCurrent(NULL, NULL); // start the command processor m_pProcessor = new CCommandProcessor_SDL_OpenGL; @@ -715,7 +730,8 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *pWidth, int *pHeig CmdOpenGL.m_pTextureMemoryUsage = &m_TextureMemoryUsage; CmdBuffer.AddCommand(CmdOpenGL); CCommandProcessorFragment_SDL::SCommand_Init CmdSDL; - CmdSDL.m_Context = m_GLContext; + CmdSDL.m_pWindow = m_pWindow; + CmdSDL.m_GLContext = m_GLContext; CmdBuffer.AddCommand(CmdSDL); RunBuffer(&CmdBuffer); WaitForIdle(); @@ -738,6 +754,8 @@ int CGraphicsBackend_SDL_OpenGL::Shutdown() delete m_pProcessor; m_pProcessor = 0; + SDL_GL_DeleteContext(m_GLContext); + SDL_DestroyWindow(m_pWindow); SDL_QuitSubSystem(SDL_INIT_VIDEO); return 0; } @@ -749,7 +767,7 @@ int CGraphicsBackend_SDL_OpenGL::MemoryUsage() const void CGraphicsBackend_SDL_OpenGL::Minimize() { - SDL_WM_IconifyWindow(); + SDL_MinimizeWindow(m_pWindow); } void CGraphicsBackend_SDL_OpenGL::Maximize() @@ -759,12 +777,12 @@ void CGraphicsBackend_SDL_OpenGL::Maximize() int CGraphicsBackend_SDL_OpenGL::WindowActive() { - return SDL_GetAppState()&SDL_APPINPUTFOCUS; + return SDL_GetWindowFlags(m_pWindow)&SDL_WINDOW_INPUT_FOCUS; } int CGraphicsBackend_SDL_OpenGL::WindowOpen() { - return SDL_GetAppState()&SDL_APPACTIVE; + return SDL_GetWindowFlags(m_pWindow)&SDL_WINDOW_SHOWN; } diff --git a/src/engine/client/backend_sdl.h b/src/engine/client/backend_sdl.h index fa724e75e..a7d767469 100644 --- a/src/engine/client/backend_sdl.h +++ b/src/engine/client/backend_sdl.h @@ -2,29 +2,7 @@ #include "graphics_threaded.h" - -// platform dependent implementations for transfering render context from the main thread to the graphics thread -// TODO: when SDL 1.3 comes, this can be removed -#if defined(CONF_FAMILY_WINDOWS) - struct SGLContext - { - HDC m_hDC; - HGLRC m_hGLRC; - }; - - static SGLContext GL_GetCurrentContext() - { - SGLContext Context; - Context.m_hDC = wglGetCurrentDC(); - Context.m_hGLRC = wglGetCurrentContext(); - return Context; - } - - static void GL_MakeCurrent(const SGLContext &Context) { wglMakeCurrent(Context.m_hDC, Context.m_hGLRC); } - static void GL_ReleaseContext(const SGLContext &Context) { wglMakeCurrent(NULL, NULL); } - static void GL_SwapBuffers(const SGLContext &Context) { SwapBuffers(Context.m_hDC); } -#elif defined(CONF_PLATFORM_MACOSX) - +#if defined(CONF_PLATFORM_MACOSX) #include class semaphore @@ -37,39 +15,6 @@ void signal() { SDL_SemPost(sem); } }; - struct SGLContext - { - id m_Context; - }; - - static SGLContext GL_GetCurrentContext() - { - SGLContext Context; - Class NSOpenGLContextClass = (Class) objc_getClass("NSOpenGLContext"); - SEL selector = sel_registerName("currentContext"); - Context.m_Context = objc_msgSend((objc_object*) NSOpenGLContextClass, selector); - return Context; - } - - static void GL_MakeCurrent(const SGLContext &Context) - { - SEL selector = sel_registerName("makeCurrentContext"); - objc_msgSend(Context.m_Context, selector); - } - - static void GL_ReleaseContext(const SGLContext &Context) - { - Class NSOpenGLContextClass = (Class) objc_getClass("NSOpenGLContext"); - SEL selector = sel_registerName("clearCurrentContext"); - objc_msgSend((objc_object*) NSOpenGLContextClass, selector); - } - - static void GL_SwapBuffers(const SGLContext &Context) - { - SEL selector = sel_registerName("flushBuffer"); - objc_msgSend(Context.m_Context, selector); - } - class CAutoreleasePool { private: @@ -89,33 +34,7 @@ SEL selector = sel_registerName("drain"); objc_msgSend(m_Pool, selector); } - }; - -#elif defined(CONF_FAMILY_UNIX) - - #include - - struct SGLContext - { - Display *m_pDisplay; - GLXDrawable m_Drawable; - GLXContext m_Context; }; - - static SGLContext GL_GetCurrentContext() - { - SGLContext Context; - Context.m_pDisplay = glXGetCurrentDisplay(); - Context.m_Drawable = glXGetCurrentDrawable(); - Context.m_Context = glXGetCurrentContext(); - return Context; - } - - static void GL_MakeCurrent(const SGLContext &Context) { glXMakeCurrent(Context.m_pDisplay, Context.m_Drawable, Context.m_Context); } - static void GL_ReleaseContext(const SGLContext &Context) { glXMakeCurrent(Context.m_pDisplay, None, 0x0); } - static void GL_SwapBuffers(const SGLContext &Context) { glXSwapBuffers(Context.m_pDisplay, Context.m_Drawable); } -#else - #error missing implementation #endif @@ -219,7 +138,8 @@ public: class CCommandProcessorFragment_SDL { // SDL stuff - SGLContext m_GLContext; + SDL_Window *m_pWindow; + SDL_GLContext m_GLContext; public: enum { @@ -230,7 +150,8 @@ public: struct SCommand_Init : public CCommandBuffer::SCommand { SCommand_Init() : SCommand(CMD_INIT) {} - SGLContext m_Context; + SDL_Window *m_pWindow; + SDL_GLContext m_GLContext; }; struct SCommand_Shutdown : public CCommandBuffer::SCommand @@ -262,12 +183,12 @@ class CCommandProcessor_SDL_OpenGL : public CGraphicsBackend_Threaded::ICommandP // graphics backend implemented with SDL and OpenGL class CGraphicsBackend_SDL_OpenGL : public CGraphicsBackend_Threaded { - SDL_Surface *m_pScreenSurface; + SDL_Window *m_pWindow; + SDL_GLContext m_GLContext; ICommandProcessor *m_pProcessor; - SGLContext m_GLContext; volatile int m_TextureMemoryUsage; public: - virtual int Init(const char *pName, int *Width, int *Height, int FsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight); + virtual int Init(const char *pName, int Screen, int *Width, int *Height, int FsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight); virtual int Shutdown(); virtual int MemoryUsage() const; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 41dc0c8b3..411bc0884 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1851,19 +1851,19 @@ void CClient::Run() } // panic quit button - if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyPressed('q')) + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyPressed(KEY_Q)) { Quit(); break; } - if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('d')) + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_D)) g_Config.m_Debug ^= 1; - if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('g')) + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_G)) g_Config.m_DbgGraphs ^= 1; - if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('e')) + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_E)) { g_Config.m_ClEditor = g_Config.m_ClEditor^1; Input()->MouseModeRelative(); diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index 2f2e0c3f0..41b5d7c29 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -718,7 +718,7 @@ int CGraphics_Threaded::IssueInit() if(g_Config.m_GfxVsync) Flags |= IGraphicsBackend::INITFLAG_VSYNC; if(g_Config.m_DbgResizable) Flags |= IGraphicsBackend::INITFLAG_RESIZABLE; - return m_pBackend->Init("Teeworlds", &g_Config.m_GfxScreenWidth, &g_Config.m_GfxScreenHeight, g_Config.m_GfxFsaaSamples, Flags, &m_DesktopScreenWidth, &m_DesktopScreenHeight); + return m_pBackend->Init("Teeworlds", g_Config.m_GfxScreen, &g_Config.m_GfxScreenWidth, &g_Config.m_GfxScreenHeight, g_Config.m_GfxFsaaSamples, Flags, &m_DesktopScreenWidth, &m_DesktopScreenHeight); } int CGraphics_Threaded::InitWindow() @@ -907,7 +907,7 @@ void CGraphics_Threaded::WaitForIdle() m_pBackend->WaitForIdle(); } -int CGraphics_Threaded::GetVideoModes(CVideoMode *pModes, int MaxModes) +int CGraphics_Threaded::GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen) { if(g_Config.m_GfxDisplayAllModes) { @@ -923,7 +923,7 @@ int CGraphics_Threaded::GetVideoModes(CVideoMode *pModes, int MaxModes) mem_zero(&Image, sizeof(Image)); int NumModes = 0; - CCommandBuffer::SCommand_VideoModes Cmd; + CCommandBuffer::SCommand_VideoModes Cmd(Screen); Cmd.m_pModes = pModes; Cmd.m_MaxModes = MaxModes; Cmd.m_pNumModes = &NumModes; diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h index 1f0eb198a..959260bc1 100644 --- a/src/engine/client/graphics_threaded.h +++ b/src/engine/client/graphics_threaded.h @@ -188,11 +188,13 @@ public: struct SCommand_VideoModes : public SCommand { - SCommand_VideoModes() : SCommand(CMD_VIDEOMODES) {} + SCommand_VideoModes(int screen) : SCommand(CMD_VIDEOMODES), + m_Screen(screen) {} CVideoMode *m_pModes; // processor will fill this in int m_MaxModes; // maximum of modes the processor can write to the m_pModes int *m_pNumModes; // processor will write to this pointer + int m_Screen; }; struct SCommand_Swap : public SCommand @@ -300,7 +302,7 @@ public: virtual ~IGraphicsBackend() {} - virtual int Init(const char *pName, int *pWidth, int *pHeight, int FsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight) = 0; + virtual int Init(const char *pName, int Screen, int *pWidth, int *pHeight, int FsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight) = 0; virtual int Shutdown() = 0; virtual int MemoryUsage() const = 0; @@ -433,7 +435,7 @@ public: virtual void TakeScreenshot(const char *pFilename); virtual void Swap(); - virtual int GetVideoModes(CVideoMode *pModes, int MaxModes); + virtual int GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen); virtual int GetDesktopScreenWidth() const { return m_DesktopScreenWidth; } virtual int GetDesktopScreenHeight() const { return m_DesktopScreenHeight; } diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index 972ebdf09..9712f0fea 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -46,8 +46,10 @@ CInput::CInput() void CInput::Init() { m_pGraphics = Kernel()->RequestInterface(); - SDL_EnableUNICODE(1); - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); + // FIXME: unicode handling: use SDL_StartTextInput/SDL_StopTextInput on inputs + // FIXME: key repeat: not a global setting anymore; need to do manually + + SDL_SetRelativeMouseMode(SDL_TRUE); } void CInput::MouseRelative(float *x, float *y) @@ -55,16 +57,9 @@ void CInput::MouseRelative(float *x, float *y) int nx = 0, ny = 0; float Sens = g_Config.m_InpMousesens/100.0f; - if(g_Config.m_InpGrab) - SDL_GetRelativeMouseState(&nx, &ny); - else + if(m_InputGrabbed) { - if(m_InputGrabbed) - { - SDL_GetMouseState(&nx,&ny); - SDL_WarpMouse(Graphics()->ScreenWidth()/2,Graphics()->ScreenHeight()/2); - nx -= Graphics()->ScreenWidth()/2; ny -= Graphics()->ScreenHeight()/2; - } + SDL_GetRelativeMouseState(&nx,&ny); } *x = nx*Sens; @@ -73,18 +68,14 @@ void CInput::MouseRelative(float *x, float *y) void CInput::MouseModeAbsolute() { - SDL_ShowCursor(1); m_InputGrabbed = 0; - if(g_Config.m_InpGrab) - SDL_WM_GrabInput(SDL_GRAB_OFF); + SDL_SetRelativeMouseMode(SDL_FALSE); } void CInput::MouseModeRelative() { - SDL_ShowCursor(0); m_InputGrabbed = 1; - if(g_Config.m_InpGrab) - SDL_WM_GrabInput(SDL_GRAB_ON); + SDL_SetRelativeMouseMode(SDL_TRUE); } int CInput::MouseDoubleClick() @@ -128,7 +119,7 @@ int CInput::Update() { int i; - Uint8 *pState = SDL_GetKeyState(&i); + const Uint8 *pState = SDL_GetKeyboardState(&i); if(i >= KEY_LAST) i = KEY_LAST-1; mem_copy(m_aInputState[m_InputCurrent], pState, i); @@ -155,16 +146,23 @@ int CInput::Update() int Action = IInput::FLAG_PRESS; switch (Event.type) { + case SDL_TEXTINPUT: + { + int TextLength, i; + TextLength = strlen(Event.text.text); + for(i = 0; i < TextLength; i++) + { + AddEvent(Event.text.text[i], 0, 0); + } + } + // handle keys case SDL_KEYDOWN: - // skip private use area of the BMP(contains the unicodes for keyboard function keys on MacOS) - if(Event.key.keysym.unicode < 0xE000 || Event.key.keysym.unicode > 0xF8FF) // ignore_convention - AddEvent(Event.key.keysym.unicode, 0, 0); // ignore_convention - Key = Event.key.keysym.sym; // ignore_convention + Key = SDL_GetScancodeFromName(SDL_GetKeyName(Event.key.keysym.sym)); break; case SDL_KEYUP: Action = IInput::FLAG_RELEASE; - Key = Event.key.keysym.sym; // ignore_convention + Key = SDL_GetScancodeFromName(SDL_GetKeyName(Event.key.keysym.sym)); break; // handle mouse buttons @@ -182,14 +180,19 @@ int CInput::Update() if(Event.button.button == SDL_BUTTON_LEFT) Key = KEY_MOUSE_1; // ignore_convention if(Event.button.button == SDL_BUTTON_RIGHT) Key = KEY_MOUSE_2; // ignore_convention if(Event.button.button == SDL_BUTTON_MIDDLE) Key = KEY_MOUSE_3; // ignore_convention - if(Event.button.button == SDL_BUTTON_WHEELUP) Key = KEY_MOUSE_WHEEL_UP; // ignore_convention - if(Event.button.button == SDL_BUTTON_WHEELDOWN) Key = KEY_MOUSE_WHEEL_DOWN; // ignore_convention if(Event.button.button == 6) Key = KEY_MOUSE_6; // ignore_convention if(Event.button.button == 7) Key = KEY_MOUSE_7; // ignore_convention if(Event.button.button == 8) Key = KEY_MOUSE_8; // ignore_convention if(Event.button.button == 9) Key = KEY_MOUSE_9; // ignore_convention break; + case SDL_MOUSEWHEEL: + if(Event.wheel.y > 0) Key = KEY_MOUSE_WHEEL_UP; // ignore_convention + if(Event.wheel.y < 0) Key = KEY_MOUSE_WHEEL_DOWN; // ignore_convention + AddEvent(0, Key, Action); + Action = IInput::FLAG_RELEASE; + break; + // other messages case SDL_QUIT: return 1; diff --git a/src/engine/client/keynames.h b/src/engine/client/keynames.h index 538f17431..28099b1d7 100644 --- a/src/engine/client/keynames.h +++ b/src/engine/client/keynames.h @@ -1,5 +1,3 @@ -/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ -/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* AUTO GENERATED! DO NOT EDIT MANUALLY! */ #ifndef KEYS_INCLUDE @@ -8,105 +6,12 @@ #include -const char g_aaKeyStrings[512][16] = +const char g_aaKeyStrings[512][20] = { - "first", + "unknown", "&1", "&2", "&3", - "&4", - "&5", - "&6", - "&7", - "backspace", - "tab", - "&10", - "&11", - "clear", - "return", - "&14", - "&15", - "&16", - "&17", - "&18", - "pause", - "&20", - "&21", - "&22", - "&23", - "&24", - "&25", - "&26", - "escape", - "&28", - "&29", - "&30", - "&31", - "space", - "exclaim", - "quotedbl", - "hash", - "dollar", - "&37", - "ampersand", - "quote", - "leftparen", - "rightparen", - "asterisk", - "plus", - "comma", - "minus", - "period", - "slash", - "0", - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "colon", - "semicolon", - "less", - "equals", - "greater", - "question", - "at", - "&65", - "&66", - "&67", - "&68", - "&69", - "&70", - "&71", - "&72", - "&73", - "&74", - "&75", - "&76", - "&77", - "&78", - "&79", - "&80", - "&81", - "&82", - "&83", - "&84", - "&85", - "&86", - "&87", - "&88", - "&89", - "&90", - "leftbracket", - "backslash", - "rightbracket", - "caret", - "underscore", - "backquote", "a", "b", "c", @@ -133,165 +38,34 @@ const char g_aaKeyStrings[512][16] = "x", "y", "z", - "&123", - "&124", - "&125", - "&126", - "delete", - "&128", - "&129", - "&130", - "&131", - "&132", - "&133", - "&134", - "&135", - "&136", - "&137", - "&138", - "&139", - "&140", - "&141", - "&142", - "&143", - "&144", - "&145", - "&146", - "&147", - "&148", - "&149", - "&150", - "&151", - "&152", - "&153", - "&154", - "&155", - "&156", - "&157", - "&158", - "&159", - "world_0", - "world_1", - "world_2", - "world_3", - "world_4", - "world_5", - "world_6", - "world_7", - "world_8", - "world_9", - "world_10", - "world_11", - "world_12", - "world_13", - "world_14", - "world_15", - "world_16", - "world_17", - "world_18", - "world_19", - "world_20", - "world_21", - "world_22", - "world_23", - "world_24", - "world_25", - "world_26", - "world_27", - "world_28", - "world_29", - "world_30", - "world_31", - "world_32", - "world_33", - "world_34", - "world_35", - "world_36", - "world_37", - "world_38", - "world_39", - "world_40", - "world_41", - "world_42", - "world_43", - "world_44", - "world_45", - "world_46", - "world_47", - "world_48", - "world_49", - "world_50", - "world_51", - "world_52", - "world_53", - "world_54", - "world_55", - "world_56", - "world_57", - "world_58", - "world_59", - "world_60", - "world_61", - "world_62", - "world_63", - "world_64", - "world_65", - "world_66", - "world_67", - "world_68", - "world_69", - "world_70", - "world_71", - "world_72", - "world_73", - "world_74", - "world_75", - "world_76", - "world_77", - "world_78", - "world_79", - "world_80", - "world_81", - "world_82", - "world_83", - "world_84", - "world_85", - "world_86", - "world_87", - "world_88", - "world_89", - "world_90", - "world_91", - "world_92", - "world_93", - "world_94", - "world_95", - "kp0", - "kp1", - "kp2", - "kp3", - "kp4", - "kp5", - "kp6", - "kp7", - "kp8", - "kp9", - "kp_period", - "kp_divide", - "kp_multiply", - "kp_minus", - "kp_plus", - "kp_enter", - "kp_equals", - "up", - "down", - "right", - "left", - "insert", - "home", - "end", - "pageup", - "pagedown", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "0", + "return", + "escape", + "backspace", + "tab", + "space", + "minus", + "equals", + "leftbracket", + "rightbracket", + "backslash", + "nonushash", + "semicolon", + "apostrophe", + "grave", + "comma", + "period", + "slash", + "capslock", "f1", "f2", "f3", @@ -304,35 +78,221 @@ const char g_aaKeyStrings[512][16] = "f10", "f11", "f12", + "printscreen", + "scrolllock", + "pause", + "insert", + "home", + "pageup", + "delete", + "end", + "pagedown", + "right", + "left", + "down", + "up", + "numlockclear", + "kp_divide", + "kp_multiply", + "kp_minus", + "kp_plus", + "kp_enter", + "kp_1", + "kp_2", + "kp_3", + "kp_4", + "kp_5", + "kp_6", + "kp_7", + "kp_8", + "kp_9", + "kp_0", + "kp_period", + "nonusbackslash", + "application", + "power", + "kp_equals", "f13", "f14", "f15", - "&297", - "&298", - "&299", - "numlock", - "capslock", - "scrollock", - "rshift", - "lshift", - "rctrl", - "lctrl", - "ralt", - "lalt", - "rmeta", - "lmeta", - "lsuper", - "rsuper", - "mode", - "compose", + "f16", + "f17", + "f18", + "f19", + "f20", + "f21", + "f22", + "f23", + "f24", + "execute", "help", - "print", - "sysreq", - "break", "menu", - "power", - "euro", + "select", + "stop", + "again", "undo", + "cut", + "copy", + "paste", + "find", + "mute", + "volumeup", + "volumedown", + "&130", + "&131", + "&132", + "kp_comma", + "kp_equalsas400", + "international1", + "international2", + "international3", + "international4", + "international5", + "international6", + "international7", + "international8", + "international9", + "lang1", + "lang2", + "lang3", + "lang4", + "lang5", + "lang6", + "lang7", + "lang8", + "lang9", + "alterase", + "sysreq", + "cancel", + "clear", + "prior", + "return2", + "separator", + "out", + "oper", + "clearagain", + "crsel", + "exsel", + "&165", + "&166", + "&167", + "&168", + "&169", + "&170", + "&171", + "&172", + "&173", + "&174", + "&175", + "kp_00", + "kp_000", + "thousandsseparator", + "decimalseparator", + "currencyunit", + "currencysubunit", + "kp_leftparen", + "kp_rightparen", + "kp_leftbrace", + "kp_rightbrace", + "kp_tab", + "kp_backspace", + "kp_a", + "kp_b", + "kp_c", + "kp_d", + "kp_e", + "kp_f", + "kp_xor", + "kp_power", + "kp_percent", + "kp_less", + "kp_greater", + "kp_ampersand", + "kp_dblampersand", + "kp_verticalbar", + "kp_dblverticalbar", + "kp_colon", + "kp_hash", + "kp_space", + "kp_at", + "kp_exclam", + "kp_memstore", + "kp_memrecall", + "kp_memclear", + "kp_memadd", + "kp_memsubtract", + "kp_memmultiply", + "kp_memdivide", + "kp_plusminus", + "kp_clear", + "kp_clearentry", + "kp_binary", + "kp_octal", + "kp_decimal", + "kp_hexadecimal", + "&222", + "&223", + "lctrl", + "lshift", + "lalt", + "lgui", + "rctrl", + "rshift", + "ralt", + "rgui", + "&232", + "&233", + "&234", + "&235", + "&236", + "&237", + "&238", + "&239", + "&240", + "&241", + "&242", + "&243", + "&244", + "&245", + "&246", + "&247", + "&248", + "&249", + "&250", + "&251", + "&252", + "&253", + "&254", + "&255", + "&256", + "mode", + "audionext", + "audioprev", + "audiostop", + "audioplay", + "audiomute", + "mediaselect", + "www", + "mail", + "calculator", + "computer", + "ac_search", + "ac_home", + "ac_back", + "ac_forward", + "ac_stop", + "ac_refresh", + "ac_bookmarks", + "brightnessdown", + "brightnessup", + "displayswitch", + "kbdillumtoggle", + "kbdillumdown", + "kbdillumup", + "eject", + "sleep", + "app1", + "app2", "mouse1", "mouse2", "mouse3", @@ -343,7 +303,45 @@ const char g_aaKeyStrings[512][16] = "mouse8", "mousewheelup", "mousewheeldown", - "mouse9", + "&295", + "&296", + "&297", + "&298", + "&299", + "&300", + "&301", + "&302", + "&303", + "&304", + "&305", + "&306", + "&307", + "&308", + "&309", + "&310", + "&311", + "&312", + "&313", + "&314", + "&315", + "&316", + "&317", + "&318", + "&319", + "&320", + "&321", + "&322", + "&323", + "&324", + "&325", + "&326", + "&327", + "&328", + "&329", + "&330", + "&331", + "&332", + "&333", "&334", "&335", "&336", diff --git a/src/engine/graphics.h b/src/engine/graphics.h index aca719751..29a50c7aa 100644 --- a/src/engine/graphics.h +++ b/src/engine/graphics.h @@ -168,7 +168,7 @@ public: virtual void SetColor4(vec4 TopLeft, vec4 TopRight, vec4 BottomLeft, vec4 BottomRight) = 0; virtual void TakeScreenshot(const char *pFilename) = 0; - virtual int GetVideoModes(CVideoMode *pModes, int MaxModes) = 0; + virtual int GetVideoModes(CVideoMode *pModes, int MaxModes, int Screen) = 0; virtual int GetDesktopScreenWidth() const = 0; virtual int GetDesktopScreenHeight() const = 0; diff --git a/src/engine/input.h b/src/engine/input.h index ff36b6b00..ae0ee637a 100644 --- a/src/engine/input.h +++ b/src/engine/input.h @@ -5,7 +5,7 @@ #include "kernel.h" -extern const char g_aaKeyStrings[512][16]; +extern const char g_aaKeyStrings[512][20]; class IInput : public IInterface { diff --git a/src/engine/keys.h b/src/engine/keys.h index 9a138b973..0c8677c35 100644 --- a/src/engine/keys.h +++ b/src/engine/keys.h @@ -1,254 +1,264 @@ -/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ -/* If you are missing that file, acquire a complete release at teeworlds.com. */ #ifndef ENGINE_KEYS_H #define ENGINE_KEYS_H +#if defined(CONF_FAMILY_WINDOWS) + #undef KEY_EXECUTE +#endif /* AUTO GENERATED! DO NOT EDIT MANUALLY! */ enum { - KEY_UNKNOWN = 0, KEY_FIRST = 0, - KEY_BACKSPACE = 8, - KEY_TAB = 9, - KEY_CLEAR = 12, - KEY_RETURN = 13, - KEY_PAUSE = 19, - KEY_ESCAPE = 27, - KEY_SPACE = 32, - KEY_EXCLAIM = 33, - KEY_QUOTEDBL = 34, - KEY_HASH = 35, - KEY_DOLLAR = 36, - KEY_AMPERSAND = 38, - KEY_QUOTE = 39, - KEY_LEFTPAREN = 40, - KEY_RIGHTPAREN = 41, - KEY_ASTERISK = 42, - KEY_PLUS = 43, - KEY_COMMA = 44, + KEY_UNKNOWN = 0, + KEY_A = 4, + KEY_B = 5, + KEY_C = 6, + KEY_D = 7, + KEY_E = 8, + KEY_F = 9, + KEY_G = 10, + KEY_H = 11, + KEY_I = 12, + KEY_J = 13, + KEY_K = 14, + KEY_L = 15, + KEY_M = 16, + KEY_N = 17, + KEY_O = 18, + KEY_P = 19, + KEY_Q = 20, + KEY_R = 21, + KEY_S = 22, + KEY_T = 23, + KEY_U = 24, + KEY_V = 25, + KEY_W = 26, + KEY_X = 27, + KEY_Y = 28, + KEY_Z = 29, + KEY_1 = 30, + KEY_2 = 31, + KEY_3 = 32, + KEY_4 = 33, + KEY_5 = 34, + KEY_6 = 35, + KEY_7 = 36, + KEY_8 = 37, + KEY_9 = 38, + KEY_0 = 39, + KEY_RETURN = 40, + KEY_ESCAPE = 41, + KEY_BACKSPACE = 42, + KEY_TAB = 43, + KEY_SPACE = 44, KEY_MINUS = 45, - KEY_PERIOD = 46, - KEY_SLASH = 47, - KEY_0 = 48, - KEY_1 = 49, - KEY_2 = 50, - KEY_3 = 51, - KEY_4 = 52, - KEY_5 = 53, - KEY_6 = 54, - KEY_7 = 55, - KEY_8 = 56, - KEY_9 = 57, - KEY_COLON = 58, - KEY_SEMICOLON = 59, - KEY_LESS = 60, - KEY_EQUALS = 61, - KEY_GREATER = 62, - KEY_QUESTION = 63, - KEY_AT = 64, - KEY_LEFTBRACKET = 91, - KEY_BACKSLASH = 92, - KEY_RIGHTBRACKET = 93, - KEY_CARET = 94, - KEY_UNDERSCORE = 95, - KEY_BACKQUOTE = 96, - KEY_a = 97, - KEY_b = 98, - KEY_c = 99, - KEY_d = 100, - KEY_e = 101, - KEY_f = 102, - KEY_g = 103, - KEY_h = 104, - KEY_i = 105, - KEY_j = 106, - KEY_k = 107, - KEY_l = 108, - KEY_m = 109, - KEY_n = 110, - KEY_o = 111, - KEY_p = 112, - KEY_q = 113, - KEY_r = 114, - KEY_s = 115, - KEY_t = 116, - KEY_u = 117, - KEY_v = 118, - KEY_w = 119, - KEY_x = 120, - KEY_y = 121, - KEY_z = 122, - KEY_DELETE = 127, - KEY_WORLD_0 = 160, - KEY_WORLD_1 = 161, - KEY_WORLD_2 = 162, - KEY_WORLD_3 = 163, - KEY_WORLD_4 = 164, - KEY_WORLD_5 = 165, - KEY_WORLD_6 = 166, - KEY_WORLD_7 = 167, - KEY_WORLD_8 = 168, - KEY_WORLD_9 = 169, - KEY_WORLD_10 = 170, - KEY_WORLD_11 = 171, - KEY_WORLD_12 = 172, - KEY_WORLD_13 = 173, - KEY_WORLD_14 = 174, - KEY_WORLD_15 = 175, - KEY_WORLD_16 = 176, - KEY_WORLD_17 = 177, - KEY_WORLD_18 = 178, - KEY_WORLD_19 = 179, - KEY_WORLD_20 = 180, - KEY_WORLD_21 = 181, - KEY_WORLD_22 = 182, - KEY_WORLD_23 = 183, - KEY_WORLD_24 = 184, - KEY_WORLD_25 = 185, - KEY_WORLD_26 = 186, - KEY_WORLD_27 = 187, - KEY_WORLD_28 = 188, - KEY_WORLD_29 = 189, - KEY_WORLD_30 = 190, - KEY_WORLD_31 = 191, - KEY_WORLD_32 = 192, - KEY_WORLD_33 = 193, - KEY_WORLD_34 = 194, - KEY_WORLD_35 = 195, - KEY_WORLD_36 = 196, - KEY_WORLD_37 = 197, - KEY_WORLD_38 = 198, - KEY_WORLD_39 = 199, - KEY_WORLD_40 = 200, - KEY_WORLD_41 = 201, - KEY_WORLD_42 = 202, - KEY_WORLD_43 = 203, - KEY_WORLD_44 = 204, - KEY_WORLD_45 = 205, - KEY_WORLD_46 = 206, - KEY_WORLD_47 = 207, - KEY_WORLD_48 = 208, - KEY_WORLD_49 = 209, - KEY_WORLD_50 = 210, - KEY_WORLD_51 = 211, - KEY_WORLD_52 = 212, - KEY_WORLD_53 = 213, - KEY_WORLD_54 = 214, - KEY_WORLD_55 = 215, - KEY_WORLD_56 = 216, - KEY_WORLD_57 = 217, - KEY_WORLD_58 = 218, - KEY_WORLD_59 = 219, - KEY_WORLD_60 = 220, - KEY_WORLD_61 = 221, - KEY_WORLD_62 = 222, - KEY_WORLD_63 = 223, - KEY_WORLD_64 = 224, - KEY_WORLD_65 = 225, - KEY_WORLD_66 = 226, - KEY_WORLD_67 = 227, - KEY_WORLD_68 = 228, - KEY_WORLD_69 = 229, - KEY_WORLD_70 = 230, - KEY_WORLD_71 = 231, - KEY_WORLD_72 = 232, - KEY_WORLD_73 = 233, - KEY_WORLD_74 = 234, - KEY_WORLD_75 = 235, - KEY_WORLD_76 = 236, - KEY_WORLD_77 = 237, - KEY_WORLD_78 = 238, - KEY_WORLD_79 = 239, - KEY_WORLD_80 = 240, - KEY_WORLD_81 = 241, - KEY_WORLD_82 = 242, - KEY_WORLD_83 = 243, - KEY_WORLD_84 = 244, - KEY_WORLD_85 = 245, - KEY_WORLD_86 = 246, - KEY_WORLD_87 = 247, - KEY_WORLD_88 = 248, - KEY_WORLD_89 = 249, - KEY_WORLD_90 = 250, - KEY_WORLD_91 = 251, - KEY_WORLD_92 = 252, - KEY_WORLD_93 = 253, - KEY_WORLD_94 = 254, - KEY_WORLD_95 = 255, - KEY_KP0 = 256, - KEY_KP1 = 257, - KEY_KP2 = 258, - KEY_KP3 = 259, - KEY_KP4 = 260, - KEY_KP5 = 261, - KEY_KP6 = 262, - KEY_KP7 = 263, - KEY_KP8 = 264, - KEY_KP9 = 265, - KEY_KP_PERIOD = 266, - KEY_KP_DIVIDE = 267, - KEY_KP_MULTIPLY = 268, - KEY_KP_MINUS = 269, - KEY_KP_PLUS = 270, - KEY_KP_ENTER = 271, - KEY_KP_EQUALS = 272, - KEY_UP = 273, - KEY_DOWN = 274, - KEY_RIGHT = 275, - KEY_LEFT = 276, - KEY_INSERT = 277, - KEY_HOME = 278, - KEY_END = 279, - KEY_PAGEUP = 280, - KEY_PAGEDOWN = 281, - KEY_F1 = 282, - KEY_F2 = 283, - KEY_F3 = 284, - KEY_F4 = 285, - KEY_F5 = 286, - KEY_F6 = 287, - KEY_F7 = 288, - KEY_F8 = 289, - KEY_F9 = 290, - KEY_F10 = 291, - KEY_F11 = 292, - KEY_F12 = 293, - KEY_F13 = 294, - KEY_F14 = 295, - KEY_F15 = 296, - KEY_NUMLOCK = 300, - KEY_CAPSLOCK = 301, - KEY_SCROLLOCK = 302, - KEY_RSHIFT = 303, - KEY_LSHIFT = 304, - KEY_RCTRL = 305, - KEY_LCTRL = 306, - KEY_RALT = 307, - KEY_LALT = 308, - KEY_RMETA = 309, - KEY_LMETA = 310, - KEY_LSUPER = 311, - KEY_RSUPER = 312, - KEY_MODE = 313, - KEY_COMPOSE = 314, - KEY_HELP = 315, - KEY_PRINT = 316, - KEY_SYSREQ = 317, - KEY_BREAK = 318, - KEY_MENU = 319, - KEY_POWER = 320, - KEY_EURO = 321, - KEY_UNDO = 322, - KEY_MOUSE_1 = 323, - KEY_MOUSE_2 = 324, - KEY_MOUSE_3 = 325, - KEY_MOUSE_4 = 326, - KEY_MOUSE_5 = 327, - KEY_MOUSE_6 = 328, - KEY_MOUSE_7 = 329, - KEY_MOUSE_8 = 330, - KEY_MOUSE_WHEEL_UP = 331, - KEY_MOUSE_WHEEL_DOWN = 332, - KEY_MOUSE_9 = 333, + KEY_EQUALS = 46, + KEY_LEFTBRACKET = 47, + KEY_RIGHTBRACKET = 48, + KEY_BACKSLASH = 49, + KEY_NONUSHASH = 50, + KEY_SEMICOLON = 51, + KEY_APOSTROPHE = 52, + KEY_GRAVE = 53, + KEY_COMMA = 54, + KEY_PERIOD = 55, + KEY_SLASH = 56, + KEY_CAPSLOCK = 57, + KEY_F1 = 58, + KEY_F2 = 59, + KEY_F3 = 60, + KEY_F4 = 61, + KEY_F5 = 62, + KEY_F6 = 63, + KEY_F7 = 64, + KEY_F8 = 65, + KEY_F9 = 66, + KEY_F10 = 67, + KEY_F11 = 68, + KEY_F12 = 69, + KEY_PRINTSCREEN = 70, + KEY_SCROLLLOCK = 71, + KEY_PAUSE = 72, + KEY_INSERT = 73, + KEY_HOME = 74, + KEY_PAGEUP = 75, + KEY_DELETE = 76, + KEY_END = 77, + KEY_PAGEDOWN = 78, + KEY_RIGHT = 79, + KEY_LEFT = 80, + KEY_DOWN = 81, + KEY_UP = 82, + KEY_NUMLOCKCLEAR = 83, + KEY_KP_DIVIDE = 84, + KEY_KP_MULTIPLY = 85, + KEY_KP_MINUS = 86, + KEY_KP_PLUS = 87, + KEY_KP_ENTER = 88, + KEY_KP_1 = 89, + KEY_KP_2 = 90, + KEY_KP_3 = 91, + KEY_KP_4 = 92, + KEY_KP_5 = 93, + KEY_KP_6 = 94, + KEY_KP_7 = 95, + KEY_KP_8 = 96, + KEY_KP_9 = 97, + KEY_KP_0 = 98, + KEY_KP_PERIOD = 99, + KEY_NONUSBACKSLASH = 100, + KEY_APPLICATION = 101, + KEY_POWER = 102, + KEY_KP_EQUALS = 103, + KEY_F13 = 104, + KEY_F14 = 105, + KEY_F15 = 106, + KEY_F16 = 107, + KEY_F17 = 108, + KEY_F18 = 109, + KEY_F19 = 110, + KEY_F20 = 111, + KEY_F21 = 112, + KEY_F22 = 113, + KEY_F23 = 114, + KEY_F24 = 115, + KEY_EXECUTE = 116, + KEY_HELP = 117, + KEY_MENU = 118, + KEY_SELECT = 119, + KEY_STOP = 120, + KEY_AGAIN = 121, + KEY_UNDO = 122, + KEY_CUT = 123, + KEY_COPY = 124, + KEY_PASTE = 125, + KEY_FIND = 126, + KEY_MUTE = 127, + KEY_VOLUMEUP = 128, + KEY_VOLUMEDOWN = 129, + KEY_KP_COMMA = 133, + KEY_KP_EQUALSAS400 = 134, + KEY_INTERNATIONAL1 = 135, + KEY_INTERNATIONAL2 = 136, + KEY_INTERNATIONAL3 = 137, + KEY_INTERNATIONAL4 = 138, + KEY_INTERNATIONAL5 = 139, + KEY_INTERNATIONAL6 = 140, + KEY_INTERNATIONAL7 = 141, + KEY_INTERNATIONAL8 = 142, + KEY_INTERNATIONAL9 = 143, + KEY_LANG1 = 144, + KEY_LANG2 = 145, + KEY_LANG3 = 146, + KEY_LANG4 = 147, + KEY_LANG5 = 148, + KEY_LANG6 = 149, + KEY_LANG7 = 150, + KEY_LANG8 = 151, + KEY_LANG9 = 152, + KEY_ALTERASE = 153, + KEY_SYSREQ = 154, + KEY_CANCEL = 155, + KEY_CLEAR = 156, + KEY_PRIOR = 157, + KEY_RETURN2 = 158, + KEY_SEPARATOR = 159, + KEY_OUT = 160, + KEY_OPER = 161, + KEY_CLEARAGAIN = 162, + KEY_CRSEL = 163, + KEY_EXSEL = 164, + KEY_KP_00 = 176, + KEY_KP_000 = 177, + KEY_THOUSANDSSEPARATOR = 178, + KEY_DECIMALSEPARATOR = 179, + KEY_CURRENCYUNIT = 180, + KEY_CURRENCYSUBUNIT = 181, + KEY_KP_LEFTPAREN = 182, + KEY_KP_RIGHTPAREN = 183, + KEY_KP_LEFTBRACE = 184, + KEY_KP_RIGHTBRACE = 185, + KEY_KP_TAB = 186, + KEY_KP_BACKSPACE = 187, + KEY_KP_A = 188, + KEY_KP_B = 189, + KEY_KP_C = 190, + KEY_KP_D = 191, + KEY_KP_E = 192, + KEY_KP_F = 193, + KEY_KP_XOR = 194, + KEY_KP_POWER = 195, + KEY_KP_PERCENT = 196, + KEY_KP_LESS = 197, + KEY_KP_GREATER = 198, + KEY_KP_AMPERSAND = 199, + KEY_KP_DBLAMPERSAND = 200, + KEY_KP_VERTICALBAR = 201, + KEY_KP_DBLVERTICALBAR = 202, + KEY_KP_COLON = 203, + KEY_KP_HASH = 204, + KEY_KP_SPACE = 205, + KEY_KP_AT = 206, + KEY_KP_EXCLAM = 207, + KEY_KP_MEMSTORE = 208, + KEY_KP_MEMRECALL = 209, + KEY_KP_MEMCLEAR = 210, + KEY_KP_MEMADD = 211, + KEY_KP_MEMSUBTRACT = 212, + KEY_KP_MEMMULTIPLY = 213, + KEY_KP_MEMDIVIDE = 214, + KEY_KP_PLUSMINUS = 215, + KEY_KP_CLEAR = 216, + KEY_KP_CLEARENTRY = 217, + KEY_KP_BINARY = 218, + KEY_KP_OCTAL = 219, + KEY_KP_DECIMAL = 220, + KEY_KP_HEXADECIMAL = 221, + KEY_LCTRL = 224, + KEY_LSHIFT = 225, + KEY_LALT = 226, + KEY_LGUI = 227, + KEY_RCTRL = 228, + KEY_RSHIFT = 229, + KEY_RALT = 230, + KEY_RGUI = 231, + KEY_MODE = 257, + KEY_AUDIONEXT = 258, + KEY_AUDIOPREV = 259, + KEY_AUDIOSTOP = 260, + KEY_AUDIOPLAY = 261, + KEY_AUDIOMUTE = 262, + KEY_MEDIASELECT = 263, + KEY_WWW = 264, + KEY_MAIL = 265, + KEY_CALCULATOR = 266, + KEY_COMPUTER = 267, + KEY_AC_SEARCH = 268, + KEY_AC_HOME = 269, + KEY_AC_BACK = 270, + KEY_AC_FORWARD = 271, + KEY_AC_STOP = 272, + KEY_AC_REFRESH = 273, + KEY_AC_BOOKMARKS = 274, + KEY_BRIGHTNESSDOWN = 275, + KEY_BRIGHTNESSUP = 276, + KEY_DISPLAYSWITCH = 277, + KEY_KBDILLUMTOGGLE = 278, + KEY_KBDILLUMDOWN = 279, + KEY_KBDILLUMUP = 280, + KEY_EJECT = 281, + KEY_SLEEP = 282, + KEY_APP1 = 283, + KEY_APP2 = 284, + KEY_MOUSE_1 = 285, + KEY_MOUSE_2 = 286, + KEY_MOUSE_3 = 287, + KEY_MOUSE_4 = 288, + KEY_MOUSE_5 = 289, + KEY_MOUSE_6 = 290, + KEY_MOUSE_7 = 291, + KEY_MOUSE_8 = 292, + KEY_MOUSE_WHEEL_UP = 293, + KEY_MOUSE_WHEEL_DOWN = 294, + KEY_MOUSE_9 = 295, KEY_LAST, }; diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 50d93955c..d4c30778f 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -24,8 +24,6 @@ MACRO_CONFIG_INT(ClAutoDemoMax, cl_auto_demo_max, 10, 0, 1000, CFGFLAG_SAVE|CFGF MACRO_CONFIG_INT(ClAutoScreenshot, cl_auto_screenshot, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Automatically take game over screenshot") MACRO_CONFIG_INT(ClAutoScreenshotMax, cl_auto_screenshot_max, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Maximum number of automatically created screenshots (0 = no limit)") -MACRO_CONFIG_INT(InpGrab, inp_grab, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use forceful input grabbing method") - MACRO_CONFIG_STR(BrFilterString, br_filter_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string") MACRO_CONFIG_INT(BrFilterFull, br_filter_full, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out full server in browser") MACRO_CONFIG_INT(BrFilterEmpty, br_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out empty server in browser") @@ -55,6 +53,7 @@ MACRO_CONFIG_INT(SndDevice, snd_device, -1, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, " MACRO_CONFIG_INT(SndNonactiveMute, snd_nonactive_mute, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") +MACRO_CONFIG_INT(GfxScreen, gfx_screen, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen index") MACRO_CONFIG_INT(GfxScreenWidth, gfx_screen_width, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution width") MACRO_CONFIG_INT(GfxScreenHeight, gfx_screen_height, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution height") MACRO_CONFIG_INT(GfxBorderless, gfx_borderless, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Borderless window (not to be used with fullscreen)") diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index b8b18b2cd..c71cd1783 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -285,7 +285,7 @@ void CMapLayers::OnRender() Render = true; } - if(Render && pLayer->m_Type == LAYERTYPE_TILES && Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_KP0)) + if(Render && pLayer->m_Type == LAYERTYPE_TILES && Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_KP_0)) { CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer; CTile *pTiles = (CTile *)pLayers->Map()->GetData(pTMap->m_Data); diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index b6d77eb51..7a351aa13 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -1486,7 +1486,7 @@ void CMenus::UpdatedFilteredVideoModes() void CMenus::OnInit() { - m_NumModes = Graphics()->GetVideoModes(m_aModes, MAX_RESOLUTIONS); + m_NumModes = Graphics()->GetVideoModes(m_aModes, MAX_RESOLUTIONS, g_Config.m_GfxScreen); UpdateVideoFormats(); bool Found = false; diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 07a9f4f43..df9a99243 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -1319,7 +1319,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) if(DoButton_CheckBox(&s_GfxDisplayAllModes, Localize("Show only supported"), g_Config.m_GfxDisplayAllModes^1, &Button)) { g_Config.m_GfxDisplayAllModes ^= 1; - m_NumModes = Graphics()->GetVideoModes(m_aModes, MAX_RESOLUTIONS); + m_NumModes = Graphics()->GetVideoModes(m_aModes, MAX_RESOLUTIONS, g_Config.m_GfxScreen); UpdateVideoFormats(); bool Found = false; @@ -1445,7 +1445,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) if(g_Config.m_GfxDisplayAllModes) { g_Config.m_GfxDisplayAllModes = 0; - m_NumModes = Graphics()->GetVideoModes(m_aModes, MAX_RESOLUTIONS); + m_NumModes = Graphics()->GetVideoModes(m_aModes, MAX_RESOLUTIONS, g_Config.m_GfxScreen); UpdateVideoFormats(); bool Found = false; diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 8d4b08bf6..e0dc6bcd7 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -846,7 +846,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Bottom.HSplitTop(2.5f, 0, &TB_Bottom); // ctrl+o to open - if(Input()->KeyDown('o') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE) + if(Input()->KeyDown(KEY_O) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE) { if(HasUnsavedData()) { @@ -861,7 +861,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) } // ctrl+s to save - if(Input()->KeyDown('s') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE) + if(Input()->KeyDown(KEY_S) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE) { if(m_aFileName[0] && m_ValidSaveFilename) { @@ -880,7 +880,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_HqButton = 0; if(DoButton_Editor(&s_HqButton, "HD", m_ShowDetail, &Button, 0, "[ctrl+h] Toggle High Detail") || - (Input()->KeyDown('h') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + (Input()->KeyDown(KEY_H) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) { m_ShowDetail = !m_ShowDetail; } @@ -891,7 +891,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); static int s_AnimateButton = 0; if(DoButton_Editor(&s_AnimateButton, "Anim", m_Animate, &Button, 0, "[ctrl+m] Toggle animation") || - (Input()->KeyDown('m') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + (Input()->KeyDown(KEY_M) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) { m_AnimateStart = time_get(); m_Animate = !m_Animate; @@ -903,7 +903,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); static int s_ProofButton = 0; if(DoButton_Editor(&s_ProofButton, "Proof", m_ProofBorders, &Button, 0, "[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.") || - (Input()->KeyDown('p') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + (Input()->KeyDown(KEY_P) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) { m_ProofBorders = !m_ProofBorders; } @@ -914,7 +914,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); static int s_TileInfoButton = 0; if(DoButton_Editor(&s_TileInfoButton, "Info", m_ShowTileInfo, &Button, 0, "[ctrl+i] Show tile informations") || - (Input()->KeyDown('i') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + (Input()->KeyDown(KEY_I) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) { m_ShowTileInfo = !m_ShowTileInfo; m_ShowEnvelopePreview = SHOWENV_NONE; @@ -973,7 +973,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) // flip buttons TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_FlipXButton = 0; - if(DoButton_Ex(&s_FlipXButton, "X/X", Enabled, &Button, 0, "[N] Flip brush horizontal", CUI::CORNER_L) || Input()->KeyDown('n')) + if(DoButton_Ex(&s_FlipXButton, "X/X", Enabled, &Button, 0, "[N] Flip brush horizontal", CUI::CORNER_L) || Input()->KeyDown(KEY_N)) { for(int i = 0; i < m_Brush.m_lLayers.size(); i++) m_Brush.m_lLayers[i]->BrushFlipX(); @@ -981,7 +981,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_FlipyButton = 0; - if(DoButton_Ex(&s_FlipyButton, "Y/Y", Enabled, &Button, 0, "[M] Flip brush vertical", CUI::CORNER_R) || Input()->KeyDown('m')) + if(DoButton_Ex(&s_FlipyButton, "Y/Y", Enabled, &Button, 0, "[M] Flip brush vertical", CUI::CORNER_R) || Input()->KeyDown(KEY_M)) { for(int i = 0; i < m_Brush.m_lLayers.size(); i++) m_Brush.m_lLayers[i]->BrushFlipY(); @@ -1006,7 +1006,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(5.0f, &Button, &TB_Top); TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_CcwButton = 0; - if(DoButton_Ex(&s_CcwButton, "CCW", Enabled, &Button, 0, "[R] Rotates the brush counter clockwise", CUI::CORNER_L) || Input()->KeyDown('r')) + if(DoButton_Ex(&s_CcwButton, "CCW", Enabled, &Button, 0, "[R] Rotates the brush counter clockwise", CUI::CORNER_L) || Input()->KeyDown(KEY_R)) { for(int i = 0; i < m_Brush.m_lLayers.size(); i++) m_Brush.m_lLayers[i]->BrushRotate(-s_RotationAmount/360.0f*pi*2); @@ -1014,7 +1014,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_CwButton = 0; - if(DoButton_Ex(&s_CwButton, "CW", Enabled, &Button, 0, "[T] Rotates the brush clockwise", CUI::CORNER_R) || Input()->KeyDown('t')) + if(DoButton_Ex(&s_CwButton, "CW", Enabled, &Button, 0, "[T] Rotates the brush clockwise", CUI::CORNER_R) || Input()->KeyDown(KEY_T)) { for(int i = 0; i < m_Brush.m_lLayers.size(); i++) m_Brush.m_lLayers[i]->BrushRotate(s_RotationAmount/360.0f*pi*2);