Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7661 in orxonox.OLD for trunk/src/lib/event/key_names.cc


Ignore:
Timestamp:
May 18, 2006, 12:55:34 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the QT_GUI back to the trunk
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/qt_gui . -r7607:HEAD

absolutely no conflicts :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/event/key_names.cc

    r7221 r7661  
    1717#include "event_def.h"
    1818
    19 #include "stdincl.h"
    20 
    21 #include <string.h>
    22 
    23 using namespace std;
     19std::string EVToKeyName(int key)
     20{
     21  std::string name = SDLBToButtonname( key );
     22  if (name != "UNKNOWN")
     23    return name;
     24  else
     25    return SDLKToKeyname( key );
     26}
     27
     28int KeyNameToEV(const std::string& keyName)
     29{
     30  int key = buttonnameToSDLB( keyName );
     31  if (key != -1)
     32    return key;
     33  else
     34    return keynameToSDLK( keyName );
     35}
     36
    2437
    2538int buttonnameToSDLB(const std::string& name)
     
    3346}
    3447
    35 const char* SDLBToButtonname( int button)
     48std::string SDLBToButtonname( int button)
    3649{
    3750        if( button == EV_MOUSE_BUTTON_LEFT) return "BUTTON_LEFT";
     
    181194}
    182195
    183 const char* SDLKToKeyname(int key)
     196std::string SDLKToKeyname(int key)
    184197{
    185198        if( key == SDLK_BACKSPACE) return "BACKSPACE";
Note: See TracChangeset for help on using the changeset viewer.