Added missing keyinfotable.h
authorSam Lantinga <slouken@libsdl.org>
Thu, 26 Oct 2017 10:42:14 -0700
changeset 11656c351a823c2af
parent 11655 ccf47d584003
child 11657 26ce9cdde7f4
Added missing keyinfotable.h
src/core/android/keyinfotable.h
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/core/android/keyinfotable.h	Thu Oct 26 10:42:14 2017 -0700
     1.3 @@ -0,0 +1,175 @@
     1.4 +/*
     1.5 +  Simple DirectMedia Layer
     1.6 +  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
     1.7 +
     1.8 +  This software is provided 'as-is', without any express or implied
     1.9 +  warranty.  In no event will the authors be held liable for any damages
    1.10 +  arising from the use of this software.
    1.11 +
    1.12 +  Permission is granted to anyone to use this software for any purpose,
    1.13 +  including commercial applications, and to alter it and redistribute it
    1.14 +  freely, subject to the following restrictions:
    1.15 +
    1.16 +  1. The origin of this software must not be misrepresented; you must not
    1.17 +     claim that you wrote the original software. If you use this software
    1.18 +     in a product, an acknowledgment in the product documentation would be
    1.19 +     appreciated but is not required.
    1.20 +  2. Altered source versions must be plainly marked as such, and must not be
    1.21 +     misrepresented as being the original software.
    1.22 +  3. This notice may not be removed or altered from any source distribution.
    1.23 +*/
    1.24 +
    1.25 +#ifndef _ANDROID_KeyInfo
    1.26 +#define _ANDROID_KeyInfo
    1.27 +
    1.28 +#include "SDL_scancode.h"
    1.29 +#include "SDL_keycode.h"
    1.30 +
    1.31 +/*
    1.32 +    This file is used by the keyboard code in SDL_uikitview.m to convert between characters
    1.33 +    passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods.
    1.34 +    For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower
    1.35 +    case a.
    1.36 +*/
    1.37 +
    1.38 +typedef struct
    1.39 +{
    1.40 +    SDL_Scancode code;
    1.41 +    uint16_t mod;
    1.42 +} AndroidKeyInfo;
    1.43 +
    1.44 +/* So far only ASCII characters here */
    1.45 +static AndroidKeyInfo unicharToAndroidKeyInfoTable[] = {
    1.46 +/*  0 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.47 +/*  1 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.48 +/*  2 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.49 +/*  3 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.50 +/*  4 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.51 +/*  5 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.52 +/*  6 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.53 +/*  7 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.54 +/*  8 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.55 +/*  9 */  {  SDL_SCANCODE_UNKNOWN, 0 },
    1.56 +/*  10 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.57 +/*  11 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.58 +/*  12 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.59 +/*  13 */ {   SDL_SCANCODE_RETURN, 0 },
    1.60 +/*  14 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.61 +/*  15 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.62 +/*  16 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.63 +/*  17 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.64 +/*  18 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.65 +/*  19 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.66 +/*  20 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.67 +/*  21 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.68 +/*  22 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.69 +/*  23 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.70 +/*  24 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.71 +/*  25 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.72 +/*  26 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.73 +/*  27 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.74 +/*  28 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.75 +/*  29 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.76 +/*  30 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.77 +/*  31 */ {   SDL_SCANCODE_UNKNOWN, 0 },
    1.78 +/*  32 */ {   SDL_SCANCODE_SPACE, 0 },
    1.79 +/*  33 */ {   SDL_SCANCODE_1,    KMOD_SHIFT },        /* plus shift modifier '!' */
    1.80 +/*  34 */ {   SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT },    /* plus shift modifier '"' */
    1.81 +/*  35 */ {   SDL_SCANCODE_3, KMOD_SHIFT },            /* plus shift modifier '#' */
    1.82 +/*  36 */ {   SDL_SCANCODE_4, KMOD_SHIFT },            /* plus shift modifier '$' */
    1.83 +/*  37 */ {   SDL_SCANCODE_5, KMOD_SHIFT },            /* plus shift modifier '%' */
    1.84 +/*  38 */ {   SDL_SCANCODE_7, KMOD_SHIFT },            /* plus shift modifier '&' */
    1.85 +/*  39 */ {   SDL_SCANCODE_APOSTROPHE, 0 },    /* '''                       */
    1.86 +/*  40 */ {   SDL_SCANCODE_9, KMOD_SHIFT },             /* plus shift modifier '(' */
    1.87 +/*  41 */ {   SDL_SCANCODE_0, KMOD_SHIFT },            /* plus shift modifier ')' */
    1.88 +/*  42 */ {   SDL_SCANCODE_8, KMOD_SHIFT },            /* '*' */
    1.89 +/*  43 */ {   SDL_SCANCODE_EQUALS, KMOD_SHIFT },    /* plus shift modifier '+' */
    1.90 +/*  44 */ {   SDL_SCANCODE_COMMA, 0 },        /* ','                       */
    1.91 +/*  45 */ {   SDL_SCANCODE_MINUS, 0 },        /* '-'                       */
    1.92 +/*  46 */ {   SDL_SCANCODE_PERIOD, 0 },        /* '.'                       */
    1.93 +/*  47 */ {   SDL_SCANCODE_SLASH, 0 },        /* '/'                       */
    1.94 +/*  48 */ {   SDL_SCANCODE_0, 0    },
    1.95 +/*  49 */ {   SDL_SCANCODE_1, 0 },
    1.96 +/*  50 */ {   SDL_SCANCODE_2, 0 },
    1.97 +/*  51 */ {   SDL_SCANCODE_3, 0 },
    1.98 +/*  52 */ {   SDL_SCANCODE_4, 0 },
    1.99 +/*  53 */ {   SDL_SCANCODE_5, 0 },
   1.100 +/*  54 */ {   SDL_SCANCODE_6, 0 },
   1.101 +/*  55 */ {   SDL_SCANCODE_7, 0 },
   1.102 +/*  56 */ {   SDL_SCANCODE_8, 0 },
   1.103 +/*  57 */ {   SDL_SCANCODE_9, 0 },
   1.104 +/*  58 */ {   SDL_SCANCODE_SEMICOLON,  KMOD_SHIFT },    /* plus shift modifier ';' */
   1.105 +/*  59 */ {   SDL_SCANCODE_SEMICOLON, 0 },
   1.106 +/*  60 */ {   SDL_SCANCODE_COMMA,  KMOD_SHIFT },         /* plus shift modifier '<' */
   1.107 +/*  61 */ {   SDL_SCANCODE_EQUALS, 0 },
   1.108 +/*  62 */ {   SDL_SCANCODE_PERIOD,  KMOD_SHIFT },        /* plus shift modifier '>' */
   1.109 +/*  63 */ {   SDL_SCANCODE_SLASH,  KMOD_SHIFT },        /* plus shift modifier '?' */
   1.110 +/*  64 */ {   SDL_SCANCODE_2,  KMOD_SHIFT },            /* plus shift modifier '@' */
   1.111 +/*  65 */ {   SDL_SCANCODE_A,  KMOD_SHIFT },            /* all the following need shift modifiers */
   1.112 +/*  66 */ {   SDL_SCANCODE_B,  KMOD_SHIFT },
   1.113 +/*  67 */ {   SDL_SCANCODE_C,  KMOD_SHIFT },
   1.114 +/*  68 */ {   SDL_SCANCODE_D,  KMOD_SHIFT },
   1.115 +/*  69 */ {   SDL_SCANCODE_E,  KMOD_SHIFT },
   1.116 +/*  70 */ {   SDL_SCANCODE_F,  KMOD_SHIFT },
   1.117 +/*  71 */ {   SDL_SCANCODE_G,  KMOD_SHIFT },
   1.118 +/*  72 */ {   SDL_SCANCODE_H,  KMOD_SHIFT },
   1.119 +/*  73 */ {   SDL_SCANCODE_I,  KMOD_SHIFT },
   1.120 +/*  74 */ {   SDL_SCANCODE_J,  KMOD_SHIFT },
   1.121 +/*  75 */ {   SDL_SCANCODE_K,  KMOD_SHIFT },
   1.122 +/*  76 */ {   SDL_SCANCODE_L,  KMOD_SHIFT },
   1.123 +/*  77 */ {   SDL_SCANCODE_M,  KMOD_SHIFT },
   1.124 +/*  78 */ {   SDL_SCANCODE_N,  KMOD_SHIFT },
   1.125 +/*  79 */ {   SDL_SCANCODE_O,  KMOD_SHIFT },
   1.126 +/*  80 */ {   SDL_SCANCODE_P,  KMOD_SHIFT },
   1.127 +/*  81 */ {   SDL_SCANCODE_Q,  KMOD_SHIFT },
   1.128 +/*  82 */ {   SDL_SCANCODE_R,  KMOD_SHIFT },
   1.129 +/*  83 */ {   SDL_SCANCODE_S,  KMOD_SHIFT },
   1.130 +/*  84 */ {   SDL_SCANCODE_T,  KMOD_SHIFT },
   1.131 +/*  85 */ {   SDL_SCANCODE_U,  KMOD_SHIFT },
   1.132 +/*  86 */ {   SDL_SCANCODE_V,  KMOD_SHIFT },
   1.133 +/*  87 */ {   SDL_SCANCODE_W,  KMOD_SHIFT },
   1.134 +/*  88 */ {   SDL_SCANCODE_X,  KMOD_SHIFT },
   1.135 +/*  89 */ {   SDL_SCANCODE_Y,  KMOD_SHIFT },
   1.136 +/*  90 */ {   SDL_SCANCODE_Z,  KMOD_SHIFT },
   1.137 +/*  91 */ {   SDL_SCANCODE_LEFTBRACKET, 0 },
   1.138 +/*  92 */ {   SDL_SCANCODE_BACKSLASH, 0 },
   1.139 +/*  93 */ {   SDL_SCANCODE_RIGHTBRACKET, 0 },
   1.140 +/*  94 */ {   SDL_SCANCODE_6,  KMOD_SHIFT },            /* plus shift modifier '^' */
   1.141 +/*  95 */ {   SDL_SCANCODE_MINUS,  KMOD_SHIFT },        /* plus shift modifier '_' */
   1.142 +/*  96 */ {   SDL_SCANCODE_GRAVE,  KMOD_SHIFT },        /* '`' */
   1.143 +/*  97 */ {   SDL_SCANCODE_A, 0    },
   1.144 +/*  98 */ {   SDL_SCANCODE_B, 0 },
   1.145 +/*  99 */ {   SDL_SCANCODE_C, 0 },
   1.146 +/*  100 */{    SDL_SCANCODE_D, 0 },
   1.147 +/*  101 */{    SDL_SCANCODE_E, 0 },
   1.148 +/*  102 */{    SDL_SCANCODE_F, 0 },
   1.149 +/*  103 */{    SDL_SCANCODE_G, 0 },
   1.150 +/*  104 */{    SDL_SCANCODE_H, 0 },
   1.151 +/*  105 */{    SDL_SCANCODE_I, 0 },
   1.152 +/*  106 */{    SDL_SCANCODE_J, 0 },
   1.153 +/*  107 */{    SDL_SCANCODE_K, 0 },
   1.154 +/*  108 */{    SDL_SCANCODE_L, 0 },
   1.155 +/*  109 */{    SDL_SCANCODE_M, 0 },
   1.156 +/*  110 */{    SDL_SCANCODE_N, 0 },
   1.157 +/*  111 */{    SDL_SCANCODE_O, 0 },
   1.158 +/*  112 */{    SDL_SCANCODE_P, 0 },
   1.159 +/*  113 */{    SDL_SCANCODE_Q, 0 },
   1.160 +/*  114 */{    SDL_SCANCODE_R, 0 },
   1.161 +/*  115 */{    SDL_SCANCODE_S, 0 },
   1.162 +/*  116 */{    SDL_SCANCODE_T, 0 },
   1.163 +/*  117 */{    SDL_SCANCODE_U, 0 },
   1.164 +/*  118 */{    SDL_SCANCODE_V, 0 },
   1.165 +/*  119 */{    SDL_SCANCODE_W, 0 },
   1.166 +/*  120 */{    SDL_SCANCODE_X, 0 },
   1.167 +/*  121 */{    SDL_SCANCODE_Y, 0 },
   1.168 +/*  122 */{    SDL_SCANCODE_Z, 0 },
   1.169 +/*  123 */{    SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT },    /* plus shift modifier '{' */
   1.170 +/*  124 */{    SDL_SCANCODE_BACKSLASH, KMOD_SHIFT },    /* plus shift modifier '|' */
   1.171 +/*  125 */{    SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT },    /* plus shift modifier '}' */
   1.172 +/*  126 */{    SDL_SCANCODE_GRAVE, KMOD_SHIFT },         /* plus shift modifier '~' */
   1.173 +/*  127 */{    SDL_SCANCODE_BACKSPACE, KMOD_SHIFT }
   1.174 +};
   1.175 +
   1.176 +#endif /* _ANDROID_KeyInfo */
   1.177 +
   1.178 +/* vi: set ts=4 sw=4 expandtab: */