Disable accelerometer as axis, fix some omissions in KeyMap (doesn't actually autoload all those maps yet)

This commit is contained in:
Henrik Rydgard 2013-08-17 13:41:04 +02:00
parent 8028ff7f12
commit 47ac6c02fc
3 changed files with 36 additions and 1 deletions

View File

@ -145,6 +145,28 @@ static const DefMappingStruct defaultPadMap[] = {
#endif
};
static const DefMappingStruct defaultOuyaMap[] = {
{CTRL_CROSS , NKCODE_BUTTON_A},
{CTRL_CIRCLE , NKCODE_BUTTON_B},
{CTRL_SQUARE , NKCODE_BUTTON_X},
{CTRL_TRIANGLE , NKCODE_BUTTON_Y},
{CTRL_UP , NKCODE_DPAD_UP},
{CTRL_RIGHT , NKCODE_DPAD_RIGHT},
{CTRL_DOWN , NKCODE_DPAD_DOWN},
{CTRL_LEFT , NKCODE_DPAD_LEFT},
{CTRL_START , NKCODE_BUTTON_START},
{CTRL_SELECT , NKCODE_BUTTON_SELECT},
{CTRL_LTRIGGER , NKCODE_BUTTON_L1},
{CTRL_RTRIGGER , NKCODE_BUTTON_R1},
{VIRTKEY_UNTHROTTLE , NKCODE_BUTTON_R2},
{VIRTKEY_PAUSE , NKCODE_BUTTON_THUMBR},
{VIRTKEY_SPEED_TOGGLE, NKCODE_BUTTON_L2},
{VIRTKEY_AXIS_X_MIN, JOYSTICK_AXIS_X, -1},
{VIRTKEY_AXIS_X_MAX, JOYSTICK_AXIS_X, +1},
{VIRTKEY_AXIS_Y_MIN, JOYSTICK_AXIS_Y, -1},
{VIRTKEY_AXIS_Y_MAX, JOYSTICK_AXIS_Y, +1},
};
static const DefMappingStruct defaultXperiaPlay[] = {
{CTRL_CROSS , NKCODE_BUTTON_CROSS},
{CTRL_CIRCLE , NKCODE_BUTTON_CIRCLE},
@ -184,10 +206,18 @@ void SetDefaultKeyMap(DefaultMaps dmap, bool replace) {
case DEFAULT_MAPPING_SHIELD:
SetDefaultKeyMap(DEVICE_ID_X360_0, defaultShieldKeyMap, ARRAY_SIZE(defaultShieldKeyMap), replace);
break;
case DEFAULT_MAPPING_PAD:
SetDefaultKeyMap(DEVICE_ID_X360_0, defaultPadMap, ARRAY_SIZE(defaultPadMap), replace);
break;
case DEFAULT_MAPPING_OUYA:
SetDefaultKeyMap(DEVICE_ID_X360_0, defaultOuyaMap, ARRAY_SIZE(defaultOuyaMap), replace);
break;
case DEFAULT_MAPPING_XPERIA_PLAY:
SetDefaultKeyMap(DEVICE_ID_X360_0, defaultXperiaPlay, ARRAY_SIZE(defaultXperiaPlay), replace);
break;
}
}
const KeyMap_IntStrPair key_names[] = {
{NKCODE_A, "A"},
{NKCODE_B, "B"},

View File

@ -50,6 +50,7 @@ enum DefaultMaps {
DEFAULT_MAPPING_X360,
DEFAULT_MAPPING_SHIELD,
DEFAULT_MAPPING_OUYA,
DEFAULT_MAPPING_XPERIA_PLAY,
};
const float AXIS_BIND_THRESHOLD = 0.75f;

View File

@ -598,6 +598,10 @@ void NativeKey(const KeyInput &key) {
}
void NativeAxis(const AxisInput &key) {
if (key.axisId >= JOYSTICK_AXIS_ACCELEROMETER_X && key.axisId <= JOYSTICK_AXIS_ACCELEROMETER_Z) {
// Disable accelerometer as an axis for now.
return;
}
if (screenManager)
screenManager->axis(key);
}