Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4780 in orxonox.OLD for orxonox/trunk/src/lib/event


Ignore:
Timestamp:
Jul 2, 2005, 10:55:47 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: 1. the crosshair is registered, @patrick: i thought it was a little bit harder… worked myself through the EventSystem, it is quite cool :)

  1. Player now knows a loadParams and init routine

also testing the Crosshair inside of the Player

Location:
orxonox/trunk/src/lib/event
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/event/event_def.h

    r4662 r4780  
    1818//! these are the extended event types, that are not included in SDL_keysym
    1919typedef enum extEventTyes
    20   {
    21     EV_MOUSE_BUTTON_LEFT = SDLK_LAST,
    22     EV_MOUSE_BUTTON_MIDDLE,
    23     EV_MOUSE_BUTTON_RIGHT,
    24     EV_MOUSE_BUTTON_WHEELUP,
    25     EV_MOUSE_BUTTON_WHEELDOWN,
    26     EV_MOUSE_MOTION,
    27     EV_JOY_AXIS_MOTION,
    28     EV_JOY_BALL_MOTION,
    29     EV_JOY_HAT_MOTION,
    30     EV_JOY_BUTTON,
     20{
     21  EV_MOUSE_BUTTON_LEFT            = SDLK_LAST,
     22  EV_MOUSE_BUTTON_MIDDLE,
     23  EV_MOUSE_BUTTON_RIGHT,
     24  EV_MOUSE_BUTTON_WHEELUP,
     25  EV_MOUSE_BUTTON_WHEELDOWN,
     26  EV_MOUSE_MOTION                 = SDL_MOUSEMOTION,
     27  EV_JOY_AXIS_MOTION,
     28  EV_JOY_BALL_MOTION,
     29  EV_JOY_HAT_MOTION,
     30  EV_JOY_BUTTON,
    3131
    32     EV_UNKNOWN,
     32  EV_UNKNOWN,
    3333
    34     EV_NUMBER
    35   };
     34  EV_NUMBER,
     35
     36  EV_VIDEO_RESIZE                 = SDL_VIDEORESIZE
     37};
    3638
    3739
  • orxonox/trunk/src/lib/event/event_handler.cc

    r4519 r4780  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    1111   ### File Specific:
    1212   main-programmer: Patrick Boenzli
    13    co-programmer: 
     13   co-programmer:
    1414*/
    1515
     
    3131   \brief standard constructor
    3232*/
    33 EventHandler::EventHandler () 
    34 {
    35   this->setClassID(CL_EVENT_HANDLER, "EventHandler"); 
     33EventHandler::EventHandler ()
     34{
     35  this->setClassID(CL_EVENT_HANDLER, "EventHandler");
    3636
    3737  this->listeners = new EventListener**[ES_NUMBER];
     
    4343    {
    4444      for(int j = 0; j < SDLK_LAST; ++j)
    45         {
    46           this->listeners[i][j] = NULL;
    47         }
     45        {
     46          this->listeners[i][j] = NULL;
     47        }
    4848    }
    4949  this->state = ES_GAME;
     
    6161
    6262*/
    63 EventHandler::~EventHandler () 
     63EventHandler::~EventHandler ()
    6464{
    6565  EventHandler::singletonRef = NULL;
     
    9999   than one state, you have to subscribe for each state again. If you want to subscribe for all states, use
    100100   state = ES_ALL, which will subscribe your listener for all states together.
     101 *
     102 * \todo this can also be done with the & operator, and checking for states, just set the esState to 1,2,4,8, and then 15 is equal to ES_ALL
    101103*/
    102104void EventHandler::subscribe(EventListener* el, elState state, int eventType)
     
    106108    {
    107109      for(int i = 0; i < ES_NUMBER; ++i)
    108         if( likely(this->listeners[state][eventType] == NULL))
    109           this->listeners[i][eventType] = el;
    110         else
    111           PRINTF(1)("Someone tried to subscribe to event %i @ state %i but this event has already been subscribed\n", eventType, state);
    112     }
    113   else 
     110        if( likely(this->listeners[state][eventType] == NULL))
     111          this->listeners[i][eventType] = el;
     112        else
     113          PRINTF(1)("%s of class %s tried to subscribe to event %i @ state %i but this event has already been subscribed\n", el->getName(), el->getClassName(), eventType, state);
     114    }
     115  else
    114116    if( likely(this->listeners[state][eventType] == NULL))
    115117      {
    116         this->listeners[state][eventType] = el;
     118        this->listeners[state][eventType] = el;
    117119      }
    118120    else
    119       PRINTF(1)("Someone tried to subscribe to event %i @ state %i but this event has already been subscribed\n", eventType, state);
     121      PRINTF(1)("% of class %s tried to subscribe to event %i @ state %i but this event has already been subscribed\n", el->getName(), el->getClassName(), eventType, state);
    120122}
    121123
     
    126128   \param eventType: the event, that shall be unsubscribed
    127129
    128    if you want to unsubscribe an event listener from all subscribed events, just use the 
     130   if you want to unsubscribe an event listener from all subscribed events, just use the
    129131   unsubscribe(EventListener* el, elState state) function
    130132*/
     
    140142   \param el: the listener that wants to unsubscribe itself
    141143   \param state: the state in which the events shall be unsubscribed
    142    
     144
    143145*/
    144146void EventHandler::unsubscribe(EventListener* el, elState state)
     
    147149    {
    148150      for(int i = 0; i < ES_NUMBER; ++i)
    149         {
    150           for(int j = 0; j < EV_NUMBER; ++j)
    151             {
    152               if( this->listeners[i][j] == el )
    153                 this->listeners[i][j] = NULL;
    154             }
    155         }
     151        {
     152          for(int j = 0; j < EV_NUMBER; ++j)
     153            {
     154              if( this->listeners[i][j] == el )
     155                this->listeners[i][j] = NULL;
     156            }
     157        }
    156158    }
    157159  else
    158160    {
    159161      for(int j = 0; j < EV_NUMBER; ++j)
    160         {
    161           if( this->listeners[state][j] == el )
    162             this->listeners[state][j] = NULL;
    163         }
     162        {
     163          if( this->listeners[state][j] == el )
     164            this->listeners[state][j] = NULL;
     165        }
    164166    }
    165167}
     
    175177    {
    176178      for(int i = 0; i < ES_NUMBER; ++i)
    177         {
    178           for(int j = 0; j < EV_NUMBER; ++j)
    179             {
    180               this->listeners[i][j] = NULL;
    181             }
    182         }
     179        {
     180          for(int j = 0; j < EV_NUMBER; ++j)
     181            {
     182              this->listeners[i][j] = NULL;
     183            }
     184        }
    183185    }
    184186  else
    185187    {
    186188      for(int j = 0; j < EV_NUMBER; ++j)
    187         {
    188           this->listeners[state][j] = NULL;
    189         }
    190     }
    191 }
    192 
    193 
    194 /**
    195    \brief core function of event handler: receives all events from SDL 
     189        {
     190          this->listeners[state][j] = NULL;
     191        }
     192    }
     193}
     194
     195
     196/**
     197   \brief core function of event handler: receives all events from SDL
    196198
    197199   The event from the SDL framework are collected here and distributed to all listeners.
     
    205207    {
    206208      switch( event.type)
    207         {
    208         case SDL_KEYDOWN:
    209           ev.bPressed = true;
    210           ev.type = event.key.keysym.sym;
    211           break;
    212         case SDL_KEYUP:
    213           ev.bPressed = false;
    214           ev.type = event.key.keysym.sym;
    215           break;
    216         case SDL_MOUSEMOTION:
    217           ev.bPressed = false;
    218           ev.type = EV_MOUSE_MOTION;
    219           ev.x = event.motion.x;
    220           ev.y = event.motion.y;
    221           ev.xRel = event.motion.xrel;
    222           ev.yRel = event.motion.yrel;
    223           break;
    224         case SDL_MOUSEBUTTONUP:
    225           ev.bPressed = false;
    226           ev.type = event.button.button + SDLK_LAST;
    227           break;
    228         case SDL_MOUSEBUTTONDOWN:
    229           ev.bPressed = true;
    230           ev.type = event.button.button + SDLK_LAST;
    231           break;
    232         case SDL_JOYAXISMOTION:
    233           ev.bPressed = false;
    234           ev.type = EV_JOY_AXIS_MOTION;
    235           break;
    236         case SDL_JOYBALLMOTION:
    237           ev.bPressed = false;
    238           ev.type = EV_JOY_BALL_MOTION;
    239           break;
    240         case SDL_JOYHATMOTION:
    241           ev.bPressed = false;
    242           ev.type = EV_JOY_HAT_MOTION;
    243           break;
    244         case SDL_JOYBUTTONDOWN:
    245           ev.bPressed = true;
    246           ev.type = EV_JOY_BUTTON;
    247           break;
    248         case SDL_JOYBUTTONUP:
    249           ev.bPressed = true;
    250           ev.type = EV_JOY_BUTTON;
    251           break;
    252         default:
    253           ev.type = EV_UNKNOWN;
    254           break;
    255         }
    256 
    257       /* small debug routine: shows alle events dispatched by the event handler */
     209        {
     210        case SDL_KEYDOWN:
     211          ev.bPressed = true;
     212          ev.type = event.key.keysym.sym;
     213          break;
     214        case SDL_KEYUP:
     215          ev.bPressed = false;
     216          ev.type = event.key.keysym.sym;
     217          break;
     218        case SDL_MOUSEMOTION:
     219          ev.bPressed = false;
     220          ev.type = EV_MOUSE_MOTION;
     221          ev.x = event.motion.x;
     222          ev.y = event.motion.y;
     223          ev.xRel = event.motion.xrel;
     224          ev.yRel = event.motion.yrel;
     225          break;
     226        case SDL_MOUSEBUTTONUP:
     227          ev.bPressed = false;
     228          ev.type = event.button.button + SDLK_LAST;
     229          break;
     230        case SDL_MOUSEBUTTONDOWN:
     231          ev.bPressed = true;
     232          ev.type = event.button.button + SDLK_LAST;
     233          break;
     234        case SDL_JOYAXISMOTION:
     235          ev.bPressed = false;
     236          ev.type = EV_JOY_AXIS_MOTION;
     237          break;
     238        case SDL_JOYBALLMOTION:
     239          ev.bPressed = false;
     240          ev.type = EV_JOY_BALL_MOTION;
     241          break;
     242        case SDL_JOYHATMOTION:
     243          ev.bPressed = false;
     244          ev.type = EV_JOY_HAT_MOTION;
     245          break;
     246        case SDL_JOYBUTTONDOWN:
     247          ev.bPressed = true;
     248          ev.type = EV_JOY_BUTTON;
     249          break;
     250        case SDL_JOYBUTTONUP:
     251          ev.bPressed = true;
     252          ev.type = EV_JOY_BUTTON;
     253          break;
     254        default:
     255          ev.type = EV_UNKNOWN;
     256          break;
     257        }
     258
     259      /* small debug routine: shows all events dispatched by the event handler */
    258260      PRINT(4)("\n==========================| EventHandler::process () |===\n");
    259       PRINT(4)("=  Got Event nr %i, for state %i", ev.type, this->state); 
    260      
     261      PRINT(4)("=  Got Event nr %i, for state %i", ev.type, this->state);
     262
    261263      listener = this->listeners[this->state][ev.type];
    262264      if( listener != NULL)
    263         {
    264           PRINT(4)("=  Event dispatcher msg: This event has been consumed\n");
    265           PRINT(4)("=======================================================\n");     
    266           listener->process(ev);
    267         }
     265        {
     266          PRINT(4)("=  Event dispatcher msg: This event has been consumed\n");
     267          PRINT(4)("=======================================================\n");
     268          listener->process(ev);
     269        }
    268270      else
    269         {
    270           PRINT(4)("=  Event dispatcher msg: This event has NOT been consumed\n");
    271           PRINT(4)("=======================================================\n");     
    272         }
    273 
    274 
    275     }
    276 }
    277 
     271        {
     272          PRINT(4)("=  Event dispatcher msg: This event has NOT been consumed\n");
     273          PRINT(4)("=======================================================\n");
     274        }
     275    }
     276}
     277
  • orxonox/trunk/src/lib/event/event_handler.h

    r4746 r4780  
    1 /*! 
     1/*!
    22    \file event_handler.h
    33    \brief Definition of the EventHandler
    4    
     4
    55*/
    66
     
    3535 private:
    3636  EventHandler();
    37  
     37
    3838
    3939 private:
    40   static EventHandler* singletonRef;                  //!< the singleton reference
    41   EventListener*** listeners;                         //!< a list of registered listeners
    42   elState state;                                      //!< the state of the event handlder
    43   KeyMapper* keyMapper;                               //!< reference to the key mapper
     40  static EventHandler*       singletonRef;                  //!< the singleton reference
     41
     42  EventListener***           listeners;                     //!< a list of registered listeners
     43  elState                    state;                         //!< the state of the event handlder
     44  KeyMapper*                 keyMapper;                     //!< reference to the key mapper
    4445};
    4546
  • orxonox/trunk/src/lib/event/key_names.cc

    r4457 r4780  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    2222using namespace std;
    2323
    24 int buttonnameToSDLB( char* name)
     24int buttonnameToSDLB(const char* name)
    2525{
    26         if( !strcmp (name, "BUTTON_LEFT")) return SDL_BUTTON_LEFT;
    27         if( !strcmp (name, "BUTTON_MIDDLE")) return SDL_BUTTON_MIDDLE;
    28         if( !strcmp (name, "BUTTON_RIGHT")) return SDL_BUTTON_RIGHT;
    29 //      if( !strcmp (name, "BUTTON_WHEELUP")) return SDL_BUTTON_WHEELUP;
    30 //      if( !strcmp (name, "BUTTON_WHEELDOWN")) return SDL_BUTTON_WHEELDOWN;
    31         return -1;
     26        if( !strcmp (name, "BUTTON_LEFT")) return SDL_BUTTON_LEFT;
     27        if( !strcmp (name, "BUTTON_MIDDLE")) return SDL_BUTTON_MIDDLE;
     28        if( !strcmp (name, "BUTTON_RIGHT")) return SDL_BUTTON_RIGHT;
     29        if( !strcmp (name, "BUTTON_WHEELUP")) return SDL_BUTTON_WHEELUP;
     30        if( !strcmp (name, "BUTTON_WHEELDOWN")) return SDL_BUTTON_WHEELDOWN;
     31        return -1;
    3232}
    3333
    3434char* SDLBToButtonname( int button)
    3535{
    36         if( button == SDL_BUTTON_LEFT) return "BUTTON_LEFT";
    37         if( button == SDL_BUTTON_MIDDLE) return "BUTTON_MIDDLE";
    38         if( button == SDL_BUTTON_RIGHT) return "BUTTON_RIGHT";
    39 //      if( button == SDL_BUTTON_WHEELUP) return "BUTTON_WHEELUP";
    40 //      if( button == SDL_BUTTON_WHEELDOWN) return "BUTTON_WHEELDOWN";
    41         return "UNKNOWN";
     36        if( button == SDL_BUTTON_LEFT) return "BUTTON_LEFT";
     37        if( button == SDL_BUTTON_MIDDLE) return "BUTTON_MIDDLE";
     38        if( button == SDL_BUTTON_RIGHT) return "BUTTON_RIGHT";
     39        if( button == SDL_BUTTON_WHEELUP) return "BUTTON_WHEELUP";
     40        if( button == SDL_BUTTON_WHEELDOWN) return "BUTTON_WHEELDOWN";
     41        return "UNKNOWN";
    4242}
    4343
    44 int keynameToSDLK( char* name)
     44int keynameToSDLK(const char* name)
    4545{
    46         if( !strcmp (name, "BACKSPACE")) return SDLK_BACKSPACE;
    47         if( !strcmp (name, "TAB")) return SDLK_TAB;
    48         if( !strcmp (name, "CLEAR")) return SDLK_CLEAR;
    49         if( !strcmp (name, "RETURN")) return SDLK_RETURN;
    50         if( !strcmp (name, "ESCAPE")) return SDLK_ESCAPE;
    51         if( !strcmp (name, "SPACE")) return SDLK_SPACE;
    52         if( !strcmp (name, "EXCLAIM")) return SDLK_EXCLAIM;
    53         if( !strcmp (name, "QUOTEDBL")) return SDLK_QUOTEDBL;
    54         if( !strcmp (name, "HASH")) return SDLK_HASH;
    55         if( !strcmp (name, "PAUSE")) return SDLK_PAUSE;
    56         if( !strcmp (name, "DOLLAR")) return SDLK_DOLLAR;
    57         if( !strcmp (name, "AMPERSAND")) return SDLK_AMPERSAND;
    58         if( !strcmp (name, "QUOTE")) return SDLK_QUOTE;
    59         if( !strcmp (name, "LEFTPAREN")) return SDLK_LEFTPAREN;
    60         if( !strcmp (name, "RIGHTPAREN")) return SDLK_RIGHTPAREN;
    61         if( !strcmp (name, "ASTERISK")) return SDLK_ASTERISK;
    62         if( !strcmp (name, "PLUS")) return SDLK_PLUS;
    63         if( !strcmp (name, "COMMA")) return SDLK_COMMA;
    64         if( !strcmp (name, "MINUS")) return SDLK_MINUS;
    65         if( !strcmp (name, "PERIOD")) return SDLK_PERIOD;
    66         if( !strcmp (name, "SLASH")) return SDLK_SLASH;
    67         if( !strcmp (name, "0")) return SDLK_0;
    68         if( !strcmp (name, "1")) return SDLK_1;
    69         if( !strcmp (name, "2")) return SDLK_2;
    70         if( !strcmp (name, "3")) return SDLK_3;
    71         if( !strcmp (name, "4")) return SDLK_4;
    72         if( !strcmp (name, "5")) return SDLK_5;
    73         if( !strcmp (name, "6")) return SDLK_6;
    74         if( !strcmp (name, "7")) return SDLK_7;
    75         if( !strcmp (name, "8")) return SDLK_8;
    76         if( !strcmp (name, "9")) return SDLK_9;
    77         if( !strcmp (name, "COLON")) return SDLK_COLON;
    78         if( !strcmp (name, "SEMICOLON")) return SDLK_SEMICOLON;
    79         if( !strcmp (name, "LESS")) return SDLK_LESS;
    80         if( !strcmp (name, "EQUALS")) return SDLK_EQUALS;
    81         if( !strcmp (name, "GREATER")) return SDLK_GREATER;
    82         if( !strcmp (name, "QUESTION")) return SDLK_QUESTION;
    83         if( !strcmp (name, "AT")) return SDLK_AT;
    84         if( !strcmp (name, "LEFTBRACKET")) return SDLK_LEFTBRACKET;
    85         if( !strcmp (name, "BACKSLASH")) return SDLK_BACKSLASH;
    86         if( !strcmp (name, "RIGHTBRACKET")) return SDLK_RIGHTBRACKET;
    87         if( !strcmp (name, "CARET")) return SDLK_CARET;
    88         if( !strcmp (name, "UNDERSCORE")) return SDLK_UNDERSCORE;
    89         if( !strcmp (name, "BACKQUOTE")) return SDLK_BACKQUOTE;
    90         if( !strcmp (name, "a")) return SDLK_a;
    91         if( !strcmp (name, "b")) return SDLK_b;
    92         if( !strcmp (name, "c")) return SDLK_c;
    93         if( !strcmp (name, "d")) return SDLK_d;
    94         if( !strcmp (name, "e")) return SDLK_e;
    95         if( !strcmp (name, "f")) return SDLK_f;
    96         if( !strcmp (name, "g")) return SDLK_g;
    97         if( !strcmp (name, "h")) return SDLK_h;
    98         if( !strcmp (name, "i")) return SDLK_i;
    99         if( !strcmp (name, "j")) return SDLK_j;
    100         if( !strcmp (name, "k")) return SDLK_k;
    101         if( !strcmp (name, "l")) return SDLK_l;
    102         if( !strcmp (name, "m")) return SDLK_m;
    103         if( !strcmp (name, "n")) return SDLK_n;
    104         if( !strcmp (name, "o")) return SDLK_o;
    105         if( !strcmp (name, "p")) return SDLK_p;
    106         if( !strcmp (name, "q")) return SDLK_q;
    107         if( !strcmp (name, "r")) return SDLK_r;
    108         if( !strcmp (name, "s")) return SDLK_s;
    109         if( !strcmp (name, "t")) return SDLK_t;
    110         if( !strcmp (name, "u")) return SDLK_u;
    111         if( !strcmp (name, "v")) return SDLK_v;
    112         if( !strcmp (name, "w")) return SDLK_w;
    113         if( !strcmp (name, "x")) return SDLK_x;
    114         if( !strcmp (name, "y")) return SDLK_y;
    115         if( !strcmp (name, "z")) return SDLK_z;
    116         if( !strcmp (name, "DELETE")) return SDLK_DELETE;
    117         if( !strcmp (name, "KP0")) return SDLK_KP0;
    118         if( !strcmp (name, "KP1")) return SDLK_KP1;
    119         if( !strcmp (name, "KP2")) return SDLK_KP2;
    120         if( !strcmp (name, "KP3")) return SDLK_KP3;
    121         if( !strcmp (name, "KP4")) return SDLK_KP4;
    122         if( !strcmp (name, "KP5")) return SDLK_KP5;
    123         if( !strcmp (name, "KP6")) return SDLK_KP6;
    124         if( !strcmp (name, "KP7")) return SDLK_KP7;
    125         if( !strcmp (name, "KP8")) return SDLK_KP8;
    126         if( !strcmp (name, "KP9")) return SDLK_KP9;
    127         if( !strcmp (name, "KP_PERIOD")) return SDLK_KP_PERIOD;
    128         if( !strcmp (name, "KP_DIVIDE")) return SDLK_KP_DIVIDE;
    129         if( !strcmp (name, "KP_MULTIPLY")) return SDLK_KP_MULTIPLY;
    130         if( !strcmp (name, "KP_MINUS")) return SDLK_KP_MINUS;
    131         if( !strcmp (name, "KP_PLUS")) return SDLK_KP_PLUS;
    132         if( !strcmp (name, "KP_ENTER")) return SDLK_KP_ENTER;
    133         if( !strcmp (name, "KP_EQUALS")) return SDLK_KP_EQUALS;
    134         if( !strcmp (name, "UP")) return SDLK_UP;
    135         if( !strcmp (name, "DOWN")) return SDLK_DOWN;
    136         if( !strcmp (name, "RIGHT")) return SDLK_RIGHT;
    137         if( !strcmp (name, "LEFT")) return SDLK_LEFT;
    138         if( !strcmp (name, "INSERT")) return SDLK_INSERT;
    139         if( !strcmp (name, "HOME")) return SDLK_HOME;
    140         if( !strcmp (name, "END")) return SDLK_END;
    141         if( !strcmp (name, "PAGEUP")) return SDLK_PAGEUP;
    142         if( !strcmp (name, "PAGEDOWN")) return SDLK_PAGEDOWN;
    143         if( !strcmp (name, "F1")) return SDLK_F1;
    144         if( !strcmp (name, "F2")) return SDLK_F2;
    145         if( !strcmp (name, "F3")) return SDLK_F3;
    146         if( !strcmp (name, "F4")) return SDLK_F4;
    147         if( !strcmp (name, "F5")) return SDLK_F5;
    148         if( !strcmp (name, "F6")) return SDLK_F6;
    149         if( !strcmp (name, "F7")) return SDLK_F7;
    150         if( !strcmp (name, "F8")) return SDLK_F8;
    151         if( !strcmp (name, "F9")) return SDLK_F9;
    152         if( !strcmp (name, "F10")) return SDLK_F10;
    153         if( !strcmp (name, "F11")) return SDLK_F11;
    154         if( !strcmp (name, "F12")) return SDLK_F12;
    155         if( !strcmp (name, "F13")) return SDLK_F13;
    156         if( !strcmp (name, "F14")) return SDLK_F14;
    157         if( !strcmp (name, "F15")) return SDLK_F15;
    158         if( !strcmp (name, "NUMLOCK")) return SDLK_NUMLOCK;
    159         if( !strcmp (name, "CAPSLOCK")) return SDLK_CAPSLOCK;
    160         if( !strcmp (name, "SCROLLOCK")) return SDLK_SCROLLOCK;
    161         if( !strcmp (name, "RSHIFT")) return SDLK_RSHIFT;
    162         if( !strcmp (name, "LSHIFT")) return SDLK_LSHIFT;
    163         if( !strcmp (name, "RCTRL")) return SDLK_RCTRL;
    164         if( !strcmp (name, "LCTRL")) return SDLK_LCTRL;
    165         if( !strcmp (name, "RALT")) return SDLK_RALT;
    166         if( !strcmp (name, "LALT")) return SDLK_LALT;
    167         if( !strcmp (name, "RMETA")) return SDLK_RMETA;
    168         if( !strcmp (name, "LMETA")) return SDLK_LMETA;
    169         if( !strcmp (name, "LSUPER")) return SDLK_LSUPER;
    170         if( !strcmp (name, "RSUPER")) return SDLK_RSUPER;
    171         if( !strcmp (name, "MODE")) return SDLK_MODE;
    172         if( !strcmp (name, "HELP")) return SDLK_HELP;
    173         if( !strcmp (name, "PRINT")) return SDLK_PRINT;
    174         if( !strcmp (name, "SYSREQ")) return SDLK_SYSREQ;
    175         if( !strcmp (name, "BREAK")) return SDLK_BREAK;
    176         if( !strcmp (name, "MENU")) return SDLK_MENU;
    177         if( !strcmp (name, "POWER")) return SDLK_POWER;
    178         if( !strcmp (name, "EURO")) return SDLK_EURO;
    179         return -1;
     46        if( !strcmp (name, "BACKSPACE")) return SDLK_BACKSPACE;
     47        if( !strcmp (name, "TAB")) return SDLK_TAB;
     48        if( !strcmp (name, "CLEAR")) return SDLK_CLEAR;
     49        if( !strcmp (name, "RETURN")) return SDLK_RETURN;
     50        if( !strcmp (name, "ESCAPE")) return SDLK_ESCAPE;
     51        if( !strcmp (name, "SPACE")) return SDLK_SPACE;
     52        if( !strcmp (name, "EXCLAIM")) return SDLK_EXCLAIM;
     53        if( !strcmp (name, "QUOTEDBL")) return SDLK_QUOTEDBL;
     54        if( !strcmp (name, "HASH")) return SDLK_HASH;
     55        if( !strcmp (name, "PAUSE")) return SDLK_PAUSE;
     56        if( !strcmp (name, "DOLLAR")) return SDLK_DOLLAR;
     57        if( !strcmp (name, "AMPERSAND")) return SDLK_AMPERSAND;
     58        if( !strcmp (name, "QUOTE")) return SDLK_QUOTE;
     59        if( !strcmp (name, "LEFTPAREN")) return SDLK_LEFTPAREN;
     60        if( !strcmp (name, "RIGHTPAREN")) return SDLK_RIGHTPAREN;
     61        if( !strcmp (name, "ASTERISK")) return SDLK_ASTERISK;
     62        if( !strcmp (name, "PLUS")) return SDLK_PLUS;
     63        if( !strcmp (name, "COMMA")) return SDLK_COMMA;
     64        if( !strcmp (name, "MINUS")) return SDLK_MINUS;
     65        if( !strcmp (name, "PERIOD")) return SDLK_PERIOD;
     66        if( !strcmp (name, "SLASH")) return SDLK_SLASH;
     67        if( !strcmp (name, "0")) return SDLK_0;
     68        if( !strcmp (name, "1")) return SDLK_1;
     69        if( !strcmp (name, "2")) return SDLK_2;
     70        if( !strcmp (name, "3")) return SDLK_3;
     71        if( !strcmp (name, "4")) return SDLK_4;
     72        if( !strcmp (name, "5")) return SDLK_5;
     73        if( !strcmp (name, "6")) return SDLK_6;
     74        if( !strcmp (name, "7")) return SDLK_7;
     75        if( !strcmp (name, "8")) return SDLK_8;
     76        if( !strcmp (name, "9")) return SDLK_9;
     77        if( !strcmp (name, "COLON")) return SDLK_COLON;
     78        if( !strcmp (name, "SEMICOLON")) return SDLK_SEMICOLON;
     79        if( !strcmp (name, "LESS")) return SDLK_LESS;
     80        if( !strcmp (name, "EQUALS")) return SDLK_EQUALS;
     81        if( !strcmp (name, "GREATER")) return SDLK_GREATER;
     82        if( !strcmp (name, "QUESTION")) return SDLK_QUESTION;
     83        if( !strcmp (name, "AT")) return SDLK_AT;
     84        if( !strcmp (name, "LEFTBRACKET")) return SDLK_LEFTBRACKET;
     85        if( !strcmp (name, "BACKSLASH")) return SDLK_BACKSLASH;
     86        if( !strcmp (name, "RIGHTBRACKET")) return SDLK_RIGHTBRACKET;
     87        if( !strcmp (name, "CARET")) return SDLK_CARET;
     88        if( !strcmp (name, "UNDERSCORE")) return SDLK_UNDERSCORE;
     89        if( !strcmp (name, "BACKQUOTE")) return SDLK_BACKQUOTE;
     90        if( !strcmp (name, "a")) return SDLK_a;
     91        if( !strcmp (name, "b")) return SDLK_b;
     92        if( !strcmp (name, "c")) return SDLK_c;
     93        if( !strcmp (name, "d")) return SDLK_d;
     94        if( !strcmp (name, "e")) return SDLK_e;
     95        if( !strcmp (name, "f")) return SDLK_f;
     96        if( !strcmp (name, "g")) return SDLK_g;
     97        if( !strcmp (name, "h")) return SDLK_h;
     98        if( !strcmp (name, "i")) return SDLK_i;
     99        if( !strcmp (name, "j")) return SDLK_j;
     100        if( !strcmp (name, "k")) return SDLK_k;
     101        if( !strcmp (name, "l")) return SDLK_l;
     102        if( !strcmp (name, "m")) return SDLK_m;
     103        if( !strcmp (name, "n")) return SDLK_n;
     104        if( !strcmp (name, "o")) return SDLK_o;
     105        if( !strcmp (name, "p")) return SDLK_p;
     106        if( !strcmp (name, "q")) return SDLK_q;
     107        if( !strcmp (name, "r")) return SDLK_r;
     108        if( !strcmp (name, "s")) return SDLK_s;
     109        if( !strcmp (name, "t")) return SDLK_t;
     110        if( !strcmp (name, "u")) return SDLK_u;
     111        if( !strcmp (name, "v")) return SDLK_v;
     112        if( !strcmp (name, "w")) return SDLK_w;
     113        if( !strcmp (name, "x")) return SDLK_x;
     114        if( !strcmp (name, "y")) return SDLK_y;
     115        if( !strcmp (name, "z")) return SDLK_z;
     116        if( !strcmp (name, "DELETE")) return SDLK_DELETE;
     117        if( !strcmp (name, "KP0")) return SDLK_KP0;
     118        if( !strcmp (name, "KP1")) return SDLK_KP1;
     119        if( !strcmp (name, "KP2")) return SDLK_KP2;
     120        if( !strcmp (name, "KP3")) return SDLK_KP3;
     121        if( !strcmp (name, "KP4")) return SDLK_KP4;
     122        if( !strcmp (name, "KP5")) return SDLK_KP5;
     123        if( !strcmp (name, "KP6")) return SDLK_KP6;
     124        if( !strcmp (name, "KP7")) return SDLK_KP7;
     125        if( !strcmp (name, "KP8")) return SDLK_KP8;
     126        if( !strcmp (name, "KP9")) return SDLK_KP9;
     127        if( !strcmp (name, "KP_PERIOD")) return SDLK_KP_PERIOD;
     128        if( !strcmp (name, "KP_DIVIDE")) return SDLK_KP_DIVIDE;
     129        if( !strcmp (name, "KP_MULTIPLY")) return SDLK_KP_MULTIPLY;
     130        if( !strcmp (name, "KP_MINUS")) return SDLK_KP_MINUS;
     131        if( !strcmp (name, "KP_PLUS")) return SDLK_KP_PLUS;
     132        if( !strcmp (name, "KP_ENTER")) return SDLK_KP_ENTER;
     133        if( !strcmp (name, "KP_EQUALS")) return SDLK_KP_EQUALS;
     134        if( !strcmp (name, "UP")) return SDLK_UP;
     135        if( !strcmp (name, "DOWN")) return SDLK_DOWN;
     136        if( !strcmp (name, "RIGHT")) return SDLK_RIGHT;
     137        if( !strcmp (name, "LEFT")) return SDLK_LEFT;
     138        if( !strcmp (name, "INSERT")) return SDLK_INSERT;
     139        if( !strcmp (name, "HOME")) return SDLK_HOME;
     140        if( !strcmp (name, "END")) return SDLK_END;
     141        if( !strcmp (name, "PAGEUP")) return SDLK_PAGEUP;
     142        if( !strcmp (name, "PAGEDOWN")) return SDLK_PAGEDOWN;
     143        if( !strcmp (name, "F1")) return SDLK_F1;
     144        if( !strcmp (name, "F2")) return SDLK_F2;
     145        if( !strcmp (name, "F3")) return SDLK_F3;
     146        if( !strcmp (name, "F4")) return SDLK_F4;
     147        if( !strcmp (name, "F5")) return SDLK_F5;
     148        if( !strcmp (name, "F6")) return SDLK_F6;
     149        if( !strcmp (name, "F7")) return SDLK_F7;
     150        if( !strcmp (name, "F8")) return SDLK_F8;
     151        if( !strcmp (name, "F9")) return SDLK_F9;
     152        if( !strcmp (name, "F10")) return SDLK_F10;
     153        if( !strcmp (name, "F11")) return SDLK_F11;
     154        if( !strcmp (name, "F12")) return SDLK_F12;
     155        if( !strcmp (name, "F13")) return SDLK_F13;
     156        if( !strcmp (name, "F14")) return SDLK_F14;
     157        if( !strcmp (name, "F15")) return SDLK_F15;
     158        if( !strcmp (name, "NUMLOCK")) return SDLK_NUMLOCK;
     159        if( !strcmp (name, "CAPSLOCK")) return SDLK_CAPSLOCK;
     160        if( !strcmp (name, "SCROLLOCK")) return SDLK_SCROLLOCK;
     161        if( !strcmp (name, "RSHIFT")) return SDLK_RSHIFT;
     162        if( !strcmp (name, "LSHIFT")) return SDLK_LSHIFT;
     163        if( !strcmp (name, "RCTRL")) return SDLK_RCTRL;
     164        if( !strcmp (name, "LCTRL")) return SDLK_LCTRL;
     165        if( !strcmp (name, "RALT")) return SDLK_RALT;
     166        if( !strcmp (name, "LALT")) return SDLK_LALT;
     167        if( !strcmp (name, "RMETA")) return SDLK_RMETA;
     168        if( !strcmp (name, "LMETA")) return SDLK_LMETA;
     169        if( !strcmp (name, "LSUPER")) return SDLK_LSUPER;
     170        if( !strcmp (name, "RSUPER")) return SDLK_RSUPER;
     171        if( !strcmp (name, "MODE")) return SDLK_MODE;
     172        if( !strcmp (name, "HELP")) return SDLK_HELP;
     173        if( !strcmp (name, "PRINT")) return SDLK_PRINT;
     174        if( !strcmp (name, "SYSREQ")) return SDLK_SYSREQ;
     175        if( !strcmp (name, "BREAK")) return SDLK_BREAK;
     176        if( !strcmp (name, "MENU")) return SDLK_MENU;
     177        if( !strcmp (name, "POWER")) return SDLK_POWER;
     178        if( !strcmp (name, "EURO")) return SDLK_EURO;
     179        return -1;
    180180}
    181181
    182182char* SDLKToKeyname( int key)
    183183{
    184         if( key == SDLK_BACKSPACE) return "BACKSPACE";
    185         if( key == SDLK_TAB) return "TAB";
    186         if( key == SDLK_CLEAR) return "CLEAR";
    187         if( key == SDLK_RETURN) return "RETURN";
    188         if( key == SDLK_SPACE) return "SPACE";
    189         if( key == SDLK_ESCAPE) return "ESCAPE";
    190         if( key == SDLK_EXCLAIM) return "EXCLAIM";
    191         if( key == SDLK_QUOTEDBL) return "QUOTEDBL";
    192         if( key == SDLK_HASH) return "HASH";
    193         if( key == SDLK_PAUSE) return "PAUSE";
    194         if( key == SDLK_DOLLAR) return "DOLLAR";
    195         if( key == SDLK_AMPERSAND) return "AMPERSAND";
    196         if( key == SDLK_QUOTE) return "QUOTE";
    197         if( key == SDLK_LEFTPAREN) return "LEFTPAREN";
    198         if( key == SDLK_RIGHTPAREN) return "RIGHTPAREN";
    199         if( key == SDLK_ASTERISK) return "ASTERISK";
    200         if( key == SDLK_PLUS) return "PLUS";
    201         if( key == SDLK_COMMA) return "COMMA";
    202         if( key == SDLK_MINUS) return "MINUS";
    203         if( key == SDLK_PERIOD) return "PERIOD";
    204         if( key == SDLK_SLASH) return "SLASH";
    205         if( key == SDLK_0) return "0";
    206         if( key == SDLK_1) return "1";
    207         if( key == SDLK_2) return "2";
    208         if( key == SDLK_3) return "3";
    209         if( key == SDLK_4) return "4";
    210         if( key == SDLK_5) return "5";
    211         if( key == SDLK_6) return "6";
    212         if( key == SDLK_7) return "7";
    213         if( key == SDLK_8) return "8";
    214         if( key == SDLK_9) return "9";
    215         if( key == SDLK_COLON) return "COLON";
    216         if( key == SDLK_SEMICOLON) return "SEMICOLON";
    217         if( key == SDLK_LESS) return "LESS";
    218         if( key == SDLK_EQUALS) return "EQUALS";
    219         if( key == SDLK_GREATER) return "GREATER";
    220         if( key == SDLK_QUESTION) return "QUESTION";
    221         if( key == SDLK_AT) return "AT";
    222         if( key == SDLK_LEFTBRACKET) return "LEFTBRACKET";
    223         if( key == SDLK_BACKSLASH) return "BACKSLASH";
    224         if( key == SDLK_RIGHTBRACKET) return "RIGHTBRACKET";
    225         if( key == SDLK_CARET) return "CARET";
    226         if( key == SDLK_UNDERSCORE) return "UNDERSCORE";
    227         if( key == SDLK_BACKQUOTE) return "BACKQUOTE";
    228         if( key == SDLK_a) return "a";
    229         if( key == SDLK_b) return "b";
    230         if( key == SDLK_c) return "c";
    231         if( key == SDLK_d) return "d";
    232         if( key == SDLK_e) return "e";
    233         if( key == SDLK_f) return "f";
    234         if( key == SDLK_g) return "g";
    235         if( key == SDLK_h) return "h";
    236         if( key == SDLK_i) return "i";
    237         if( key == SDLK_j) return "j";
    238         if( key == SDLK_k) return "k";
    239         if( key == SDLK_l) return "l";
    240         if( key == SDLK_m) return "m";
    241         if( key == SDLK_n) return "n";
    242         if( key == SDLK_o) return "o";
    243         if( key == SDLK_p) return "p";
    244         if( key == SDLK_q) return "q";
    245         if( key == SDLK_r) return "r";
    246         if( key == SDLK_s) return "s";
    247         if( key == SDLK_t) return "t";
    248         if( key == SDLK_u) return "u";
    249         if( key == SDLK_v) return "v";
    250         if( key == SDLK_w) return "w";
    251         if( key == SDLK_x) return "x";
    252         if( key == SDLK_y) return "y";
    253         if( key == SDLK_z) return "z";
    254         if( key == SDLK_DELETE) return "DELETE";
    255         if( key == SDLK_KP0) return "KP0";
    256         if( key == SDLK_KP1) return "KP1";
    257         if( key == SDLK_KP2) return "KP2";
    258         if( key == SDLK_KP3) return "KP3";
    259         if( key == SDLK_KP4) return "KP4";
    260         if( key == SDLK_KP5) return "KP5";
    261         if( key == SDLK_KP6) return "KP6";
    262         if( key == SDLK_KP7) return "KP7";
    263         if( key == SDLK_KP8) return "KP8";
    264         if( key == SDLK_KP9) return "KP9";
    265         if( key == SDLK_KP_PERIOD) return "KP_PERIOD";
    266         if( key == SDLK_KP_DIVIDE) return "KP_DIVIDE";
    267         if( key == SDLK_KP_MULTIPLY) return "KP_MULTIPLY";
    268         if( key == SDLK_KP_MINUS) return "KP_MINUS";
    269         if( key == SDLK_KP_PLUS) return "KP_PLUS";
    270         if( key == SDLK_KP_ENTER) return "KP_ENTER";
    271         if( key == SDLK_KP_EQUALS) return "KP_EQUALS";
    272         if( key == SDLK_UP) return "UP";
    273         if( key == SDLK_DOWN) return "DOWN";
    274         if( key == SDLK_RIGHT) return "RIGHT";
    275         if( key == SDLK_LEFT) return "LEFT";
    276         if( key == SDLK_INSERT) return "INSERT";
    277         if( key == SDLK_HOME) return "HOME";
    278         if( key == SDLK_END) return "END";
    279         if( key == SDLK_PAGEUP) return "PAGEUP";
    280         if( key == SDLK_PAGEDOWN) return "PAGEDOWN";
    281         if( key == SDLK_F1) return "F1";
    282         if( key == SDLK_F2) return "F2";
    283         if( key == SDLK_F3) return "F3";
    284         if( key == SDLK_F4) return "F4";
    285         if( key == SDLK_F5) return "F5";
    286         if( key == SDLK_F6) return "F6";
    287         if( key == SDLK_F7) return "F7";
    288         if( key == SDLK_F8) return "F8";
    289         if( key == SDLK_F9) return "F9";
    290         if( key == SDLK_F10) return "F10";
    291         if( key == SDLK_F11) return "F11";
    292         if( key == SDLK_F12) return "F12";
    293         if( key == SDLK_F13) return "F13";
    294         if( key == SDLK_F14) return "F14";
    295         if( key == SDLK_F15) return "F15";
    296         if( key == SDLK_NUMLOCK) return "NUMLOCK";
    297         if( key == SDLK_CAPSLOCK) return "CAPSLOCK";
    298         if( key == SDLK_SCROLLOCK) return "SCROLLOCK";
    299         if( key == SDLK_RSHIFT) return "RSHIFT";
    300         if( key == SDLK_LSHIFT) return "LSHIFT";
    301         if( key == SDLK_RCTRL) return "RCTRL";
    302         if( key == SDLK_LCTRL) return "LCTRL";
    303         if( key == SDLK_RALT) return "RALT";
    304         if( key == SDLK_LALT) return "LALT";
    305         if( key == SDLK_RMETA) return "RMETA";
    306         if( key == SDLK_LMETA) return "LMETA";
    307         if( key == SDLK_LSUPER) return "LSUPER";
    308         if( key == SDLK_RSUPER) return "RSUPER";
    309         if( key == SDLK_MODE) return "MODE";
    310         if( key == SDLK_HELP) return "HELP";
    311         if( key == SDLK_PRINT) return "PRINT";
    312         if( key == SDLK_SYSREQ) return "SYSREQ";
    313         if( key == SDLK_BREAK) return "BREAK";
    314         if( key == SDLK_MENU) return "MENU";
    315         if( key == SDLK_POWER) return "POWER";
    316         if( key == SDLK_EURO) return "EURO";
    317         return "UNKNOWN";
     184        if( key == SDLK_BACKSPACE) return "BACKSPACE";
     185        if( key == SDLK_TAB) return "TAB";
     186        if( key == SDLK_CLEAR) return "CLEAR";
     187        if( key == SDLK_RETURN) return "RETURN";
     188        if( key == SDLK_SPACE) return "SPACE";
     189        if( key == SDLK_ESCAPE) return "ESCAPE";
     190        if( key == SDLK_EXCLAIM) return "EXCLAIM";
     191        if( key == SDLK_QUOTEDBL) return "QUOTEDBL";
     192        if( key == SDLK_HASH) return "HASH";
     193        if( key == SDLK_PAUSE) return "PAUSE";
     194        if( key == SDLK_DOLLAR) return "DOLLAR";
     195        if( key == SDLK_AMPERSAND) return "AMPERSAND";
     196        if( key == SDLK_QUOTE) return "QUOTE";
     197        if( key == SDLK_LEFTPAREN) return "LEFTPAREN";
     198        if( key == SDLK_RIGHTPAREN) return "RIGHTPAREN";
     199        if( key == SDLK_ASTERISK) return "ASTERISK";
     200        if( key == SDLK_PLUS) return "PLUS";
     201        if( key == SDLK_COMMA) return "COMMA";
     202        if( key == SDLK_MINUS) return "MINUS";
     203        if( key == SDLK_PERIOD) return "PERIOD";
     204        if( key == SDLK_SLASH) return "SLASH";
     205        if( key == SDLK_0) return "0";
     206        if( key == SDLK_1) return "1";
     207        if( key == SDLK_2) return "2";
     208        if( key == SDLK_3) return "3";
     209        if( key == SDLK_4) return "4";
     210        if( key == SDLK_5) return "5";
     211        if( key == SDLK_6) return "6";
     212        if( key == SDLK_7) return "7";
     213        if( key == SDLK_8) return "8";
     214        if( key == SDLK_9) return "9";
     215        if( key == SDLK_COLON) return "COLON";
     216        if( key == SDLK_SEMICOLON) return "SEMICOLON";
     217        if( key == SDLK_LESS) return "LESS";
     218        if( key == SDLK_EQUALS) return "EQUALS";
     219        if( key == SDLK_GREATER) return "GREATER";
     220        if( key == SDLK_QUESTION) return "QUESTION";
     221        if( key == SDLK_AT) return "AT";
     222        if( key == SDLK_LEFTBRACKET) return "LEFTBRACKET";
     223        if( key == SDLK_BACKSLASH) return "BACKSLASH";
     224        if( key == SDLK_RIGHTBRACKET) return "RIGHTBRACKET";
     225        if( key == SDLK_CARET) return "CARET";
     226        if( key == SDLK_UNDERSCORE) return "UNDERSCORE";
     227        if( key == SDLK_BACKQUOTE) return "BACKQUOTE";
     228        if( key == SDLK_a) return "a";
     229        if( key == SDLK_b) return "b";
     230        if( key == SDLK_c) return "c";
     231        if( key == SDLK_d) return "d";
     232        if( key == SDLK_e) return "e";
     233        if( key == SDLK_f) return "f";
     234        if( key == SDLK_g) return "g";
     235        if( key == SDLK_h) return "h";
     236        if( key == SDLK_i) return "i";
     237        if( key == SDLK_j) return "j";
     238        if( key == SDLK_k) return "k";
     239        if( key == SDLK_l) return "l";
     240        if( key == SDLK_m) return "m";
     241        if( key == SDLK_n) return "n";
     242        if( key == SDLK_o) return "o";
     243        if( key == SDLK_p) return "p";
     244        if( key == SDLK_q) return "q";
     245        if( key == SDLK_r) return "r";
     246        if( key == SDLK_s) return "s";
     247        if( key == SDLK_t) return "t";
     248        if( key == SDLK_u) return "u";
     249        if( key == SDLK_v) return "v";
     250        if( key == SDLK_w) return "w";
     251        if( key == SDLK_x) return "x";
     252        if( key == SDLK_y) return "y";
     253        if( key == SDLK_z) return "z";
     254        if( key == SDLK_DELETE) return "DELETE";
     255        if( key == SDLK_KP0) return "KP0";
     256        if( key == SDLK_KP1) return "KP1";
     257        if( key == SDLK_KP2) return "KP2";
     258        if( key == SDLK_KP3) return "KP3";
     259        if( key == SDLK_KP4) return "KP4";
     260        if( key == SDLK_KP5) return "KP5";
     261        if( key == SDLK_KP6) return "KP6";
     262        if( key == SDLK_KP7) return "KP7";
     263        if( key == SDLK_KP8) return "KP8";
     264        if( key == SDLK_KP9) return "KP9";
     265        if( key == SDLK_KP_PERIOD) return "KP_PERIOD";
     266        if( key == SDLK_KP_DIVIDE) return "KP_DIVIDE";
     267        if( key == SDLK_KP_MULTIPLY) return "KP_MULTIPLY";
     268        if( key == SDLK_KP_MINUS) return "KP_MINUS";
     269        if( key == SDLK_KP_PLUS) return "KP_PLUS";
     270        if( key == SDLK_KP_ENTER) return "KP_ENTER";
     271        if( key == SDLK_KP_EQUALS) return "KP_EQUALS";
     272        if( key == SDLK_UP) return "UP";
     273        if( key == SDLK_DOWN) return "DOWN";
     274        if( key == SDLK_RIGHT) return "RIGHT";
     275        if( key == SDLK_LEFT) return "LEFT";
     276        if( key == SDLK_INSERT) return "INSERT";
     277        if( key == SDLK_HOME) return "HOME";
     278        if( key == SDLK_END) return "END";
     279        if( key == SDLK_PAGEUP) return "PAGEUP";
     280        if( key == SDLK_PAGEDOWN) return "PAGEDOWN";
     281        if( key == SDLK_F1) return "F1";
     282        if( key == SDLK_F2) return "F2";
     283        if( key == SDLK_F3) return "F3";
     284        if( key == SDLK_F4) return "F4";
     285        if( key == SDLK_F5) return "F5";
     286        if( key == SDLK_F6) return "F6";
     287        if( key == SDLK_F7) return "F7";
     288        if( key == SDLK_F8) return "F8";
     289        if( key == SDLK_F9) return "F9";
     290        if( key == SDLK_F10) return "F10";
     291        if( key == SDLK_F11) return "F11";
     292        if( key == SDLK_F12) return "F12";
     293        if( key == SDLK_F13) return "F13";
     294        if( key == SDLK_F14) return "F14";
     295        if( key == SDLK_F15) return "F15";
     296        if( key == SDLK_NUMLOCK) return "NUMLOCK";
     297        if( key == SDLK_CAPSLOCK) return "CAPSLOCK";
     298        if( key == SDLK_SCROLLOCK) return "SCROLLOCK";
     299        if( key == SDLK_RSHIFT) return "RSHIFT";
     300        if( key == SDLK_LSHIFT) return "LSHIFT";
     301        if( key == SDLK_RCTRL) return "RCTRL";
     302        if( key == SDLK_LCTRL) return "LCTRL";
     303        if( key == SDLK_RALT) return "RALT";
     304        if( key == SDLK_LALT) return "LALT";
     305        if( key == SDLK_RMETA) return "RMETA";
     306        if( key == SDLK_LMETA) return "LMETA";
     307        if( key == SDLK_LSUPER) return "LSUPER";
     308        if( key == SDLK_RSUPER) return "RSUPER";
     309        if( key == SDLK_MODE) return "MODE";
     310        if( key == SDLK_HELP) return "HELP";
     311        if( key == SDLK_PRINT) return "PRINT";
     312        if( key == SDLK_SYSREQ) return "SYSREQ";
     313        if( key == SDLK_BREAK) return "BREAK";
     314        if( key == SDLK_MENU) return "MENU";
     315        if( key == SDLK_POWER) return "POWER";
     316        if( key == SDLK_EURO) return "EURO";
     317        return "UNKNOWN";
    318318}
  • orxonox/trunk/src/lib/event/key_names.h

    r4457 r4780  
    22    \file keynames.h
    33    \brief Key/button naming functions
    4    
    5                 Converts strings to SDLK/SDL_BUTTON values and vice versa
     4
     5                Converts strings to SDLK/SDL_BUTTON values and vice versa
    66*/
    77#ifndef _KEY_NAMES_H
     
    99
    1010/**
    11         \brief converts a button name string to a integer representing the corresponding SDL mouse button identifier
    12         \param name: the name of the mouse button
    13         \return an int containing the SDL identifier of the mouse button or -1 if the button name is not valid
     11        \brief converts a button name string to a integer representing the corresponding SDL mouse button identifier
     12        \param name: the name of the mouse button
     13        \return an int containing the SDL identifier of the mouse button or -1 if the button name is not valid
    1414*/
    15 int buttonnameToSDLB( char* name);
     15int buttonnameToSDLB(const char* name);
    1616
    1717/**
    18         \brief converst a SDL mouse button identifier to a name string
    19         \param button: an SDL mouse button identifier
    20         \return a pointer to a string containing the name of the mouse button
     18        \brief converst a SDL mouse button identifier to a name string
     19        \param button: an SDL mouse button identifier
     20        \return a pointer to a string containing the name of the mouse button
    2121*/
    2222char* SDLBToButtonname( int button);
    2323
    2424/**
    25         \brief converts a key name string to a integer representing the corresponding SDLK sym
    26         \param name: the name of the key
    27         \return the SDLK sym of the named key or -1 if the key name is not valid
     25        \brief converts a key name string to a integer representing the corresponding SDLK sym
     26        \param name: the name of the key
     27        \return the SDLK sym of the named key or -1 if the key name is not valid
    2828*/
    29 int keynameToSDLK( char* name);
     29int keynameToSDLK(const char* name);
    3030
    3131/**
    32         \brief converts an SDLK sym to a name string
    33         \param key: the SDLK sym
    34         \return a pointer to a string containig the name of the key
     32        \brief converts an SDLK sym to a name string
     33        \param key: the SDLK sym
     34        \return a pointer to a string containig the name of the key
    3535*/
    3636char* SDLKToKeyname( int key);
Note: See TracChangeset for help on using the changeset viewer.