analog sticks works better now
This commit is contained in:
parent
91e6d35e89
commit
b17a57cb3d
|
@ -132,42 +132,74 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
break;
|
||||
case SDLK_a:
|
||||
axis = Input::Axis::LeftX;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += -127;
|
||||
} else {
|
||||
axisvalue = 0;
|
||||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_d:
|
||||
axis = Input::Axis::LeftX;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += 127;
|
||||
} else {
|
||||
axisvalue = 0;
|
||||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_w:
|
||||
axis = Input::Axis::LeftY;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += -127;
|
||||
} else {
|
||||
axisvalue = 0;
|
||||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_s:
|
||||
axis = Input::Axis::LeftY;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += 127;
|
||||
} else {
|
||||
axisvalue = 0;
|
||||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_j:
|
||||
axis = Input::Axis::RightX;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += -127;
|
||||
} else {
|
||||
axisvalue = 0;
|
||||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_l:
|
||||
axis = Input::Axis::RightX;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += 127;
|
||||
} else {
|
||||
axisvalue = 0;
|
||||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_i:
|
||||
axis = Input::Axis::RightY;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += -127;
|
||||
} else {
|
||||
axisvalue = 0;
|
||||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
case SDLK_k:
|
||||
axis = Input::Axis::RightY;
|
||||
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||
axisvalue += 127;
|
||||
} else {
|
||||
axisvalue = 0;
|
||||
}
|
||||
ax = Input::GetAxis(-0x80, 0x80, axisvalue);
|
||||
break;
|
||||
default:
|
||||
|
@ -176,7 +208,7 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
|||
if (button != 0) {
|
||||
controller->CheckButton(0, button, event->type == SDL_EVENT_KEY_DOWN);
|
||||
}
|
||||
if (axis != Input::Axis::AxisMax&& event->type == SDL_EVENT_KEY_DOWN) {
|
||||
if (axis != Input::Axis::AxisMax) {
|
||||
controller->Axis(0, axis, ax);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue