From 33127563fdf374b9f13b62f79a842abc06c6c90d Mon Sep 17 00:00:00 2001 From: Christian Treffs Date: Tue, 2 Nov 2021 21:02:17 +0100 Subject: [PATCH] Expose scancode for SDL based keys (#5) * Add scancode to SDL based keys * Remove GH token from CI --- .github/workflows/ci-linux.yml | 15 - .github/workflows/ci-macos.yml | 16 - .github/workflows/markdown-link-check.yml | 3 - .github/workflows/mlc_config.json | 3 - .../FirebladePAL/Platform/SDL/SDLEvents.swift | 492 +---------------- .../FirebladePAL/Platform/SDL/SDLKeys.swift | 516 ++++++++++++++++++ 6 files changed, 518 insertions(+), 527 deletions(-) create mode 100644 Sources/FirebladePAL/Platform/SDL/SDLKeys.swift diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index cb58047..9a35bb6 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -19,17 +19,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2.3.4 - with: - token: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} - env: - GITHUB_TOKEN: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} - - - name: Setup private access - run: | - git config --global credential.helper "" - git config --global --add credential.helper store - echo "https://x-access-token:${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }}@github.com" >> ~/.git-credentials - git config --global url."https://github.com/".insteadof git@github.com: - name: Restore APT cache uses: actions/cache@v2.1.6 @@ -60,8 +49,6 @@ jobs: - name: Test run: make test - env: - GITHUB_TOKEN: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} - name: Upload test artifacts if: failure() @@ -74,8 +61,6 @@ jobs: - name: Build Release run: make build-release - env: - GITHUB_TOKEN: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} - name: Upload build artifacts if: failure() diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 6f793d3..7ddd273 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -15,22 +15,8 @@ jobs: xcode: ["13.0"] if: contains( github.event.pull_request.labels.*.name, 'ci-macOS') || contains( github.event.pull_request.labels.*.name, 'ci-all') steps: - - name: Add access token to keychain - env: - GITHUB_TOKEN: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} - run: | - echo "\ - protocol=https - host=github.com - username=Personal Access Token - password=$GITHUB_TOKEN" | git credential-osxkeychain store - - name: Checkout uses: actions/checkout@v2.3.4 - with: - token: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} - env: - GITHUB_TOKEN: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} - name: Restore cached Homebrew dependencies uses: actions/cache@v2.1.6 @@ -62,7 +48,6 @@ jobs: run: make test env: DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer - GITHUB_TOKEN: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} FRB_ENABLE_GRAPHICS_VULKAN: 0 # disable Vulkan on macOS CI until setup is smoothed out. - name: Upload test artifacts @@ -78,7 +63,6 @@ jobs: run: make build-release env: DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer - GITHUB_TOKEN: ${{ secrets.GH_FIREBLADE_ACCESS_TOKEN }} FRB_ENABLE_GRAPHICS_VULKAN: 0 # disable Vulkan on macOS CI until setup is smoothed out. - name: Upload build artifacts diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/markdown-link-check.yml index 34a401d..975e857 100644 --- a/.github/workflows/markdown-link-check.yml +++ b/.github/workflows/markdown-link-check.yml @@ -15,9 +15,6 @@ jobs: - name: Checkout uses: actions/checkout@v2.3.4 - - name: Inject GH token into config - run: sed -i 's/GITHUB_TOKEN/${{ secrets.GITHUB_TOKEN }}/g' .github/workflows/mlc_config.json - - name: markdown-link-check uses: gaurav-nelson/github-action-markdown-link-check@1.0.13 with: diff --git a/.github/workflows/mlc_config.json b/.github/workflows/mlc_config.json index 68feba8..6278e67 100644 --- a/.github/workflows/mlc_config.json +++ b/.github/workflows/mlc_config.json @@ -9,9 +9,6 @@ "urls": [ "https://github.com" ], - "headers": { - "Authorization": "Bearer GITHUB_TOKEN" - } } ] } \ No newline at end of file diff --git a/Sources/FirebladePAL/Platform/SDL/SDLEvents.swift b/Sources/FirebladePAL/Platform/SDL/SDLEvents.swift index fa5df2d..2221efe 100644 --- a/Sources/FirebladePAL/Platform/SDL/SDLEvents.swift +++ b/Sources/FirebladePAL/Platform/SDL/SDLEvents.swift @@ -228,10 +228,10 @@ event.isRepeat = (sdlEvent.repeat != 0) // SDL virtual key code; see SDL_Keycode for details - event.virtualKey = Self.virtualKeyMap[SDL_KeyCode(UInt32(sdlEvent.keysym.sym))] + event.virtualKey = KeyCode.virtualKeyMap[SDL_KeyCode(UInt32(sdlEvent.keysym.sym))] // SDL physical key code; see SDL_Scancode for details - event.physicalKey = Self.physicalKeyMap[sdlEvent.keysym.scancode]! + event.physicalKey = KeyCode.physicalKeyMap[sdlEvent.keysym.scancode]! // current key modifiers; see SDL_Keymod for details translateKeyboardModifiers(sdlModifiers: SDL_Keymod(UInt32(sdlEvent.keysym.mod)), modifiers: &event.modifiers) @@ -295,494 +295,6 @@ event.length = Int(sdlEvent.length) } - private static let virtualKeyMap: [AnyHashable: KeyCode] = [ - SDLK_0: ._0, - SDLK_1: ._1, - SDLK_2: ._2, - SDLK_3: ._3, - SDLK_4: ._4, - SDLK_5: ._5, - SDLK_6: ._6, - SDLK_7: ._7, - SDLK_8: ._8, - SDLK_9: ._9, - SDLK_AC_BACK: .AC_BACK, - SDLK_AC_BOOKMARKS: .AC_BOOKMARKS, - SDLK_AC_FORWARD: .AC_FORWARD, - SDLK_AC_HOME: .AC_HOME, - SDLK_AC_REFRESH: .AC_REFRESH, - SDLK_AC_SEARCH: .AC_SEARCH, - SDLK_AC_STOP: .AC_STOP, - SDLK_AGAIN: .AGAIN, - SDLK_ALTERASE: .ALTERASE, - SDLK_AMPERSAND: .AMPERSAND, - SDLK_APP1: .APP1, - SDLK_APP2: .APP2, - SDLK_APPLICATION: .APPLICATION, - SDLK_ASTERISK: .ASTERISK, - SDLK_AT: .AT, - SDLK_AUDIOFASTFORWARD: .AUDIOFASTFORWARD, - SDLK_AUDIOMUTE: .AUDIOMUTE, - SDLK_AUDIONEXT: .AUDIONEXT, - SDLK_AUDIOPLAY: .AUDIOPLAY, - SDLK_AUDIOPREV: .AUDIOPREV, - SDLK_AUDIOREWIND: .AUDIOREWIND, - SDLK_AUDIOSTOP: .AUDIOSTOP, - SDLK_BACKQUOTE: .BACKQUOTE, - SDLK_BACKSLASH: .BACKSLASH, - SDLK_BACKSPACE: .BACKSPACE, - SDLK_BRIGHTNESSDOWN: .BRIGHTNESSDOWN, - SDLK_BRIGHTNESSUP: .BRIGHTNESSUP, - SDLK_CALCULATOR: .CALCULATOR, - SDLK_CANCEL: .CANCEL, - SDLK_CAPSLOCK: .CAPSLOCK, - SDLK_CARET: .CARET, - SDLK_CLEAR: .CLEAR, - SDLK_CLEARAGAIN: .CLEARAGAIN, - SDLK_COLON: .COLON, - SDLK_COMMA: .COMMA, - SDLK_COMPUTER: .COMPUTER, - SDLK_COPY: .COPY, - SDLK_CRSEL: .CRSEL, - SDLK_CURRENCYSUBUNIT: .CURRENCYSUBUNIT, - SDLK_CURRENCYUNIT: .CURRENCYUNIT, - SDLK_CUT: .CUT, - SDLK_DECIMALSEPARATOR: .DECIMALSEPARATOR, - SDLK_DELETE: .DELETE, - SDLK_DISPLAYSWITCH: .DISPLAYSWITCH, - SDLK_DOLLAR: .DOLLAR, - SDLK_DOWN: .DOWN, - SDLK_EJECT: .EJECT, - SDLK_END: .END, - SDLK_EQUALS: .EQUALS, - SDLK_ESCAPE: .ESCAPE, - SDLK_EXCLAIM: .EXCLAIM, - SDLK_EXECUTE: .EXECUTE, - SDLK_EXSEL: .EXSEL, - SDLK_F10: .F10, - SDLK_F11: .F11, - SDLK_F12: .F12, - SDLK_F13: .F13, - SDLK_F14: .F14, - SDLK_F15: .F15, - SDLK_F16: .F16, - SDLK_F17: .F17, - SDLK_F18: .F18, - SDLK_F19: .F19, - SDLK_F1: .F1, - SDLK_F20: .F20, - SDLK_F21: .F21, - SDLK_F22: .F22, - SDLK_F23: .F23, - SDLK_F24: .F24, - SDLK_F2: .F2, - SDLK_F3: .F3, - SDLK_F4: .F4, - SDLK_F5: .F5, - SDLK_F6: .F6, - SDLK_F7: .F7, - SDLK_F8: .F8, - SDLK_F9: .F9, - SDLK_FIND: .FIND, - SDLK_GREATER: .GREATER, - SDLK_HASH: .HASH, - SDLK_HELP: .HELP, - SDLK_HOME: .HOME, - SDLK_INSERT: .INSERT, - SDLK_KBDILLUMDOWN: .KBDILLUMDOWN, - SDLK_KBDILLUMTOGGLE: .KBDILLUMTOGGLE, - SDLK_KBDILLUMUP: .KBDILLUMUP, - SDLK_KP_000: .KP_000, - SDLK_KP_00: .KP_00, - SDLK_KP_0: .KP_0, - SDLK_KP_1: .KP_1, - SDLK_KP_2: .KP_2, - SDLK_KP_3: .KP_3, - SDLK_KP_4: .KP_4, - SDLK_KP_5: .KP_5, - SDLK_KP_6: .KP_6, - SDLK_KP_7: .KP_7, - SDLK_KP_8: .KP_8, - SDLK_KP_9: .KP_9, - SDLK_KP_A: .KP_A, - SDLK_KP_AMPERSAND: .KP_AMPERSAND, - SDLK_KP_AT: .KP_AT, - SDLK_KP_B: .KP_B, - SDLK_KP_BACKSPACE: .KP_BACKSPACE, - SDLK_KP_BINARY: .KP_BINARY, - SDLK_KP_C: .KP_C, - SDLK_KP_CLEAR: .KP_CLEAR, - SDLK_KP_CLEARENTRY: .KP_CLEARENTRY, - SDLK_KP_COLON: .KP_COLON, - SDLK_KP_COMMA: .KP_COMMA, - SDLK_KP_D: .KP_D, - SDLK_KP_DBLAMPERSAND: .KP_DBLAMPERSAND, - SDLK_KP_DBLVERTICALBAR: .KP_DBLVERTICALBAR, - SDLK_KP_DECIMAL: .KP_DECIMAL, - SDLK_KP_DIVIDE: .KP_DIVIDE, - SDLK_KP_E: .KP_E, - SDLK_KP_ENTER: .KP_ENTER, - SDLK_KP_EQUALS: .KP_EQUALS, - SDLK_KP_EQUALSAS400: .KP_EQUALSAS400, - SDLK_KP_EXCLAM: .KP_EXCLAM, - SDLK_KP_F: .KP_F, - SDLK_KP_GREATER: .KP_GREATER, - SDLK_KP_HASH: .KP_HASH, - SDLK_KP_HEXADECIMAL: .KP_HEXADECIMAL, - SDLK_KP_LEFTBRACE: .KP_LEFTBRACE, - SDLK_KP_LEFTPAREN: .KP_LEFTPAREN, - SDLK_KP_LESS: .KP_LESS, - SDLK_KP_MEMADD: .KP_MEMADD, - SDLK_KP_MEMCLEAR: .KP_MEMCLEAR, - SDLK_KP_MEMDIVIDE: .KP_MEMDIVIDE, - SDLK_KP_MEMMULTIPLY: .KP_MEMMULTIPLY, - SDLK_KP_MEMRECALL: .KP_MEMRECALL, - SDLK_KP_MEMSTORE: .KP_MEMSTORE, - SDLK_KP_MEMSUBTRACT: .KP_MEMSUBTRACT, - SDLK_KP_MINUS: .KP_MINUS, - SDLK_KP_MULTIPLY: .KP_MULTIPLY, - SDLK_KP_OCTAL: .KP_OCTAL, - SDLK_KP_PERCENT: .KP_PERCENT, - SDLK_KP_PERIOD: .KP_PERIOD, - SDLK_KP_PLUS: .KP_PLUS, - SDLK_KP_PLUSMINUS: .KP_PLUSMINUS, - SDLK_KP_POWER: .KP_POWER, - SDLK_KP_RIGHTBRACE: .KP_RIGHTBRACE, - SDLK_KP_RIGHTPAREN: .KP_RIGHTPAREN, - SDLK_KP_SPACE: .KP_SPACE, - SDLK_KP_TAB: .KP_TAB, - SDLK_KP_VERTICALBAR: .KP_VERTICALBAR, - SDLK_KP_XOR: .KP_XOR, - SDLK_LALT: .LALT, - SDLK_LCTRL: .LCTRL, - SDLK_LEFT: .LEFT, - SDLK_LEFTBRACKET: .LEFTBRACKET, - SDLK_LEFTPAREN: .LEFTPAREN, - SDLK_LESS: .LESS, - SDLK_LGUI: .LGUI, - SDLK_LSHIFT: .LSHIFT, - SDLK_MAIL: .MAIL, - SDLK_MEDIASELECT: .MEDIASELECT, - SDLK_MENU: .MENU, - SDLK_MINUS: .MINUS, - SDLK_MODE: .MODE, - SDLK_MUTE: .MUTE, - SDLK_NUMLOCKCLEAR: .NUMLOCKCLEAR, - SDLK_OPER: .OPER, - SDLK_OUT: .OUT, - SDLK_PAGEDOWN: .PAGEDOWN, - SDLK_PAGEUP: .PAGEUP, - SDLK_PASTE: .PASTE, - SDLK_PAUSE: .PAUSE, - SDLK_PERCENT: .PERCENT, - SDLK_PERIOD: .PERIOD, - SDLK_PLUS: .PLUS, - SDLK_POWER: .POWER, - SDLK_PRINTSCREEN: .PRINTSCREEN, - SDLK_PRIOR: .PRIOR, - SDLK_QUESTION: .QUESTION, - SDLK_QUOTE: .QUOTE, - SDLK_QUOTEDBL: .QUOTEDBL, - SDLK_RALT: .RALT, - SDLK_RCTRL: .RCTRL, - SDLK_RETURN2: .RETURN2, - SDLK_RETURN: .RETURN, - SDLK_RGUI: .RGUI, - SDLK_RIGHT: .RIGHT, - SDLK_RIGHTBRACKET: .RIGHTBRACKET, - SDLK_RIGHTPAREN: .RIGHTPAREN, - SDLK_RSHIFT: .RSHIFT, - SDLK_SCROLLLOCK: .SCROLLLOCK, - SDLK_SELECT: .SELECT, - SDLK_SEMICOLON: .SEMICOLON, - SDLK_SEPARATOR: .SEPARATOR, - SDLK_SLASH: .SLASH, - SDLK_SLEEP: .SLEEP, - SDLK_SPACE: .SPACE, - SDLK_STOP: .STOP, - SDLK_SYSREQ: .SYSREQ, - SDLK_TAB: .TAB, - SDLK_THOUSANDSSEPARATOR: .THOUSANDSSEPARATOR, - SDLK_UNDERSCORE: .UNDERSCORE, - SDLK_UNDO: .UNDO, - SDLK_UNKNOWN: .UNKNOWN, - SDLK_UP: .UP, - SDLK_VOLUMEDOWN: .VOLUMEDOWN, - SDLK_VOLUMEUP: .VOLUMEUP, - SDLK_WWW: .WWW, - SDLK_a: .A, - SDLK_b: .B, - SDLK_c: .C, - SDLK_d: .D, - SDLK_e: .E, - SDLK_f: .F, - SDLK_g: .G, - SDLK_h: .H, - SDLK_i: .I, - SDLK_j: .J, - SDLK_k: .K, - SDLK_l: .L, - SDLK_m: .M, - SDLK_n: .N, - SDLK_o: .O, - SDLK_p: .P, - SDLK_q: .Q, - SDLK_r: .R, - SDLK_s: .S, - SDLK_t: .T, - SDLK_u: .U, - SDLK_v: .V, - SDLK_w: .W, - SDLK_x: .X, - SDLK_y: .Y, - SDLK_z: .Z, - ] - - private static let physicalKeyMap: [SDL_Scancode: KeyCode] = [ - SDL_SCANCODE_0: ._0, - SDL_SCANCODE_1: ._1, - SDL_SCANCODE_2: ._2, - SDL_SCANCODE_3: ._3, - SDL_SCANCODE_4: ._4, - SDL_SCANCODE_5: ._5, - SDL_SCANCODE_6: ._6, - SDL_SCANCODE_7: ._7, - SDL_SCANCODE_8: ._8, - SDL_SCANCODE_9: ._9, - SDL_SCANCODE_A: .A, - SDL_SCANCODE_AC_BACK: .AC_BACK, - SDL_SCANCODE_AC_BOOKMARKS: .AC_BOOKMARKS, - SDL_SCANCODE_AC_FORWARD: .AC_FORWARD, - SDL_SCANCODE_AC_HOME: .AC_HOME, - SDL_SCANCODE_AC_REFRESH: .AC_REFRESH, - SDL_SCANCODE_AC_SEARCH: .AC_SEARCH, - SDL_SCANCODE_AC_STOP: .AC_STOP, - SDL_SCANCODE_AGAIN: .AGAIN, - SDL_SCANCODE_ALTERASE: .ALTERASE, - SDL_SCANCODE_APOSTROPHE: .APOSTROPHE, - SDL_SCANCODE_APP1: .APP1, - SDL_SCANCODE_APP2: .APP2, - SDL_SCANCODE_APPLICATION: .APPLICATION, - SDL_SCANCODE_AUDIOFASTFORWARD: .AUDIOFASTFORWARD, - SDL_SCANCODE_AUDIOMUTE: .AUDIOMUTE, - SDL_SCANCODE_AUDIONEXT: .AUDIONEXT, - SDL_SCANCODE_AUDIOPLAY: .AUDIOPLAY, - SDL_SCANCODE_AUDIOPREV: .AUDIOPREV, - SDL_SCANCODE_AUDIOREWIND: .AUDIOREWIND, - SDL_SCANCODE_AUDIOSTOP: .AUDIOSTOP, - SDL_SCANCODE_B: .B, - SDL_SCANCODE_BACKSLASH: .BACKSLASH, - SDL_SCANCODE_BACKSPACE: .BACKSPACE, - SDL_SCANCODE_BRIGHTNESSDOWN: .BRIGHTNESSDOWN, - SDL_SCANCODE_BRIGHTNESSUP: .BRIGHTNESSUP, - SDL_SCANCODE_C: .C, - SDL_SCANCODE_CALCULATOR: .CALCULATOR, - SDL_SCANCODE_CANCEL: .CANCEL, - SDL_SCANCODE_CAPSLOCK: .CAPSLOCK, - SDL_SCANCODE_CLEAR: .CLEAR, - SDL_SCANCODE_CLEARAGAIN: .CLEARAGAIN, - SDL_SCANCODE_COMMA: .COMMA, - SDL_SCANCODE_COMPUTER: .COMPUTER, - SDL_SCANCODE_COPY: .COPY, - SDL_SCANCODE_CRSEL: .CRSEL, - SDL_SCANCODE_CURRENCYSUBUNIT: .CURRENCYSUBUNIT, - SDL_SCANCODE_CURRENCYUNIT: .CURRENCYUNIT, - SDL_SCANCODE_CUT: .CUT, - SDL_SCANCODE_D: .D, - SDL_SCANCODE_DECIMALSEPARATOR: .DECIMALSEPARATOR, - SDL_SCANCODE_DELETE: .DELETE, - SDL_SCANCODE_DISPLAYSWITCH: .DISPLAYSWITCH, - SDL_SCANCODE_DOWN: .DOWN, - SDL_SCANCODE_E: .E, - SDL_SCANCODE_EJECT: .EJECT, - SDL_SCANCODE_END: .END, - SDL_SCANCODE_EQUALS: .EQUALS, - SDL_SCANCODE_ESCAPE: .ESCAPE, - SDL_SCANCODE_EXECUTE: .EXECUTE, - SDL_SCANCODE_EXSEL: .EXSEL, - SDL_SCANCODE_F: .F, - SDL_SCANCODE_F1: .F1, - SDL_SCANCODE_F10: .F10, - SDL_SCANCODE_F11: .F11, - SDL_SCANCODE_F12: .F12, - SDL_SCANCODE_F13: .F13, - SDL_SCANCODE_F14: .F14, - SDL_SCANCODE_F15: .F15, - SDL_SCANCODE_F16: .F16, - SDL_SCANCODE_F17: .F17, - SDL_SCANCODE_F18: .F18, - SDL_SCANCODE_F19: .F19, - SDL_SCANCODE_F2: .F2, - SDL_SCANCODE_F20: .F20, - SDL_SCANCODE_F21: .F21, - SDL_SCANCODE_F22: .F22, - SDL_SCANCODE_F23: .F23, - SDL_SCANCODE_F24: .F24, - SDL_SCANCODE_F3: .F3, - SDL_SCANCODE_F4: .F4, - SDL_SCANCODE_F5: .F5, - SDL_SCANCODE_F6: .F6, - SDL_SCANCODE_F7: .F7, - SDL_SCANCODE_F8: .F8, - SDL_SCANCODE_F9: .F9, - SDL_SCANCODE_FIND: .FIND, - SDL_SCANCODE_G: .G, - SDL_SCANCODE_GRAVE: .GRAVE, - SDL_SCANCODE_H: .H, - SDL_SCANCODE_HELP: .HELP, - SDL_SCANCODE_HOME: .HOME, - SDL_SCANCODE_I: .I, - SDL_SCANCODE_INSERT: .INSERT, - SDL_SCANCODE_INTERNATIONAL1: .INTERNATIONAL1, - SDL_SCANCODE_INTERNATIONAL2: .INTERNATIONAL2, - SDL_SCANCODE_INTERNATIONAL3: .INTERNATIONAL3, - SDL_SCANCODE_INTERNATIONAL4: .INTERNATIONAL4, - SDL_SCANCODE_INTERNATIONAL5: .INTERNATIONAL5, - SDL_SCANCODE_INTERNATIONAL6: .INTERNATIONAL6, - SDL_SCANCODE_INTERNATIONAL7: .INTERNATIONAL7, - SDL_SCANCODE_INTERNATIONAL8: .INTERNATIONAL8, - SDL_SCANCODE_INTERNATIONAL9: .INTERNATIONAL9, - SDL_SCANCODE_J: .J, - SDL_SCANCODE_K: .K, - SDL_SCANCODE_KBDILLUMDOWN: .KBDILLUMDOWN, - SDL_SCANCODE_KBDILLUMTOGGLE: .KBDILLUMTOGGLE, - SDL_SCANCODE_KBDILLUMUP: .KBDILLUMUP, - SDL_SCANCODE_KP_0: .KP_0, - SDL_SCANCODE_KP_00: .KP_00, - SDL_SCANCODE_KP_000: .KP_000, - SDL_SCANCODE_KP_1: .KP_1, - SDL_SCANCODE_KP_2: .KP_2, - SDL_SCANCODE_KP_3: .KP_3, - SDL_SCANCODE_KP_4: .KP_4, - SDL_SCANCODE_KP_5: .KP_5, - SDL_SCANCODE_KP_6: .KP_6, - SDL_SCANCODE_KP_7: .KP_7, - SDL_SCANCODE_KP_8: .KP_8, - SDL_SCANCODE_KP_9: .KP_9, - SDL_SCANCODE_KP_A: .KP_A, - SDL_SCANCODE_KP_AMPERSAND: .KP_AMPERSAND, - SDL_SCANCODE_KP_AT: .KP_AT, - SDL_SCANCODE_KP_B: .KP_B, - SDL_SCANCODE_KP_BACKSPACE: .KP_BACKSPACE, - SDL_SCANCODE_KP_BINARY: .KP_BINARY, - SDL_SCANCODE_KP_C: .KP_C, - SDL_SCANCODE_KP_CLEAR: .KP_CLEAR, - SDL_SCANCODE_KP_CLEARENTRY: .KP_CLEARENTRY, - SDL_SCANCODE_KP_COLON: .KP_COLON, - SDL_SCANCODE_KP_COMMA: .KP_COMMA, - SDL_SCANCODE_KP_D: .KP_D, - SDL_SCANCODE_KP_DBLAMPERSAND: .KP_DBLAMPERSAND, - SDL_SCANCODE_KP_DBLVERTICALBAR: .KP_DBLVERTICALBAR, - SDL_SCANCODE_KP_DECIMAL: .KP_DECIMAL, - SDL_SCANCODE_KP_DIVIDE: .KP_DIVIDE, - SDL_SCANCODE_KP_E: .KP_E, - SDL_SCANCODE_KP_ENTER: .KP_ENTER, - SDL_SCANCODE_KP_EQUALS: .KP_EQUALS, - SDL_SCANCODE_KP_EQUALSAS400: .KP_EQUALSAS400, - SDL_SCANCODE_KP_EXCLAM: .KP_EXCLAM, - SDL_SCANCODE_KP_F: .KP_F, - SDL_SCANCODE_KP_GREATER: .KP_GREATER, - SDL_SCANCODE_KP_HASH: .KP_HASH, - SDL_SCANCODE_KP_HEXADECIMAL: .KP_HEXADECIMAL, - SDL_SCANCODE_KP_LEFTBRACE: .KP_LEFTBRACE, - SDL_SCANCODE_KP_LEFTPAREN: .KP_LEFTPAREN, - SDL_SCANCODE_KP_LESS: .KP_LESS, - SDL_SCANCODE_KP_MEMADD: .KP_MEMADD, - SDL_SCANCODE_KP_MEMCLEAR: .KP_MEMCLEAR, - SDL_SCANCODE_KP_MEMDIVIDE: .KP_MEMDIVIDE, - SDL_SCANCODE_KP_MEMMULTIPLY: .KP_MEMMULTIPLY, - SDL_SCANCODE_KP_MEMRECALL: .KP_MEMRECALL, - SDL_SCANCODE_KP_MEMSTORE: .KP_MEMSTORE, - SDL_SCANCODE_KP_MEMSUBTRACT: .KP_MEMSUBTRACT, - SDL_SCANCODE_KP_MINUS: .KP_MINUS, - SDL_SCANCODE_KP_MULTIPLY: .KP_MULTIPLY, - SDL_SCANCODE_KP_OCTAL: .KP_OCTAL, - SDL_SCANCODE_KP_PERCENT: .KP_PERCENT, - SDL_SCANCODE_KP_PERIOD: .KP_PERIOD, - SDL_SCANCODE_KP_PLUS: .KP_PLUS, - SDL_SCANCODE_KP_PLUSMINUS: .KP_PLUSMINUS, - SDL_SCANCODE_KP_POWER: .KP_POWER, - SDL_SCANCODE_KP_RIGHTBRACE: .KP_RIGHTBRACE, - SDL_SCANCODE_KP_RIGHTPAREN: .KP_RIGHTPAREN, - SDL_SCANCODE_KP_SPACE: .KP_SPACE, - SDL_SCANCODE_KP_TAB: .KP_TAB, - SDL_SCANCODE_KP_VERTICALBAR: .KP_VERTICALBAR, - SDL_SCANCODE_KP_XOR: .KP_XOR, - SDL_SCANCODE_L: .L, - SDL_SCANCODE_LALT: .LALT, - SDL_SCANCODE_LANG1: .LANG1, - SDL_SCANCODE_LANG2: .LANG2, - SDL_SCANCODE_LANG3: .LANG3, - SDL_SCANCODE_LANG4: .LANG4, - SDL_SCANCODE_LANG5: .LANG5, - SDL_SCANCODE_LANG6: .LANG6, - SDL_SCANCODE_LANG7: .LANG7, - SDL_SCANCODE_LANG8: .LANG8, - SDL_SCANCODE_LANG9: .LANG9, - SDL_SCANCODE_LCTRL: .LCTRL, - SDL_SCANCODE_LEFT: .LEFT, - SDL_SCANCODE_LEFTBRACKET: .LEFTBRACKET, - SDL_SCANCODE_LGUI: .LGUI, - SDL_SCANCODE_LSHIFT: .LSHIFT, - SDL_SCANCODE_M: .M, - SDL_SCANCODE_MAIL: .MAIL, - SDL_SCANCODE_MEDIASELECT: .MEDIASELECT, - SDL_SCANCODE_MENU: .MENU, - SDL_SCANCODE_MINUS: .MINUS, - SDL_SCANCODE_MODE: .MODE, - SDL_SCANCODE_MUTE: .MUTE, - SDL_SCANCODE_N: .N, - SDL_SCANCODE_NONUSBACKSLASH: .NONUSBACKSLASH, - SDL_SCANCODE_NONUSHASH: .NONUSHASH, - SDL_SCANCODE_NUMLOCKCLEAR: .NUMLOCKCLEAR, - SDL_SCANCODE_O: .O, - SDL_SCANCODE_OPER: .OPER, - SDL_SCANCODE_OUT: .OUT, - SDL_SCANCODE_P: .P, - SDL_SCANCODE_PAGEDOWN: .PAGEDOWN, - SDL_SCANCODE_PAGEUP: .PAGEUP, - SDL_SCANCODE_PASTE: .PASTE, - SDL_SCANCODE_PAUSE: .PAUSE, - SDL_SCANCODE_PERIOD: .PERIOD, - SDL_SCANCODE_POWER: .POWER, - SDL_SCANCODE_PRINTSCREEN: .PRINTSCREEN, - SDL_SCANCODE_PRIOR: .PRIOR, - SDL_SCANCODE_Q: .Q, - SDL_SCANCODE_R: .R, - SDL_SCANCODE_RALT: .RALT, - SDL_SCANCODE_RCTRL: .RCTRL, - SDL_SCANCODE_RETURN: .RETURN, - SDL_SCANCODE_RETURN2: .RETURN2, - SDL_SCANCODE_RGUI: .RGUI, - SDL_SCANCODE_RIGHT: .RIGHT, - SDL_SCANCODE_RIGHTBRACKET: .RIGHTBRACKET, - SDL_SCANCODE_RSHIFT: .RSHIFT, - SDL_SCANCODE_S: .S, - SDL_SCANCODE_SCROLLLOCK: .SCROLLLOCK, - SDL_SCANCODE_SELECT: .SELECT, - SDL_SCANCODE_SEMICOLON: .SEMICOLON, - SDL_SCANCODE_SEPARATOR: .SEPARATOR, - SDL_SCANCODE_SLASH: .SLASH, - SDL_SCANCODE_SLEEP: .SLEEP, - SDL_SCANCODE_SPACE: .SPACE, - SDL_SCANCODE_STOP: .STOP, - SDL_SCANCODE_SYSREQ: .SYSREQ, - SDL_SCANCODE_T: .T, - SDL_SCANCODE_TAB: .TAB, - SDL_SCANCODE_THOUSANDSSEPARATOR: .THOUSANDSSEPARATOR, - SDL_SCANCODE_U: .U, - SDL_SCANCODE_UNDO: .UNDO, - SDL_SCANCODE_UP: .UP, - SDL_SCANCODE_V: .V, - SDL_SCANCODE_VOLUMEDOWN: .VOLUMEDOWN, - SDL_SCANCODE_VOLUMEUP: .VOLUMEUP, - SDL_SCANCODE_W: .W, - SDL_SCANCODE_WWW: .WWW, - SDL_SCANCODE_X: .X, - SDL_SCANCODE_Y: .Y, - SDL_SCANCODE_Z: .Z, - ] - static let pointerButtonMap: [Int32: PointerButton] = [ SDL_BUTTON_LEFT: .left, SDL_BUTTON_MIDDLE: .middle, diff --git a/Sources/FirebladePAL/Platform/SDL/SDLKeys.swift b/Sources/FirebladePAL/Platform/SDL/SDLKeys.swift new file mode 100644 index 0000000..ee13545 --- /dev/null +++ b/Sources/FirebladePAL/Platform/SDL/SDLKeys.swift @@ -0,0 +1,516 @@ +// +// SDLKeys.swift +// Fireblade PAL +// +// Copyright © 2018-2021 Fireblade Team. All rights reserved. +// Licensed under MIT License. See LICENSE file for details. + +#if FRB_PLATFORM_SDL + + @_implementationOnly import SDL2 + + extension KeyCode { + public init?(scancode: UInt) { + guard let keyCode = Self.physicalKeyMap[SDL_Scancode(rawValue: SDL_Scancode.RawValue(scancode))] else { + return nil + } + self = keyCode + } + + public var scancode: UInt? { + guard let (scanCode, _) = Self.physicalKeyMap.first(where: { $0.value == self }) else { + return nil + } + return UInt(scanCode.rawValue) + } + + static let virtualKeyMap: [AnyHashable: KeyCode] = [ + SDLK_0: ._0, + SDLK_1: ._1, + SDLK_2: ._2, + SDLK_3: ._3, + SDLK_4: ._4, + SDLK_5: ._5, + SDLK_6: ._6, + SDLK_7: ._7, + SDLK_8: ._8, + SDLK_9: ._9, + SDLK_AC_BACK: .AC_BACK, + SDLK_AC_BOOKMARKS: .AC_BOOKMARKS, + SDLK_AC_FORWARD: .AC_FORWARD, + SDLK_AC_HOME: .AC_HOME, + SDLK_AC_REFRESH: .AC_REFRESH, + SDLK_AC_SEARCH: .AC_SEARCH, + SDLK_AC_STOP: .AC_STOP, + SDLK_AGAIN: .AGAIN, + SDLK_ALTERASE: .ALTERASE, + SDLK_AMPERSAND: .AMPERSAND, + SDLK_APP1: .APP1, + SDLK_APP2: .APP2, + SDLK_APPLICATION: .APPLICATION, + SDLK_ASTERISK: .ASTERISK, + SDLK_AT: .AT, + SDLK_AUDIOFASTFORWARD: .AUDIOFASTFORWARD, + SDLK_AUDIOMUTE: .AUDIOMUTE, + SDLK_AUDIONEXT: .AUDIONEXT, + SDLK_AUDIOPLAY: .AUDIOPLAY, + SDLK_AUDIOPREV: .AUDIOPREV, + SDLK_AUDIOREWIND: .AUDIOREWIND, + SDLK_AUDIOSTOP: .AUDIOSTOP, + SDLK_BACKQUOTE: .BACKQUOTE, + SDLK_BACKSLASH: .BACKSLASH, + SDLK_BACKSPACE: .BACKSPACE, + SDLK_BRIGHTNESSDOWN: .BRIGHTNESSDOWN, + SDLK_BRIGHTNESSUP: .BRIGHTNESSUP, + SDLK_CALCULATOR: .CALCULATOR, + SDLK_CANCEL: .CANCEL, + SDLK_CAPSLOCK: .CAPSLOCK, + SDLK_CARET: .CARET, + SDLK_CLEAR: .CLEAR, + SDLK_CLEARAGAIN: .CLEARAGAIN, + SDLK_COLON: .COLON, + SDLK_COMMA: .COMMA, + SDLK_COMPUTER: .COMPUTER, + SDLK_COPY: .COPY, + SDLK_CRSEL: .CRSEL, + SDLK_CURRENCYSUBUNIT: .CURRENCYSUBUNIT, + SDLK_CURRENCYUNIT: .CURRENCYUNIT, + SDLK_CUT: .CUT, + SDLK_DECIMALSEPARATOR: .DECIMALSEPARATOR, + SDLK_DELETE: .DELETE, + SDLK_DISPLAYSWITCH: .DISPLAYSWITCH, + SDLK_DOLLAR: .DOLLAR, + SDLK_DOWN: .DOWN, + SDLK_EJECT: .EJECT, + SDLK_END: .END, + SDLK_EQUALS: .EQUALS, + SDLK_ESCAPE: .ESCAPE, + SDLK_EXCLAIM: .EXCLAIM, + SDLK_EXECUTE: .EXECUTE, + SDLK_EXSEL: .EXSEL, + SDLK_F10: .F10, + SDLK_F11: .F11, + SDLK_F12: .F12, + SDLK_F13: .F13, + SDLK_F14: .F14, + SDLK_F15: .F15, + SDLK_F16: .F16, + SDLK_F17: .F17, + SDLK_F18: .F18, + SDLK_F19: .F19, + SDLK_F1: .F1, + SDLK_F20: .F20, + SDLK_F21: .F21, + SDLK_F22: .F22, + SDLK_F23: .F23, + SDLK_F24: .F24, + SDLK_F2: .F2, + SDLK_F3: .F3, + SDLK_F4: .F4, + SDLK_F5: .F5, + SDLK_F6: .F6, + SDLK_F7: .F7, + SDLK_F8: .F8, + SDLK_F9: .F9, + SDLK_FIND: .FIND, + SDLK_GREATER: .GREATER, + SDLK_HASH: .HASH, + SDLK_HELP: .HELP, + SDLK_HOME: .HOME, + SDLK_INSERT: .INSERT, + SDLK_KBDILLUMDOWN: .KBDILLUMDOWN, + SDLK_KBDILLUMTOGGLE: .KBDILLUMTOGGLE, + SDLK_KBDILLUMUP: .KBDILLUMUP, + SDLK_KP_000: .KP_000, + SDLK_KP_00: .KP_00, + SDLK_KP_0: .KP_0, + SDLK_KP_1: .KP_1, + SDLK_KP_2: .KP_2, + SDLK_KP_3: .KP_3, + SDLK_KP_4: .KP_4, + SDLK_KP_5: .KP_5, + SDLK_KP_6: .KP_6, + SDLK_KP_7: .KP_7, + SDLK_KP_8: .KP_8, + SDLK_KP_9: .KP_9, + SDLK_KP_A: .KP_A, + SDLK_KP_AMPERSAND: .KP_AMPERSAND, + SDLK_KP_AT: .KP_AT, + SDLK_KP_B: .KP_B, + SDLK_KP_BACKSPACE: .KP_BACKSPACE, + SDLK_KP_BINARY: .KP_BINARY, + SDLK_KP_C: .KP_C, + SDLK_KP_CLEAR: .KP_CLEAR, + SDLK_KP_CLEARENTRY: .KP_CLEARENTRY, + SDLK_KP_COLON: .KP_COLON, + SDLK_KP_COMMA: .KP_COMMA, + SDLK_KP_D: .KP_D, + SDLK_KP_DBLAMPERSAND: .KP_DBLAMPERSAND, + SDLK_KP_DBLVERTICALBAR: .KP_DBLVERTICALBAR, + SDLK_KP_DECIMAL: .KP_DECIMAL, + SDLK_KP_DIVIDE: .KP_DIVIDE, + SDLK_KP_E: .KP_E, + SDLK_KP_ENTER: .KP_ENTER, + SDLK_KP_EQUALS: .KP_EQUALS, + SDLK_KP_EQUALSAS400: .KP_EQUALSAS400, + SDLK_KP_EXCLAM: .KP_EXCLAM, + SDLK_KP_F: .KP_F, + SDLK_KP_GREATER: .KP_GREATER, + SDLK_KP_HASH: .KP_HASH, + SDLK_KP_HEXADECIMAL: .KP_HEXADECIMAL, + SDLK_KP_LEFTBRACE: .KP_LEFTBRACE, + SDLK_KP_LEFTPAREN: .KP_LEFTPAREN, + SDLK_KP_LESS: .KP_LESS, + SDLK_KP_MEMADD: .KP_MEMADD, + SDLK_KP_MEMCLEAR: .KP_MEMCLEAR, + SDLK_KP_MEMDIVIDE: .KP_MEMDIVIDE, + SDLK_KP_MEMMULTIPLY: .KP_MEMMULTIPLY, + SDLK_KP_MEMRECALL: .KP_MEMRECALL, + SDLK_KP_MEMSTORE: .KP_MEMSTORE, + SDLK_KP_MEMSUBTRACT: .KP_MEMSUBTRACT, + SDLK_KP_MINUS: .KP_MINUS, + SDLK_KP_MULTIPLY: .KP_MULTIPLY, + SDLK_KP_OCTAL: .KP_OCTAL, + SDLK_KP_PERCENT: .KP_PERCENT, + SDLK_KP_PERIOD: .KP_PERIOD, + SDLK_KP_PLUS: .KP_PLUS, + SDLK_KP_PLUSMINUS: .KP_PLUSMINUS, + SDLK_KP_POWER: .KP_POWER, + SDLK_KP_RIGHTBRACE: .KP_RIGHTBRACE, + SDLK_KP_RIGHTPAREN: .KP_RIGHTPAREN, + SDLK_KP_SPACE: .KP_SPACE, + SDLK_KP_TAB: .KP_TAB, + SDLK_KP_VERTICALBAR: .KP_VERTICALBAR, + SDLK_KP_XOR: .KP_XOR, + SDLK_LALT: .LALT, + SDLK_LCTRL: .LCTRL, + SDLK_LEFT: .LEFT, + SDLK_LEFTBRACKET: .LEFTBRACKET, + SDLK_LEFTPAREN: .LEFTPAREN, + SDLK_LESS: .LESS, + SDLK_LGUI: .LGUI, + SDLK_LSHIFT: .LSHIFT, + SDLK_MAIL: .MAIL, + SDLK_MEDIASELECT: .MEDIASELECT, + SDLK_MENU: .MENU, + SDLK_MINUS: .MINUS, + SDLK_MODE: .MODE, + SDLK_MUTE: .MUTE, + SDLK_NUMLOCKCLEAR: .NUMLOCKCLEAR, + SDLK_OPER: .OPER, + SDLK_OUT: .OUT, + SDLK_PAGEDOWN: .PAGEDOWN, + SDLK_PAGEUP: .PAGEUP, + SDLK_PASTE: .PASTE, + SDLK_PAUSE: .PAUSE, + SDLK_PERCENT: .PERCENT, + SDLK_PERIOD: .PERIOD, + SDLK_PLUS: .PLUS, + SDLK_POWER: .POWER, + SDLK_PRINTSCREEN: .PRINTSCREEN, + SDLK_PRIOR: .PRIOR, + SDLK_QUESTION: .QUESTION, + SDLK_QUOTE: .QUOTE, + SDLK_QUOTEDBL: .QUOTEDBL, + SDLK_RALT: .RALT, + SDLK_RCTRL: .RCTRL, + SDLK_RETURN2: .RETURN2, + SDLK_RETURN: .RETURN, + SDLK_RGUI: .RGUI, + SDLK_RIGHT: .RIGHT, + SDLK_RIGHTBRACKET: .RIGHTBRACKET, + SDLK_RIGHTPAREN: .RIGHTPAREN, + SDLK_RSHIFT: .RSHIFT, + SDLK_SCROLLLOCK: .SCROLLLOCK, + SDLK_SELECT: .SELECT, + SDLK_SEMICOLON: .SEMICOLON, + SDLK_SEPARATOR: .SEPARATOR, + SDLK_SLASH: .SLASH, + SDLK_SLEEP: .SLEEP, + SDLK_SPACE: .SPACE, + SDLK_STOP: .STOP, + SDLK_SYSREQ: .SYSREQ, + SDLK_TAB: .TAB, + SDLK_THOUSANDSSEPARATOR: .THOUSANDSSEPARATOR, + SDLK_UNDERSCORE: .UNDERSCORE, + SDLK_UNDO: .UNDO, + SDLK_UNKNOWN: .UNKNOWN, + SDLK_UP: .UP, + SDLK_VOLUMEDOWN: .VOLUMEDOWN, + SDLK_VOLUMEUP: .VOLUMEUP, + SDLK_WWW: .WWW, + SDLK_a: .A, + SDLK_b: .B, + SDLK_c: .C, + SDLK_d: .D, + SDLK_e: .E, + SDLK_f: .F, + SDLK_g: .G, + SDLK_h: .H, + SDLK_i: .I, + SDLK_j: .J, + SDLK_k: .K, + SDLK_l: .L, + SDLK_m: .M, + SDLK_n: .N, + SDLK_o: .O, + SDLK_p: .P, + SDLK_q: .Q, + SDLK_r: .R, + SDLK_s: .S, + SDLK_t: .T, + SDLK_u: .U, + SDLK_v: .V, + SDLK_w: .W, + SDLK_x: .X, + SDLK_y: .Y, + SDLK_z: .Z, + ] + + static let physicalKeyMap: [SDL_Scancode: KeyCode] = [ + SDL_SCANCODE_0: ._0, + SDL_SCANCODE_1: ._1, + SDL_SCANCODE_2: ._2, + SDL_SCANCODE_3: ._3, + SDL_SCANCODE_4: ._4, + SDL_SCANCODE_5: ._5, + SDL_SCANCODE_6: ._6, + SDL_SCANCODE_7: ._7, + SDL_SCANCODE_8: ._8, + SDL_SCANCODE_9: ._9, + SDL_SCANCODE_A: .A, + SDL_SCANCODE_AC_BACK: .AC_BACK, + SDL_SCANCODE_AC_BOOKMARKS: .AC_BOOKMARKS, + SDL_SCANCODE_AC_FORWARD: .AC_FORWARD, + SDL_SCANCODE_AC_HOME: .AC_HOME, + SDL_SCANCODE_AC_REFRESH: .AC_REFRESH, + SDL_SCANCODE_AC_SEARCH: .AC_SEARCH, + SDL_SCANCODE_AC_STOP: .AC_STOP, + SDL_SCANCODE_AGAIN: .AGAIN, + SDL_SCANCODE_ALTERASE: .ALTERASE, + SDL_SCANCODE_APOSTROPHE: .APOSTROPHE, + SDL_SCANCODE_APP1: .APP1, + SDL_SCANCODE_APP2: .APP2, + SDL_SCANCODE_APPLICATION: .APPLICATION, + SDL_SCANCODE_AUDIOFASTFORWARD: .AUDIOFASTFORWARD, + SDL_SCANCODE_AUDIOMUTE: .AUDIOMUTE, + SDL_SCANCODE_AUDIONEXT: .AUDIONEXT, + SDL_SCANCODE_AUDIOPLAY: .AUDIOPLAY, + SDL_SCANCODE_AUDIOPREV: .AUDIOPREV, + SDL_SCANCODE_AUDIOREWIND: .AUDIOREWIND, + SDL_SCANCODE_AUDIOSTOP: .AUDIOSTOP, + SDL_SCANCODE_B: .B, + SDL_SCANCODE_BACKSLASH: .BACKSLASH, + SDL_SCANCODE_BACKSPACE: .BACKSPACE, + SDL_SCANCODE_BRIGHTNESSDOWN: .BRIGHTNESSDOWN, + SDL_SCANCODE_BRIGHTNESSUP: .BRIGHTNESSUP, + SDL_SCANCODE_C: .C, + SDL_SCANCODE_CALCULATOR: .CALCULATOR, + SDL_SCANCODE_CANCEL: .CANCEL, + SDL_SCANCODE_CAPSLOCK: .CAPSLOCK, + SDL_SCANCODE_CLEAR: .CLEAR, + SDL_SCANCODE_CLEARAGAIN: .CLEARAGAIN, + SDL_SCANCODE_COMMA: .COMMA, + SDL_SCANCODE_COMPUTER: .COMPUTER, + SDL_SCANCODE_COPY: .COPY, + SDL_SCANCODE_CRSEL: .CRSEL, + SDL_SCANCODE_CURRENCYSUBUNIT: .CURRENCYSUBUNIT, + SDL_SCANCODE_CURRENCYUNIT: .CURRENCYUNIT, + SDL_SCANCODE_CUT: .CUT, + SDL_SCANCODE_D: .D, + SDL_SCANCODE_DECIMALSEPARATOR: .DECIMALSEPARATOR, + SDL_SCANCODE_DELETE: .DELETE, + SDL_SCANCODE_DISPLAYSWITCH: .DISPLAYSWITCH, + SDL_SCANCODE_DOWN: .DOWN, + SDL_SCANCODE_E: .E, + SDL_SCANCODE_EJECT: .EJECT, + SDL_SCANCODE_END: .END, + SDL_SCANCODE_EQUALS: .EQUALS, + SDL_SCANCODE_ESCAPE: .ESCAPE, + SDL_SCANCODE_EXECUTE: .EXECUTE, + SDL_SCANCODE_EXSEL: .EXSEL, + SDL_SCANCODE_F: .F, + SDL_SCANCODE_F1: .F1, + SDL_SCANCODE_F10: .F10, + SDL_SCANCODE_F11: .F11, + SDL_SCANCODE_F12: .F12, + SDL_SCANCODE_F13: .F13, + SDL_SCANCODE_F14: .F14, + SDL_SCANCODE_F15: .F15, + SDL_SCANCODE_F16: .F16, + SDL_SCANCODE_F17: .F17, + SDL_SCANCODE_F18: .F18, + SDL_SCANCODE_F19: .F19, + SDL_SCANCODE_F2: .F2, + SDL_SCANCODE_F20: .F20, + SDL_SCANCODE_F21: .F21, + SDL_SCANCODE_F22: .F22, + SDL_SCANCODE_F23: .F23, + SDL_SCANCODE_F24: .F24, + SDL_SCANCODE_F3: .F3, + SDL_SCANCODE_F4: .F4, + SDL_SCANCODE_F5: .F5, + SDL_SCANCODE_F6: .F6, + SDL_SCANCODE_F7: .F7, + SDL_SCANCODE_F8: .F8, + SDL_SCANCODE_F9: .F9, + SDL_SCANCODE_FIND: .FIND, + SDL_SCANCODE_G: .G, + SDL_SCANCODE_GRAVE: .GRAVE, + SDL_SCANCODE_H: .H, + SDL_SCANCODE_HELP: .HELP, + SDL_SCANCODE_HOME: .HOME, + SDL_SCANCODE_I: .I, + SDL_SCANCODE_INSERT: .INSERT, + SDL_SCANCODE_INTERNATIONAL1: .INTERNATIONAL1, + SDL_SCANCODE_INTERNATIONAL2: .INTERNATIONAL2, + SDL_SCANCODE_INTERNATIONAL3: .INTERNATIONAL3, + SDL_SCANCODE_INTERNATIONAL4: .INTERNATIONAL4, + SDL_SCANCODE_INTERNATIONAL5: .INTERNATIONAL5, + SDL_SCANCODE_INTERNATIONAL6: .INTERNATIONAL6, + SDL_SCANCODE_INTERNATIONAL7: .INTERNATIONAL7, + SDL_SCANCODE_INTERNATIONAL8: .INTERNATIONAL8, + SDL_SCANCODE_INTERNATIONAL9: .INTERNATIONAL9, + SDL_SCANCODE_J: .J, + SDL_SCANCODE_K: .K, + SDL_SCANCODE_KBDILLUMDOWN: .KBDILLUMDOWN, + SDL_SCANCODE_KBDILLUMTOGGLE: .KBDILLUMTOGGLE, + SDL_SCANCODE_KBDILLUMUP: .KBDILLUMUP, + SDL_SCANCODE_KP_0: .KP_0, + SDL_SCANCODE_KP_00: .KP_00, + SDL_SCANCODE_KP_000: .KP_000, + SDL_SCANCODE_KP_1: .KP_1, + SDL_SCANCODE_KP_2: .KP_2, + SDL_SCANCODE_KP_3: .KP_3, + SDL_SCANCODE_KP_4: .KP_4, + SDL_SCANCODE_KP_5: .KP_5, + SDL_SCANCODE_KP_6: .KP_6, + SDL_SCANCODE_KP_7: .KP_7, + SDL_SCANCODE_KP_8: .KP_8, + SDL_SCANCODE_KP_9: .KP_9, + SDL_SCANCODE_KP_A: .KP_A, + SDL_SCANCODE_KP_AMPERSAND: .KP_AMPERSAND, + SDL_SCANCODE_KP_AT: .KP_AT, + SDL_SCANCODE_KP_B: .KP_B, + SDL_SCANCODE_KP_BACKSPACE: .KP_BACKSPACE, + SDL_SCANCODE_KP_BINARY: .KP_BINARY, + SDL_SCANCODE_KP_C: .KP_C, + SDL_SCANCODE_KP_CLEAR: .KP_CLEAR, + SDL_SCANCODE_KP_CLEARENTRY: .KP_CLEARENTRY, + SDL_SCANCODE_KP_COLON: .KP_COLON, + SDL_SCANCODE_KP_COMMA: .KP_COMMA, + SDL_SCANCODE_KP_D: .KP_D, + SDL_SCANCODE_KP_DBLAMPERSAND: .KP_DBLAMPERSAND, + SDL_SCANCODE_KP_DBLVERTICALBAR: .KP_DBLVERTICALBAR, + SDL_SCANCODE_KP_DECIMAL: .KP_DECIMAL, + SDL_SCANCODE_KP_DIVIDE: .KP_DIVIDE, + SDL_SCANCODE_KP_E: .KP_E, + SDL_SCANCODE_KP_ENTER: .KP_ENTER, + SDL_SCANCODE_KP_EQUALS: .KP_EQUALS, + SDL_SCANCODE_KP_EQUALSAS400: .KP_EQUALSAS400, + SDL_SCANCODE_KP_EXCLAM: .KP_EXCLAM, + SDL_SCANCODE_KP_F: .KP_F, + SDL_SCANCODE_KP_GREATER: .KP_GREATER, + SDL_SCANCODE_KP_HASH: .KP_HASH, + SDL_SCANCODE_KP_HEXADECIMAL: .KP_HEXADECIMAL, + SDL_SCANCODE_KP_LEFTBRACE: .KP_LEFTBRACE, + SDL_SCANCODE_KP_LEFTPAREN: .KP_LEFTPAREN, + SDL_SCANCODE_KP_LESS: .KP_LESS, + SDL_SCANCODE_KP_MEMADD: .KP_MEMADD, + SDL_SCANCODE_KP_MEMCLEAR: .KP_MEMCLEAR, + SDL_SCANCODE_KP_MEMDIVIDE: .KP_MEMDIVIDE, + SDL_SCANCODE_KP_MEMMULTIPLY: .KP_MEMMULTIPLY, + SDL_SCANCODE_KP_MEMRECALL: .KP_MEMRECALL, + SDL_SCANCODE_KP_MEMSTORE: .KP_MEMSTORE, + SDL_SCANCODE_KP_MEMSUBTRACT: .KP_MEMSUBTRACT, + SDL_SCANCODE_KP_MINUS: .KP_MINUS, + SDL_SCANCODE_KP_MULTIPLY: .KP_MULTIPLY, + SDL_SCANCODE_KP_OCTAL: .KP_OCTAL, + SDL_SCANCODE_KP_PERCENT: .KP_PERCENT, + SDL_SCANCODE_KP_PERIOD: .KP_PERIOD, + SDL_SCANCODE_KP_PLUS: .KP_PLUS, + SDL_SCANCODE_KP_PLUSMINUS: .KP_PLUSMINUS, + SDL_SCANCODE_KP_POWER: .KP_POWER, + SDL_SCANCODE_KP_RIGHTBRACE: .KP_RIGHTBRACE, + SDL_SCANCODE_KP_RIGHTPAREN: .KP_RIGHTPAREN, + SDL_SCANCODE_KP_SPACE: .KP_SPACE, + SDL_SCANCODE_KP_TAB: .KP_TAB, + SDL_SCANCODE_KP_VERTICALBAR: .KP_VERTICALBAR, + SDL_SCANCODE_KP_XOR: .KP_XOR, + SDL_SCANCODE_L: .L, + SDL_SCANCODE_LALT: .LALT, + SDL_SCANCODE_LANG1: .LANG1, + SDL_SCANCODE_LANG2: .LANG2, + SDL_SCANCODE_LANG3: .LANG3, + SDL_SCANCODE_LANG4: .LANG4, + SDL_SCANCODE_LANG5: .LANG5, + SDL_SCANCODE_LANG6: .LANG6, + SDL_SCANCODE_LANG7: .LANG7, + SDL_SCANCODE_LANG8: .LANG8, + SDL_SCANCODE_LANG9: .LANG9, + SDL_SCANCODE_LCTRL: .LCTRL, + SDL_SCANCODE_LEFT: .LEFT, + SDL_SCANCODE_LEFTBRACKET: .LEFTBRACKET, + SDL_SCANCODE_LGUI: .LGUI, + SDL_SCANCODE_LSHIFT: .LSHIFT, + SDL_SCANCODE_M: .M, + SDL_SCANCODE_MAIL: .MAIL, + SDL_SCANCODE_MEDIASELECT: .MEDIASELECT, + SDL_SCANCODE_MENU: .MENU, + SDL_SCANCODE_MINUS: .MINUS, + SDL_SCANCODE_MODE: .MODE, + SDL_SCANCODE_MUTE: .MUTE, + SDL_SCANCODE_N: .N, + SDL_SCANCODE_NONUSBACKSLASH: .NONUSBACKSLASH, + SDL_SCANCODE_NONUSHASH: .NONUSHASH, + SDL_SCANCODE_NUMLOCKCLEAR: .NUMLOCKCLEAR, + SDL_SCANCODE_O: .O, + SDL_SCANCODE_OPER: .OPER, + SDL_SCANCODE_OUT: .OUT, + SDL_SCANCODE_P: .P, + SDL_SCANCODE_PAGEDOWN: .PAGEDOWN, + SDL_SCANCODE_PAGEUP: .PAGEUP, + SDL_SCANCODE_PASTE: .PASTE, + SDL_SCANCODE_PAUSE: .PAUSE, + SDL_SCANCODE_PERIOD: .PERIOD, + SDL_SCANCODE_POWER: .POWER, + SDL_SCANCODE_PRINTSCREEN: .PRINTSCREEN, + SDL_SCANCODE_PRIOR: .PRIOR, + SDL_SCANCODE_Q: .Q, + SDL_SCANCODE_R: .R, + SDL_SCANCODE_RALT: .RALT, + SDL_SCANCODE_RCTRL: .RCTRL, + SDL_SCANCODE_RETURN: .RETURN, + SDL_SCANCODE_RETURN2: .RETURN2, + SDL_SCANCODE_RGUI: .RGUI, + SDL_SCANCODE_RIGHT: .RIGHT, + SDL_SCANCODE_RIGHTBRACKET: .RIGHTBRACKET, + SDL_SCANCODE_RSHIFT: .RSHIFT, + SDL_SCANCODE_S: .S, + SDL_SCANCODE_SCROLLLOCK: .SCROLLLOCK, + SDL_SCANCODE_SELECT: .SELECT, + SDL_SCANCODE_SEMICOLON: .SEMICOLON, + SDL_SCANCODE_SEPARATOR: .SEPARATOR, + SDL_SCANCODE_SLASH: .SLASH, + SDL_SCANCODE_SLEEP: .SLEEP, + SDL_SCANCODE_SPACE: .SPACE, + SDL_SCANCODE_STOP: .STOP, + SDL_SCANCODE_SYSREQ: .SYSREQ, + SDL_SCANCODE_T: .T, + SDL_SCANCODE_TAB: .TAB, + SDL_SCANCODE_THOUSANDSSEPARATOR: .THOUSANDSSEPARATOR, + SDL_SCANCODE_U: .U, + SDL_SCANCODE_UNDO: .UNDO, + SDL_SCANCODE_UP: .UP, + SDL_SCANCODE_V: .V, + SDL_SCANCODE_VOLUMEDOWN: .VOLUMEDOWN, + SDL_SCANCODE_VOLUMEUP: .VOLUMEUP, + SDL_SCANCODE_W: .W, + SDL_SCANCODE_WWW: .WWW, + SDL_SCANCODE_X: .X, + SDL_SCANCODE_Y: .Y, + SDL_SCANCODE_Z: .Z, + ] + } + +#endif