Commit b43d6618 authored by James's avatar James
Browse files

Make emulated cursor movement relative to screen size (partially fixes #13)

parent f9c671cf
......@@ -70,9 +70,13 @@ void MouseTracker::Update(int bufferWidth, int bufferHeight,
(bool)(LibRetro::CheckInput(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT)) ||
(bool)(LibRetro::CheckInput(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3));
auto mouseX = LibRetro::CheckInput(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X) * 2;
auto mouseY = LibRetro::CheckInput(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y) * 2;
OnMouseMove(mouseX, mouseY);
// TODO: Provide config option for ratios here
auto widthSpeed = (bottomScreen.GetWidth() / 20.0);
auto heightSpeed = (bottomScreen.GetHeight() / 20.0);
auto mouseX = LibRetro::CheckInput(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X) * (widthSpeed / 30);
auto mouseY = LibRetro::CheckInput(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y) * (heightSpeed / 30);
OnMouseMove(static_cast<int>(mouseX), static_cast<int>(mouseY));
if (LibRetro::settings.analog_function != LibRetro::CStickFunction::CStick) {
float controllerX =
......@@ -92,7 +96,8 @@ void MouseTracker::Update(int bufferWidth, int bufferHeight,
controllerY = 0;
}
OnMouseMove((int)(controllerX * 20), (int)(controllerY * 20));
OnMouseMove(static_cast<int>(controllerX * widthSpeed),
static_cast<int>(controllerY * heightSpeed));
}
Restrict(0, 0, bufferWidth, bufferHeight);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment