localize DeviceButton names

This commit is contained in:
Chris Danford
2006-03-16 20:57:10 +00:00
parent 3fbf89bc0a
commit c2946d8342
2 changed files with 35 additions and 0 deletions
+34
View File
@@ -7,6 +7,7 @@
#include "RageInputDevice.h"
#include "RageUtil.h"
#include "EnumHelper.h"
#include "LocalizedString.h"
static map<DeviceButton,RString> g_mapNamesToString;
static map<RString,DeviceButton> g_mapStringToNames;
@@ -146,6 +147,39 @@ RString DeviceButtonToString( DeviceButton key )
return "unknown";
}
static LocalizedString HOME ( "DeviceButton", "Home" );
static LocalizedString END ( "DeviceButton", "End" );
static LocalizedString UP ( "DeviceButton", "Up" );
static LocalizedString DOWN ( "DeviceButton", "Down" );
static LocalizedString SPACE ( "DeviceButton", "Space" );
static LocalizedString SHIFT ( "DeviceButton", "Shift" );
static LocalizedString CTRL ( "DeviceButton", "Ctrl" );
static LocalizedString ALT ( "DeviceButton", "Alt" );
static LocalizedString INSERT ( "DeviceButton", "Insert" );
static LocalizedString DELETE ( "DeviceButton", "Delete" );
static LocalizedString PGUP ( "DeviceButton", "PgUp" );
static LocalizedString PGDN ( "DeviceButton", "PgDn" );
RString DeviceButtonToLocalizedString( DeviceButton key )
{
switch( key )
{
case KEY_HOME: return HOME.GetValue();
case KEY_END: return END.GetValue();
case KEY_UP: return UP.GetValue();
case KEY_DOWN: return DOWN.GetValue();
case KEY_SPACE: return SPACE.GetValue();
case KEY_LSHIFT: case KEY_RSHIFT: return SHIFT.GetValue();
case KEY_LCTRL: case KEY_RCTRL: return CTRL.GetValue();
case KEY_LALT: case KEY_RALT: return ALT.GetValue();
case KEY_INSERT: return INSERT.GetValue();
case KEY_DEL: return DELETE.GetValue();
case KEY_PGUP: return PGUP.GetValue();
case KEY_PGDN: return PGDN.GetValue();
default: return Capitalize( DeviceButtonToString(key) );
}
}
DeviceButton StringToDeviceButton( const RString& s )
{
InitNames();
+1
View File
@@ -276,6 +276,7 @@ enum DeviceButton
};
RString DeviceButtonToString( DeviceButton i );
RString DeviceButtonToLocalizedString( DeviceButton i );
DeviceButton StringToDeviceButton( const RString& s );
struct DeviceInput