cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

keyinfotable.h (7907B)


      1/*
      2  Simple DirectMedia Layer
      3  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
      4
      5  This software is provided 'as-is', without any express or implied
      6  warranty.  In no event will the authors be held liable for any damages
      7  arising from the use of this software.
      8
      9  Permission is granted to anyone to use this software for any purpose,
     10  including commercial applications, and to alter it and redistribute it
     11  freely, subject to the following restrictions:
     12
     13  1. The origin of this software must not be misrepresented; you must not
     14     claim that you wrote the original software. If you use this software
     15     in a product, an acknowledgment in the product documentation would be
     16     appreciated but is not required.
     17  2. Altered source versions must be plainly marked as such, and must not be
     18     misrepresented as being the original software.
     19  3. This notice may not be removed or altered from any source distribution.
     20*/
     21
     22#ifndef _UIKIT_KeyInfo
     23#define _UIKIT_KeyInfo
     24
     25#include "SDL_scancode.h"
     26
     27/*
     28    This file is used by the keyboard code in SDL_uikitview.m to convert between characters
     29    passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods.
     30    For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower
     31    case a.
     32*/
     33
     34typedef struct
     35{
     36    SDL_Scancode code;
     37    Uint16 mod;
     38} UIKitKeyInfo;
     39
     40/* So far only ASCII characters here */
     41static UIKitKeyInfo unicharToUIKeyInfoTable[] = {
     42/*  0 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     43/*  1 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     44/*  2 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     45/*  3 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     46/*  4 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     47/*  5 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     48/*  6 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     49/*  7 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     50/*  8 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     51/*  9 */  {  SDL_SCANCODE_UNKNOWN, 0 },
     52/*  10 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     53/*  11 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     54/*  12 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     55/*  13 */ {   SDL_SCANCODE_RETURN, 0 },
     56/*  14 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     57/*  15 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     58/*  16 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     59/*  17 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     60/*  18 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     61/*  19 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     62/*  20 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     63/*  21 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     64/*  22 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     65/*  23 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     66/*  24 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     67/*  25 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     68/*  26 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     69/*  27 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     70/*  28 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     71/*  29 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     72/*  30 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     73/*  31 */ {   SDL_SCANCODE_UNKNOWN, 0 },
     74/*  32 */ {   SDL_SCANCODE_SPACE, 0 },
     75/*  33 */ {   SDL_SCANCODE_1,    KMOD_SHIFT },        /* plus shift modifier '!' */
     76/*  34 */ {   SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT },    /* plus shift modifier '"' */
     77/*  35 */ {   SDL_SCANCODE_3, KMOD_SHIFT },            /* plus shift modifier '#' */
     78/*  36 */ {   SDL_SCANCODE_4, KMOD_SHIFT },            /* plus shift modifier '$' */
     79/*  37 */ {   SDL_SCANCODE_5, KMOD_SHIFT },            /* plus shift modifier '%' */
     80/*  38 */ {   SDL_SCANCODE_7, KMOD_SHIFT },            /* plus shift modifier '&' */
     81/*  39 */ {   SDL_SCANCODE_APOSTROPHE, 0 },    /* '''                       */
     82/*  40 */ {   SDL_SCANCODE_9, KMOD_SHIFT },             /* plus shift modifier '(' */
     83/*  41 */ {   SDL_SCANCODE_0, KMOD_SHIFT },            /* plus shift modifier ')' */
     84/*  42 */ {   SDL_SCANCODE_8, KMOD_SHIFT },            /* '*' */
     85/*  43 */ {   SDL_SCANCODE_EQUALS, KMOD_SHIFT },    /* plus shift modifier '+' */
     86/*  44 */ {   SDL_SCANCODE_COMMA, 0 },        /* ','                       */
     87/*  45 */ {   SDL_SCANCODE_MINUS, 0 },        /* '-'                       */
     88/*  46 */ {   SDL_SCANCODE_PERIOD, 0 },        /* '.'                       */
     89/*  47 */ {   SDL_SCANCODE_SLASH, 0 },        /* '/'                       */
     90/*  48 */ {   SDL_SCANCODE_0, 0    },
     91/*  49 */ {   SDL_SCANCODE_1, 0 },
     92/*  50 */ {   SDL_SCANCODE_2, 0 },
     93/*  51 */ {   SDL_SCANCODE_3, 0 },
     94/*  52 */ {   SDL_SCANCODE_4, 0 },
     95/*  53 */ {   SDL_SCANCODE_5, 0 },
     96/*  54 */ {   SDL_SCANCODE_6, 0 },
     97/*  55 */ {   SDL_SCANCODE_7, 0 },
     98/*  56 */ {   SDL_SCANCODE_8, 0 },
     99/*  57 */ {   SDL_SCANCODE_9, 0 },
    100/*  58 */ {   SDL_SCANCODE_SEMICOLON,  KMOD_SHIFT },    /* plus shift modifier ';' */
    101/*  59 */ {   SDL_SCANCODE_SEMICOLON, 0 },
    102/*  60 */ {   SDL_SCANCODE_COMMA,  KMOD_SHIFT },         /* plus shift modifier '<' */
    103/*  61 */ {   SDL_SCANCODE_EQUALS, 0 },
    104/*  62 */ {   SDL_SCANCODE_PERIOD,  KMOD_SHIFT },        /* plus shift modifier '>' */
    105/*  63 */ {   SDL_SCANCODE_SLASH,  KMOD_SHIFT },        /* plus shift modifier '?' */
    106/*  64 */ {   SDL_SCANCODE_2,  KMOD_SHIFT },            /* plus shift modifier '@' */
    107/*  65 */ {   SDL_SCANCODE_A,  KMOD_SHIFT },            /* all the following need shift modifiers */
    108/*  66 */ {   SDL_SCANCODE_B,  KMOD_SHIFT },
    109/*  67 */ {   SDL_SCANCODE_C,  KMOD_SHIFT },
    110/*  68 */ {   SDL_SCANCODE_D,  KMOD_SHIFT },
    111/*  69 */ {   SDL_SCANCODE_E,  KMOD_SHIFT },
    112/*  70 */ {   SDL_SCANCODE_F,  KMOD_SHIFT },
    113/*  71 */ {   SDL_SCANCODE_G,  KMOD_SHIFT },
    114/*  72 */ {   SDL_SCANCODE_H,  KMOD_SHIFT },
    115/*  73 */ {   SDL_SCANCODE_I,  KMOD_SHIFT },
    116/*  74 */ {   SDL_SCANCODE_J,  KMOD_SHIFT },
    117/*  75 */ {   SDL_SCANCODE_K,  KMOD_SHIFT },
    118/*  76 */ {   SDL_SCANCODE_L,  KMOD_SHIFT },
    119/*  77 */ {   SDL_SCANCODE_M,  KMOD_SHIFT },
    120/*  78 */ {   SDL_SCANCODE_N,  KMOD_SHIFT },
    121/*  79 */ {   SDL_SCANCODE_O,  KMOD_SHIFT },
    122/*  80 */ {   SDL_SCANCODE_P,  KMOD_SHIFT },
    123/*  81 */ {   SDL_SCANCODE_Q,  KMOD_SHIFT },
    124/*  82 */ {   SDL_SCANCODE_R,  KMOD_SHIFT },
    125/*  83 */ {   SDL_SCANCODE_S,  KMOD_SHIFT },
    126/*  84 */ {   SDL_SCANCODE_T,  KMOD_SHIFT },
    127/*  85 */ {   SDL_SCANCODE_U,  KMOD_SHIFT },
    128/*  86 */ {   SDL_SCANCODE_V,  KMOD_SHIFT },
    129/*  87 */ {   SDL_SCANCODE_W,  KMOD_SHIFT },
    130/*  88 */ {   SDL_SCANCODE_X,  KMOD_SHIFT },
    131/*  89 */ {   SDL_SCANCODE_Y,  KMOD_SHIFT },
    132/*  90 */ {   SDL_SCANCODE_Z,  KMOD_SHIFT },
    133/*  91 */ {   SDL_SCANCODE_LEFTBRACKET, 0 },
    134/*  92 */ {   SDL_SCANCODE_BACKSLASH, 0 },
    135/*  93 */ {   SDL_SCANCODE_RIGHTBRACKET, 0 },
    136/*  94 */ {   SDL_SCANCODE_6,  KMOD_SHIFT },            /* plus shift modifier '^' */
    137/*  95 */ {   SDL_SCANCODE_MINUS,  KMOD_SHIFT },        /* plus shift modifier '_' */
    138/*  96 */ {   SDL_SCANCODE_GRAVE,  KMOD_SHIFT },        /* '`' */
    139/*  97 */ {   SDL_SCANCODE_A, 0    },
    140/*  98 */ {   SDL_SCANCODE_B, 0 },
    141/*  99 */ {   SDL_SCANCODE_C, 0 },
    142/*  100 */{    SDL_SCANCODE_D, 0 },
    143/*  101 */{    SDL_SCANCODE_E, 0 },
    144/*  102 */{    SDL_SCANCODE_F, 0 },
    145/*  103 */{    SDL_SCANCODE_G, 0 },
    146/*  104 */{    SDL_SCANCODE_H, 0 },
    147/*  105 */{    SDL_SCANCODE_I, 0 },
    148/*  106 */{    SDL_SCANCODE_J, 0 },
    149/*  107 */{    SDL_SCANCODE_K, 0 },
    150/*  108 */{    SDL_SCANCODE_L, 0 },
    151/*  109 */{    SDL_SCANCODE_M, 0 },
    152/*  110 */{    SDL_SCANCODE_N, 0 },
    153/*  111 */{    SDL_SCANCODE_O, 0 },
    154/*  112 */{    SDL_SCANCODE_P, 0 },
    155/*  113 */{    SDL_SCANCODE_Q, 0 },
    156/*  114 */{    SDL_SCANCODE_R, 0 },
    157/*  115 */{    SDL_SCANCODE_S, 0 },
    158/*  116 */{    SDL_SCANCODE_T, 0 },
    159/*  117 */{    SDL_SCANCODE_U, 0 },
    160/*  118 */{    SDL_SCANCODE_V, 0 },
    161/*  119 */{    SDL_SCANCODE_W, 0 },
    162/*  120 */{    SDL_SCANCODE_X, 0 },
    163/*  121 */{    SDL_SCANCODE_Y, 0 },
    164/*  122 */{    SDL_SCANCODE_Z, 0 },
    165/*  123 */{    SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT },    /* plus shift modifier '{' */
    166/*  124 */{    SDL_SCANCODE_BACKSLASH, KMOD_SHIFT },    /* plus shift modifier '|' */
    167/*  125 */{    SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT },    /* plus shift modifier '}' */
    168/*  126 */{    SDL_SCANCODE_GRAVE, KMOD_SHIFT },         /* plus shift modifier '~' */
    169/*  127 */{    SDL_SCANCODE_BACKSPACE, KMOD_SHIFT }
    170};
    171
    172#endif /* UIKitKeyInfo */
    173
    174/* vi: set ts=4 sw=4 expandtab: */