Changeset 7661 in orxonox.OLD for trunk/src/lib/event/key_names.cc
- Timestamp:
- May 18, 2006, 12:55:34 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/event/key_names.cc
r7221 r7661 17 17 #include "event_def.h" 18 18 19 #include "stdincl.h" 20 21 #include <string.h> 22 23 using namespace std; 19 std::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 28 int 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 24 37 25 38 int buttonnameToSDLB(const std::string& name) … … 33 46 } 34 47 35 const char*SDLBToButtonname( int button)48 std::string SDLBToButtonname( int button) 36 49 { 37 50 if( button == EV_MOUSE_BUTTON_LEFT) return "BUTTON_LEFT"; … … 181 194 } 182 195 183 const char*SDLKToKeyname(int key)196 std::string SDLKToKeyname(int key) 184 197 { 185 198 if( key == SDLK_BACKSPACE) return "BACKSPACE";
Note: See TracChangeset
for help on using the changeset viewer.