Fix mouse position in hires mode

This commit is contained in:
Splendide Imaginarius 2024-07-29 02:51:45 +00:00
parent 3376730416
commit de4740d973

View file

@ -1440,15 +1440,29 @@ int Input::dir8Value()
int Input::mouseX()
{
RGSSThreadData &rtData = shState->rtData();
return (p->mousePos[0] - rtData.screenOffset.x) * rtData.sizeResoRatio.x;
int hiresResult = (p->mousePos[0] - rtData.screenOffset.x) * rtData.sizeResoRatio.x;
if (shState->config().enableHires) {
double framebufferScalingFactor = shState->config().framebufferScalingFactor;
return (int)lround(hiresResult / framebufferScalingFactor);
}
return hiresResult;
}
int Input::mouseY()
{
RGSSThreadData &rtData = shState->rtData();
return (p->mousePos[1] - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
int hiresResult = (p->mousePos[1] - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
if (shState->config().enableHires) {
double framebufferScalingFactor = shState->config().framebufferScalingFactor;
return (int)lround(hiresResult / framebufferScalingFactor);
}
return hiresResult;
}
int Input::scrollV()