Fixing stiks state monitor (#2933)

This commit is contained in:
Yaroslav Salnikov 2019-04-22 00:49:11 +04:00 committed by arcum42
parent 4202cbe7e8
commit 6bae2f7629
1 changed files with 7 additions and 2 deletions

View File

@ -462,14 +462,19 @@ void Dialog::JoystickEvent(wxTimerEvent &event)
}
else
{
int dir=0;
if (map >= PAD_L_UP && map <= PAD_L_LEFT)
{
m_pan_tabs[events.jaxis.which]->MoveJoystick(events.jaxis.axis, events.jaxis.value);
if ((map==PAD_L_LEFT) || (map==PAD_L_RIGHT)) dir=0; // Assumption that LEFT-RIGHT axis is always 0 and UP-DOWN always 1
else if ((map==PAD_L_UP) || (map==PAD_L_DOWN)) dir=1; // and so on, can be wrong.
m_pan_tabs[events.jaxis.which]->MoveJoystick(dir, events.jaxis.value);
m_pan_tabs[events.jaxis.which]->ShowImg(img_left_cursor);
}
else if (map >= PAD_R_UP && map <= PAD_R_LEFT)
{
m_pan_tabs[events.jaxis.which]->MoveJoystick(events.jaxis.axis, events.jaxis.value);
if ((map==PAD_R_LEFT) || (map==PAD_R_RIGHT)) dir=2;
else if ((map==PAD_R_UP) || (map==PAD_R_DOWN)) dir=3;
m_pan_tabs[events.jaxis.which]->MoveJoystick(dir, events.jaxis.value);
m_pan_tabs[events.jaxis.which]->ShowImg(img_right_cursor);
}
else if (map < PAD_L_UP) // if this is not a joystick