On Windows, separate analog and digital arrows.

This fixes the Tales of Eternia menu and movement.
This commit is contained in:
Unknown W. Brackets committed 2012-12-02 16:04:50 -08:00
1 parent fd2d666191
commit 958fd29593
1 file changed
+32 -16
+32 -16
View File
@@ -17,30 +17,46 @@ static const unsigned short key_ctrl_map[] = {
VK_LEFT, CTRL_LEFT,
VK_RIGHT, CTRL_RIGHT,
};
static const unsigned short analog_ctrl_map[] = {
'I', CTRL_UP,
'K', CTRL_DOWN,
'J', CTRL_LEFT,
'L', CTRL_RIGHT,
};
int KeyboardDevice::UpdateState() {
float analogX = 0;
float analogY = 0;
for (int i = 0; i < sizeof(key_ctrl_map)/sizeof(key_ctrl_map[0]); i += 2) {
if (!GetAsyncKeyState(key_ctrl_map[i]))
__CtrlButtonUp(key_ctrl_map[i+1]);
else {
__CtrlButtonDown(key_ctrl_map[i+1]);
switch (key_ctrl_map[i]) {
case VK_UP:
analogY -= .8f;
break;
case VK_DOWN:
analogY += .8f;
break;
case VK_LEFT:
analogX -= .8f;
break;
case VK_RIGHT:
analogX += .8f;
break;
}
}
}
float analogX = 0;
float analogY = 0;
for (int i = 0; i < sizeof(analog_ctrl_map)/sizeof(analog_ctrl_map[0]); i += 2) {
if (!GetAsyncKeyState(analog_ctrl_map[i])) {
continue;
}
switch (analog_ctrl_map[i + 1]) {
case CTRL_UP:
analogY -= .8f;
break;
case CTRL_DOWN:
analogY += .8f;
break;
case CTRL_LEFT:
analogX -= .8f;
break;
case CTRL_RIGHT:
analogX += .8f;
break;
}
}
__CtrlSetAnalog(analogX, analogY);
return 0;
}