Made controller mapping possible in Xbox

This commit is contained in:
Ryan Dortmans
2004-09-09 08:50:16 +00:00
parent 2dac0c1523
commit cd579141b5
2 changed files with 31 additions and 0 deletions
+30
View File
@@ -152,6 +152,36 @@ static bool IsAxis( const DeviceInput& DeviceI )
}
void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
#ifdef _XBOX
if(!m_iWaitingForPress && DeviceI.device == DEVICE_JOY1)
{
// map the xbox controller buttons to the keyboard equivalents
DeviceInput keymap;
keymap.device = DEVICE_KEYBOARD;
if(DeviceI.button == JOY_HAT_LEFT)
keymap.button = SDLK_LEFT;
else if(DeviceI.button == JOY_HAT_RIGHT)
keymap.button = SDLK_RIGHT;
else if(DeviceI.button == JOY_HAT_UP)
keymap.button = SDLK_UP;
else if(DeviceI.button == JOY_HAT_DOWN)
keymap.button = SDLK_DOWN;
else if(DeviceI.button == JOY_9)
keymap.button = SDLK_RETURN;
else if(DeviceI.button == JOY_10)
keymap.button = SDLK_ESCAPE;
InputInternal(keymap, type, GameI, MenuI, StyleI);
return;
}
#endif
InputInternal(DeviceI, type, GameI, MenuI, StyleI);
}
void ScreenMapControllers::InputInternal( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
return; // ignore