Changeset 1803


Ignore:
Timestamp:
Aug 23, 2012, 9:31:29 PM (11 years ago)
Author:
sam
Message:

input: switch all key names to camel case, like our other enums.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/input/input.cpp

    r1794 r1803  
    8181        m_gamegroup = GAMEGROUP_BEFORE;
    8282
    83         for (int i = 0; i < Key::K_LAST * 2; ++i)
     83        for (int i = 0; i < Key::Last * 2; ++i)
    8484                m_input_status << 0;
    8585
     
    108108{
    109109        if (Button < m_input_status.Count())
    110                 return m_input_status[Button + Key::K_LAST];
     110                return m_input_status[Button + Key::Last];
    111111        return 0;
    112112}
     
    122122#endif
    123123        //SOOOoooo ugly.
    124         for (int i = 0; i < Key::K_LAST; ++i)
    125         {
    126                 m_input_status[i + Key::K_LAST] = m_input_status[i];
     124        for (int i = 0; i < Key::Last; ++i)
     125        {
     126                m_input_status[i + Key::Last] = m_input_status[i];
    127127                m_input_status[i] = keystate[i];
    128128        }
  • trunk/src/input/input.h

    r1795 r1803  
    2626{
    2727
    28 #define ACTION_TYPE std::string
    29 #define ACTION_CMP(A, B) (A.compare(B) == 0)
     28typedef std::string ACTION_TYPE;
     29static inline int ACTION_CMP(ACTION_TYPE a, ACTION_TYPE b) { return a.compare(b) == 0; }
    3030
    3131class WorldEntity;
    3232
    33 //FULL Key rip-off of the SDLK enum
     33/*
     34 * The key enumeration values match libSDL's so that we can
     35 * easily pass information between Lol and SDL.
     36 */
    3437struct Key
    3538{
    36         enum Value
    37         {
    38                 /** @name ASCII mapped keysyms
    39                         *  The keyboard syms have been cleverly chosen to map to ASCII
    40                         */
    41                 /*@{*/
    42                 K_UNKNOWN               = 0,
    43                 K_FIRST                 = 0,
    44                 K_BACKSPACE             = 8,
    45                 K_TAB                   = 9,
    46                 K_CLEAR                 = 12,
    47                 K_RETURN                = 13,
    48                 K_PAUSE                 = 19,
    49                 K_ESCAPE                = 27,
    50                 K_SPACE                 = 32,
    51                 K_EXCLAIM               = 33,
    52                 K_QUOTEDBL              = 34,
    53                 K_HASH                  = 35,
    54                 K_DOLLAR                = 36,
    55                 K_AMPERSAND             = 38,
    56                 K_QUOTE                 = 39,
    57                 K_LEFTPAREN             = 40,
    58                 K_RIGHTPAREN    = 41,
    59                 K_ASTERISK              = 42,
    60                 K_PLUS                  = 43,
    61                 K_COMMA                 = 44,
    62                 K_MINUS                 = 45,
    63                 K_PERIOD                = 46,
    64                 K_SLASH                 = 47,
    65                 K_0                             = 48,
    66                 K_1                             = 49,
    67                 K_2                             = 50,
    68                 K_3                             = 51,
    69                 K_4                             = 52,
    70                 K_5                             = 53,
    71                 K_6                             = 54,
    72                 K_7                             = 55,
    73                 K_8                             = 56,
    74                 K_9                             = 57,
    75                 K_COLON                 = 58,
    76                 K_SEMICOLON             = 59,
    77                 K_LESS                  = 60,
    78                 K_EQUALS                = 61,
    79                 K_GREATER               = 62,
    80                 K_QUESTION              = 63,
    81                 K_AT                    = 64,
    82                 /*
    83                    Skip uppercase letters
    84                  */
    85                 K_LEFTBRACKET   = 91,
    86                 K_BACKSLASH             = 92,
    87                 K_RIGHTBRACKET  = 93,
    88                 K_CARET                 = 94,
    89                 K_UNDERSCORE    = 95,
    90                 K_BACKQUOTE             = 96,
    91                 K_a                             = 97,
    92                 K_b                             = 98,
    93                 K_c                             = 99,
    94                 K_d                             = 100,
    95                 K_e                             = 101,
    96                 K_f                             = 102,
    97                 K_g                             = 103,
    98                 K_h                             = 104,
    99                 K_i                             = 105,
    100                 K_j                             = 106,
    101                 K_k                             = 107,
    102                 K_l                             = 108,
    103                 K_m                             = 109,
    104                 K_n                             = 110,
    105                 K_o                             = 111,
    106                 K_p                             = 112,
    107                 K_q                             = 113,
    108                 K_r                             = 114,
    109                 K_s                             = 115,
    110                 K_t                             = 116,
    111                 K_u                             = 117,
    112                 K_v                             = 118,
    113                 K_w                             = 119,
    114                 K_x                             = 120,
    115                 K_y                             = 121,
    116                 K_z                             = 122,
    117                 K_DELETE                = 127,
    118                 /* End of ASCII mapped keysyms */
    119                         /*@}*/
    120 
    121                 /** @name International keyboard syms */
    122                         /*@{*/
    123                 K_WORLD_0               = 160,          /* 0xA0 */
    124                 K_WORLD_1               = 161,
    125                 K_WORLD_2               = 162,
    126                 K_WORLD_3               = 163,
    127                 K_WORLD_4               = 164,
    128                 K_WORLD_5               = 165,
    129                 K_WORLD_6               = 166,
    130                 K_WORLD_7               = 167,
    131                 K_WORLD_8               = 168,
    132                 K_WORLD_9               = 169,
    133                 K_WORLD_10              = 170,
    134                 K_WORLD_11              = 171,
    135                 K_WORLD_12              = 172,
    136                 K_WORLD_13              = 173,
    137                 K_WORLD_14              = 174,
    138                 K_WORLD_15              = 175,
    139                 K_WORLD_16              = 176,
    140                 K_WORLD_17              = 177,
    141                 K_WORLD_18              = 178,
    142                 K_WORLD_19              = 179,
    143                 K_WORLD_20              = 180,
    144                 K_WORLD_21              = 181,
    145                 K_WORLD_22              = 182,
    146                 K_WORLD_23              = 183,
    147                 K_WORLD_24              = 184,
    148                 K_WORLD_25              = 185,
    149                 K_WORLD_26              = 186,
    150                 K_WORLD_27              = 187,
    151                 K_WORLD_28              = 188,
    152                 K_WORLD_29              = 189,
    153                 K_WORLD_30              = 190,
    154                 K_WORLD_31              = 191,
    155                 K_WORLD_32              = 192,
    156                 K_WORLD_33              = 193,
    157                 K_WORLD_34              = 194,
    158                 K_WORLD_35              = 195,
    159                 K_WORLD_36              = 196,
    160                 K_WORLD_37              = 197,
    161                 K_WORLD_38              = 198,
    162                 K_WORLD_39              = 199,
    163                 K_WORLD_40              = 200,
    164                 K_WORLD_41              = 201,
    165                 K_WORLD_42              = 202,
    166                 K_WORLD_43              = 203,
    167                 K_WORLD_44              = 204,
    168                 K_WORLD_45              = 205,
    169                 K_WORLD_46              = 206,
    170                 K_WORLD_47              = 207,
    171                 K_WORLD_48              = 208,
    172                 K_WORLD_49              = 209,
    173                 K_WORLD_50              = 210,
    174                 K_WORLD_51              = 211,
    175                 K_WORLD_52              = 212,
    176                 K_WORLD_53              = 213,
    177                 K_WORLD_54              = 214,
    178                 K_WORLD_55              = 215,
    179                 K_WORLD_56              = 216,
    180                 K_WORLD_57              = 217,
    181                 K_WORLD_58              = 218,
    182                 K_WORLD_59              = 219,
    183                 K_WORLD_60              = 220,
    184                 K_WORLD_61              = 221,
    185                 K_WORLD_62              = 222,
    186                 K_WORLD_63              = 223,
    187                 K_WORLD_64              = 224,
    188                 K_WORLD_65              = 225,
    189                 K_WORLD_66              = 226,
    190                 K_WORLD_67              = 227,
    191                 K_WORLD_68              = 228,
    192                 K_WORLD_69              = 229,
    193                 K_WORLD_70              = 230,
    194                 K_WORLD_71              = 231,
    195                 K_WORLD_72              = 232,
    196                 K_WORLD_73              = 233,
    197                 K_WORLD_74              = 234,
    198                 K_WORLD_75              = 235,
    199                 K_WORLD_76              = 236,
    200                 K_WORLD_77              = 237,
    201                 K_WORLD_78              = 238,
    202                 K_WORLD_79              = 239,
    203                 K_WORLD_80              = 240,
    204                 K_WORLD_81              = 241,
    205                 K_WORLD_82              = 242,
    206                 K_WORLD_83              = 243,
    207                 K_WORLD_84              = 244,
    208                 K_WORLD_85              = 245,
    209                 K_WORLD_86              = 246,
    210                 K_WORLD_87              = 247,
    211                 K_WORLD_88              = 248,
    212                 K_WORLD_89              = 249,
    213                 K_WORLD_90              = 250,
    214                 K_WORLD_91              = 251,
    215                 K_WORLD_92              = 252,
    216                 K_WORLD_93              = 253,
    217                 K_WORLD_94              = 254,
    218                 K_WORLD_95              = 255,          /* 0xFF */
    219                         /*@}*/
    220 
    221                 /** @name Numeric keypad */
    222                         /*@{*/
    223                 K_KP0                   = 256,
    224                 K_KP1                   = 257,
    225                 K_KP2                   = 258,
    226                 K_KP3                   = 259,
    227                 K_KP4                   = 260,
    228                 K_KP5                   = 261,
    229                 K_KP6                   = 262,
    230                 K_KP7                   = 263,
    231                 K_KP8                   = 264,
    232                 K_KP9                   = 265,
    233                 K_KP_PERIOD             = 266,
    234                 K_KP_DIVIDE             = 267,
    235                 K_KP_MULTIPLY   = 268,
    236                 K_KP_MINUS              = 269,
    237                 K_KP_PLUS               = 270,
    238                 K_KP_ENTER              = 271,
    239                 K_KP_EQUALS             = 272,
    240                         /*@}*/
    241 
    242                 /** @name Arrows + Home/End pad */
    243                         /*@{*/
    244                 K_UP                    = 273,
    245                 K_DOWN                  = 274,
    246                 K_RIGHT                 = 275,
    247                 K_LEFT                  = 276,
    248                 K_INSERT                = 277,
    249                 K_HOME                  = 278,
    250                 K_END                   = 279,
    251                 K_PAGEUP                = 280,
    252                 K_PAGEDOWN              = 281,
    253                         /*@}*/
    254 
    255                 /** @name Function keys */
    256                         /*@{*/
    257                 K_F1                    = 282,
    258                 K_F2                    = 283,
    259                 K_F3                    = 284,
    260                 K_F4                    = 285,
    261                 K_F5                    = 286,
    262                 K_F6                    = 287,
    263                 K_F7                    = 288,
    264                 K_F8                    = 289,
    265                 K_F9                    = 290,
    266                 K_F10                   = 291,
    267                 K_F11                   = 292,
    268                 K_F12                   = 293,
    269                 K_F13                   = 294,
    270                 K_F14                   = 295,
    271                 K_F15                   = 296,
    272                         /*@}*/
    273 
    274                 /** @name Key state modifier keys */
    275                         /*@{*/
    276                 K_NUMLOCK               = 300,
    277                 K_CAPSLOCK              = 301,
    278                 K_SCROLLOCK             = 302,
    279                 K_RSHIFT                = 303,
    280                 K_LSHIFT                = 304,
    281                 K_RCTRL                 = 305,
    282                 K_LCTRL                 = 306,
    283                 K_RALT                  = 307,
    284                 K_LALT                  = 308,
    285                 K_RMETA                 = 309,
    286                 K_LMETA                 = 310,
    287                 K_LSUPER                = 311,          /**< Left "Windows" key */
    288                 K_RSUPER                = 312,          /**< Right "Windows" key */
    289                 K_MODE                  = 313,          /**< "Alt Gr" key */
    290                 K_COMPOSE               = 314,          /**< Multi-key compose key */
    291                         /*@}*/
    292 
    293                 /** @name Miscellaneous function keys */
    294                         /*@{*/
    295                 K_HELP                  = 315,
    296                 K_PRINT                 = 316,
    297                 K_SYSREQ                = 317,
    298                 K_BREAK                 = 318,
    299                 K_MENU                  = 319,
    300                 K_POWER                 = 320,          /**< Power Macintosh power key */
    301                 K_EURO                  = 321,          /**< Some european keyboards */
    302                 K_UNDO                  = 322,          /**< Atari keyboard has Undo */
    303                         /*@}*/
    304 
    305                 /* Add any other keys here */
    306 
    307                 K_LAST
    308 
    309         }
    310         m_value;
    311 
    312         //BH : Removed KMod from main enum, because I don't have any idea about handling them correctly for now.
    313         /*
    314                 //Enumeration of valid key mods (possibly OR'd together)
    315                 KM_NONE                 = 0x0000,
    316                 KM_LSHIFT               = 0x0001,
    317                 KM_RSHIFT               = 0x0002,
    318                 KM_LCTRL                = 0x0040,
    319                 KM_RCTRL                = 0x0080,
    320                 KM_LALT                 = 0x0100,
    321                 KM_RALT                 = 0x0200,
    322                 KM_LMETA                = 0x0400,
    323                 KM_RMETA                = 0x0800,
    324                 KM_NUM                  = 0x1000,
    325                 KM_CAPS                 = 0x2000,
    326                 KM_MODE                 = 0x4000,
    327 
    328                 KM_RESERVED             = 0x8000,
    329 
    330                 //Left/Right independent key mods definition
    331                 KM_CTRL                 = (KM_LCTRL|KM_RCTRL),
    332                 KM_SHIFT                = (KM_LSHIFT|KM_RSHIFT),
    333                 KM_ALT                  = (KM_LALT|KM_RALT),
    334                 KM_META                 = (KM_LMETA|KM_RMETA),
    335         */
    336 
    337         inline Key(Value v) { m_value = v; }
    338         inline operator Value() { return m_value; }
    339         inline bool operator==(const Key& CompareButton) { return m_value == CompareButton.m_value; }
     39    enum Value
     40    {
     41        /* ASCII mapped keys */
     42        Unknown = 0,
     43        First = 0,
     44        Backspace = 8,
     45        Tab = 9,
     46        Clear = 12,
     47        Return = 13,
     48        Pause = 19,
     49        Escape = 27,
     50        Space = 32,
     51        Exclaim = 33,
     52        DoubleQuote = 34,
     53        Hash = 35,
     54        Dollar = 36,
     55        Ampersand = 38,
     56        Quote = 39,
     57        LeftParen = 40,
     58        RightParen = 41,
     59        Asterisk = 42,
     60        Plus = 43,
     61        Comma = 44,
     62        Minus = 45,
     63        Period = 46,
     64        Slash = 47,
     65        K0 = 48,
     66        K1 = 49,
     67        K2 = 50,
     68        K3 = 51,
     69        K4 = 52,
     70        K5 = 53,
     71        K6 = 54,
     72        K7 = 55,
     73        K8 = 56,
     74        K9 = 57,
     75        Colon = 58,
     76        Semicolon = 59,
     77        Less = 60,
     78        Equals = 61,
     79        Greater = 62,
     80        Question = 63,
     81        At = 64,
     82        /* XXX: SDL decides to skip uppercase characters */
     83        LeftBracket = 91,
     84        BackSlash = 92,
     85        RightBracket = 93,
     86        Caret = 94,
     87        Underscore = 95,
     88        Backquote = 96,
     89        A = 97,
     90        B = 98,
     91        C = 99,
     92        D = 100,
     93        E = 101,
     94        F = 102,
     95        G = 103,
     96        H = 104,
     97        I = 105,
     98        J = 106,
     99        K = 107,
     100        L = 108,
     101        M = 109,
     102        N = 110,
     103        O = 111,
     104        P = 112,
     105        Q = 113,
     106        R = 114,
     107        S = 115,
     108        T = 116,
     109        U = 117,
     110        V = 118,
     111        W = 119,
     112        X = 120,
     113        Y = 121,
     114        Z = 122,
     115        Delete = 127,
     116
     117        /* International keyboard syms */
     118        World0 = 160, /* 0xA0 */
     119        World1 = 161,
     120        World2 = 162,
     121        World3 = 163,
     122        World4 = 164,
     123        World5 = 165,
     124        World6 = 166,
     125        World7 = 167,
     126        World8 = 168,
     127        World9 = 169,
     128        World10 = 170,
     129        World11 = 171,
     130        World12 = 172,
     131        World13 = 173,
     132        World14 = 174,
     133        World15 = 175,
     134        World16 = 176,
     135        World17 = 177,
     136        World18 = 178,
     137        World19 = 179,
     138        World20 = 180,
     139        World21 = 181,
     140        World22 = 182,
     141        World23 = 183,
     142        World24 = 184,
     143        World25 = 185,
     144        World26 = 186,
     145        World27 = 187,
     146        World28 = 188,
     147        World29 = 189,
     148        World30 = 190,
     149        World31 = 191,
     150        World32 = 192,
     151        World33 = 193,
     152        World34 = 194,
     153        World35 = 195,
     154        World36 = 196,
     155        World37 = 197,
     156        World38 = 198,
     157        World39 = 199,
     158        World40 = 200,
     159        World41 = 201,
     160        World42 = 202,
     161        World43 = 203,
     162        World44 = 204,
     163        World45 = 205,
     164        World46 = 206,
     165        World47 = 207,
     166        World48 = 208,
     167        World49 = 209,
     168        World50 = 210,
     169        World51 = 211,
     170        World52 = 212,
     171        World53 = 213,
     172        World54 = 214,
     173        World55 = 215,
     174        World56 = 216,
     175        World57 = 217,
     176        World58 = 218,
     177        World59 = 219,
     178        World60 = 220,
     179        World61 = 221,
     180        World62 = 222,
     181        World63 = 223,
     182        World64 = 224,
     183        World65 = 225,
     184        World66 = 226,
     185        World67 = 227,
     186        World68 = 228,
     187        World69 = 229,
     188        World70 = 230,
     189        World71 = 231,
     190        World72 = 232,
     191        World73 = 233,
     192        World74 = 234,
     193        World75 = 235,
     194        World76 = 236,
     195        World77 = 237,
     196        World78 = 238,
     197        World79 = 239,
     198        World80 = 240,
     199        World81 = 241,
     200        World82 = 242,
     201        World83 = 243,
     202        World84 = 244,
     203        World85 = 245,
     204        World86 = 246,
     205        World87 = 247,
     206        World88 = 248,
     207        World89 = 249,
     208        World90 = 250,
     209        World91 = 251,
     210        World92 = 252,
     211        World93 = 253,
     212        World94 = 254,
     213        World95 = 255, /* 0xFF */
     214
     215        /* Numeric keypad */
     216        KP0 = 256,
     217        KP1 = 257,
     218        KP2 = 258,
     219        KP3 = 259,
     220        KP4 = 260,
     221        KP5 = 261,
     222        KP6 = 262,
     223        KP7 = 263,
     224        KP8 = 264,
     225        KP9 = 265,
     226        KPPeriod = 266,
     227        KPDivide = 267,
     228        KPMultiply = 268,
     229        KPMinus = 269,
     230        KPPlus = 270,
     231        KPEnter = 271,
     232        KPEquals = 272,
     233
     234        /* Arrows + Home/End pad */
     235        Up = 273,
     236        Down = 274,
     237        Right = 275,
     238        Left = 276,
     239        Insert = 277,
     240        Home = 278,
     241        End = 279,
     242        PageUp = 280,
     243        PageDown = 281,
     244
     245        /* Function keys */
     246        F1 = 282,
     247        F2 = 283,
     248        F3 = 284,
     249        F4 = 285,
     250        F5 = 286,
     251        F6 = 287,
     252        F7 = 288,
     253        F8 = 289,
     254        F9 = 290,
     255        F10 = 291,
     256        F11 = 292,
     257        F12 = 293,
     258        F13 = 294,
     259        F14 = 295,
     260        F15 = 296,
     261
     262        /* Modifier keys */
     263        NumLock = 300,
     264        CapsLock = 301,
     265        ScrollLock= 302,
     266        RightShift = 303,
     267        LeftShift = 304,
     268        RightCtrl = 305,
     269        LeftCtrl = 306,
     270        RightAlt = 307,
     271        LeftAlt = 308,
     272        RightMeta = 309,
     273        LeftMeta = 310,
     274        LeftSuper = 311,  /* Left "Windows" key */
     275        RightSuper = 312, /* Right "Windows" key */
     276        Mode = 313,       /* "Alt Gr" key */
     277        Compose = 314,    /* Multi-key compose key */
     278
     279        /* Miscellaneous function keys */
     280        Help = 315,
     281        Print = 316,
     282        SysReq = 317,
     283        Break = 318,
     284        Menu = 319,
     285        Power = 320, /* Power Macintosh power key */
     286        Euro = 321,  /* Some european keyboards */
     287        Undo = 322,  /* Atari keyboard has Undo */
     288
     289        /* Add any other keys here */
     290        Last
     291
     292    }
     293    m_value;
     294
     295    //BH : Removed KMod from main enum, because I don't have any idea about handling them correctly for now.
     296    /*
     297        //Enumeration of valid key mods (possibly OR'd together)
     298        KM_NONE          = 0x0000,
     299        KM_LSHIFT        = 0x0001,
     300        KM_RSHIFT        = 0x0002,
     301        KM_LCTRL         = 0x0040,
     302        KM_RCTRL         = 0x0080,
     303        KM_LALT          = 0x0100,
     304        KM_RALT          = 0x0200,
     305        KM_LMETA         = 0x0400,
     306        KM_RMETA         = 0x0800,
     307        KM_NUM           = 0x1000,
     308        KM_CAPS          = 0x2000,
     309        KM_MODE          = 0x4000,
     310
     311        KM_RESERVED        = 0x8000,
     312
     313        //Left/Right independent key mods definition
     314        KM_CTRL            = (KM_LCTRL|KM_RCTRL),
     315        KM_SHIFT        = (KM_LSHIFT|KM_RSHIFT),
     316        KM_ALT            = (KM_LALT|KM_RALT),
     317        KM_META            = (KM_LMETA|KM_RMETA),
     318    */
     319
     320    inline Key(Value v) { m_value = v; }
     321    inline operator Value() { return m_value; }
     322    inline bool operator==(const Key& val)
     323    {
     324        return m_value == val.m_value;
     325    }
    340326};
    341327
    342328struct ActionSetting
    343329{
    344         ACTION_TYPE                             m_action;
    345         float                                   m_buffering_time;
    346         float                                   m_buffered_since;
    347 
    348         ActionSetting(ACTION_TYPE NewAction) :
    349                 m_action(NewAction),
    350                 m_buffering_time(.0f),
    351                 m_buffered_since(.0f)
    352         { }
     330    ACTION_TYPE                m_action;
     331    float                    m_buffering_time;
     332    float                    m_buffered_since;
     333
     334    ActionSetting(ACTION_TYPE NewAction) :
     335        m_action(NewAction),
     336        m_buffering_time(.0f),
     337        m_buffered_since(.0f)
     338    { }
    353339};
    354340
    355341struct ButtonSetting
    356342{
    357         Key                                             m_raw_button;
    358         Array<ActionSetting>    m_associated_action_list;
    359 
    360         ButtonSetting(Key NewRawButton)
    361                 : m_raw_button(NewRawButton) { }
    362         int GetActionSettingIdx(ACTION_TYPE SearchAction);
     343    Key                        m_raw_button;
     344    Array<ActionSetting>    m_associated_action_list;
     345
     346    ButtonSetting(Key NewRawButton)
     347        : m_raw_button(NewRawButton) { }
     348    int GetActionSettingIdx(ACTION_TYPE SearchAction);
    363349};
    364350
     
    366352{
    367353
    368         friend class Input;
     354    friend class Input;
    369355
    370356public:
    371         InputTracker();
     357    InputTracker();
    372358
    373359private:
    374         Array<uint8_t>                  m_input_status;
    375         Array<ButtonSetting>    m_input_assocation_list;
    376 
    377         int                                             GetButtonSettingIdx(struct Key Button);
    378         int                                             GetCurrentButtonStatus(struct Key Button);
    379         int                                             GetPreviousButtonStatus(struct Key Button);
    380         void                                    UpdateActionStatus(float seconds);
     360    Array<uint8_t>            m_input_status;
     361    Array<ButtonSetting>    m_input_assocation_list;
     362
     363    int                        GetButtonSettingIdx(struct Key Button);
     364    int                        GetCurrentButtonStatus(struct Key Button);
     365    int                        GetPreviousButtonStatus(struct Key Button);
     366    void                    UpdateActionStatus(float seconds);
    381367
    382368protected:
    383         virtual char const *    GetName()
    384         {
    385                 return "<InputTracker>";
    386         }
    387         virtual void                    TickGame(float seconds)
    388         {
    389                 Entity::TickGame(seconds);
    390 
    391                 UpdateActionStatus(seconds);
    392         }
    393 
    394         void                                    LinkActionToKey(ACTION_TYPE Action, struct Key Button);
    395         void                                    UnlinkAction(ACTION_TYPE Action);
    396         int                                             GetStatus(ACTION_TYPE Action);
    397         bool                                    WasPressed(ACTION_TYPE Action);
    398         bool                                    WasReleased(ACTION_TYPE Action);
    399 
    400         //You should probably use the Action System
    401         int                                             GetStatus(Key Button);
    402         bool                                    WasPressed(Key Button);
    403         bool                                    WasReleased(Key Button);
     369    virtual char const *    GetName()
     370    {
     371        return "<InputTracker>";
     372    }
     373    virtual void            TickGame(float seconds)
     374    {
     375        Entity::TickGame(seconds);
     376
     377        UpdateActionStatus(seconds);
     378    }
     379
     380    void                    LinkActionToKey(ACTION_TYPE Action, struct Key Button);
     381    void                    UnlinkAction(ACTION_TYPE Action);
     382    int                        GetStatus(ACTION_TYPE Action);
     383    bool                    WasPressed(ACTION_TYPE Action);
     384    bool                    WasReleased(ACTION_TYPE Action);
     385
     386    //You should probably use the Action System
     387    int                        GetStatus(Key Button);
     388    bool                    WasPressed(Key Button);
     389    bool                    WasReleased(Key Button);
    404390};
    405391
     
    407393{
    408394private:
    409         static InputTracker*            m_input_tracker;
    410 
    411         static bool                                     CheckInputTrackerInit()
    412         {
    413                 if (Input::m_input_tracker)
    414                         return true;
    415 
    416                 Input::m_input_tracker = new InputTracker();
    417                 return true;
    418         }
     395    static InputTracker*        m_input_tracker;
     396
     397    static bool                    CheckInputTrackerInit()
     398    {
     399        if (Input::m_input_tracker)
     400            return true;
     401
     402        Input::m_input_tracker = new InputTracker();
     403        return true;
     404    }
    419405
    420406public:
     
    424410    static ivec3 GetMouseButtons();
    425411
    426         //BH : Shouldn't use this
     412    //BH : Shouldn't use this
    427413    static int GetButtonState(int button);
    428414
    429         /* Action management */
    430         static void LinkActionToKey(ACTION_TYPE Action, struct Key Button);
    431         static void UnlinkAction(ACTION_TYPE Action);
    432         static int GetStatus(ACTION_TYPE Action);
    433         static bool     WasPressed(ACTION_TYPE Action);
    434         static bool WasReleased(ACTION_TYPE Action);
    435 
    436         /* Raw Button management. You should use actions. */
    437         static int GetStatus(Key Button);
    438         static bool     WasPressed(Key Button);
    439         static bool WasReleased(Key Button);
     415    /* Action management */
     416    static void LinkActionToKey(ACTION_TYPE Action, struct Key Button);
     417    static void UnlinkAction(ACTION_TYPE Action);
     418    static int GetStatus(ACTION_TYPE Action);
     419    static bool    WasPressed(ACTION_TYPE Action);
     420    static bool WasReleased(ACTION_TYPE Action);
     421
     422    /* Raw Button management. You should use actions. */
     423    static int GetStatus(Key Button);
     424    static bool    WasPressed(Key Button);
     425    static bool WasReleased(Key Button);
    440426
    441427    /* Entities can subscribe to events */
  • trunk/test/BtPhysTest.cpp

    r1794 r1803  
    170170
    171171
    172                 Input::LinkActionToKey(IPT_MOVE_FORWARD,                Key::K_UP);
    173                 Input::LinkActionToKey(IPT_MOVE_BACKWARD,               Key::K_DOWN);
    174                 Input::LinkActionToKey(IPT_MOVE_STRAFE_LEFT,    Key::K_LEFT);
    175                 Input::LinkActionToKey(IPT_MOVE_STRAFE_RIGHT,   Key::K_RIGHT);
    176                 Input::LinkActionToKey(IPT_MOVE_JUMP,                   Key::K_SPACE);
     172                Input::LinkActionToKey(IPT_MOVE_FORWARD,                Key::Up);
     173                Input::LinkActionToKey(IPT_MOVE_BACKWARD,               Key::Down);
     174                Input::LinkActionToKey(IPT_MOVE_STRAFE_LEFT,    Key::Left);
     175                Input::LinkActionToKey(IPT_MOVE_STRAFE_RIGHT,   Key::Right);
     176                Input::LinkActionToKey(IPT_MOVE_JUMP,                   Key::Space);
    177177
    178178                //NewPhyobj->GetCharacter()->AttachTo(BasePhyobj->GetPhysic(), true, true);
     
    229229    WorldEntity::TickGame(seconds);
    230230
    231     if (Input::WasReleased(Key::K_ESCAPE))
     231    if (Input::WasReleased(Key::Escape))
    232232        Ticker::Shutdown();
    233233
  • trunk/tools/neercs/video/render.cpp

    r1801 r1803  
    556556{
    557557    /* keyboard manager */
    558     if (Input::WasReleased(Key::K_ESCAPE))
     558    if (Input::WasReleased(Key::Escape))
    559559    {
    560560        Ticker::Shutdown();
    561561    }
    562     if (Input::WasPressed(Key::K_F1))
     562    if (Input::WasPressed(Key::F1))
    563563    {
    564564        m_setup = !m_setup;
     
    566566        sync_angle = main_angle;
    567567    }
    568     if (Input::WasPressed(Key::K_F2))
     568    if (Input::WasPressed(Key::F2))
    569569    {
    570570        m_polygon = !m_polygon;
     
    572572        glPolygonMode(GL_FRONT, polygon_fillmode);
    573573    }
    574     if (Input::WasPressed(Key::K_F3))
     574    if (Input::WasPressed(Key::F3))
    575575    {
    576576        m_shader_glow = !m_shader_glow;
    577577        m_shader_blur = !m_shader_blur;
    578578    }
    579     if (Input::WasPressed(Key::K_F4))
     579    if (Input::WasPressed(Key::F4))
    580580    {
    581581        m_shader_postfx = !m_shader_postfx;
    582582    }
    583     if (Input::WasPressed(Key::K_F5))
     583    if (Input::WasPressed(Key::F5))
    584584    {
    585585        Pause();
    586586    }
    587    if (Input::WasPressed(Key::K_TAB))
     587   if (Input::WasPressed(Key::Tab))
    588588    {
    589589        if (m_setup)
     
    593593        }
    594594    }
    595     if (Input::WasPressed(Key::K_UP))
     595    if (Input::WasPressed(Key::Up))
    596596    {
    597597        if (m_setup)
     
    610610        }
    611611    }
    612     if (Input::WasPressed(Key::K_DOWN))
     612    if (Input::WasPressed(Key::Down))
    613613    {
    614614        if (m_setup)
     
    627627        }
    628628    }
    629     if (Input::WasPressed(Key::K_PAGEUP))
     629    if (Input::WasPressed(Key::PageUp))
    630630    {
    631631        if (m_setup)
     
    641641        }
    642642    }
    643     if (Input::WasPressed(Key::K_PAGEDOWN))
     643    if (Input::WasPressed(Key::PageDown))
    644644    {
    645645        if (m_setup)
     
    656656        }
    657657    }
    658     if (Input::WasPressed(Key::K_LEFT))
     658    if (Input::WasPressed(Key::Left))
    659659    {
    660660        if (m_setup && setup_switch)
     
    665665        }
    666666    }
    667     if (Input::WasPressed(Key::K_RIGHT))
     667    if (Input::WasPressed(Key::Right))
    668668    {
    669669        if (m_setup && setup_switch)
     
    674674        }
    675675    }
    676     if (Input::WasPressed(Key::K_RETURN))
     676    if (Input::WasPressed(Key::Return))
    677677    {
    678678        sync_flag = true;
Note: See TracChangeset for help on using the changeset viewer.