mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Generalize stretch mode mouse scaling fix
This puts the code to fix mouse coordinates in stretch mode directly inside KeyPoll::Poll, preventing the need for any other instances of mouse coordinate usage to copy-paste code.
This commit is contained in:
@@ -3128,16 +3128,8 @@ void editorinput(void)
|
||||
ed.old_tilex = ed.tilex;
|
||||
ed.old_tiley = ed.tiley;
|
||||
|
||||
ed.tilex = (key.mx - (key.mx % 8)) / 8;
|
||||
ed.tiley = (key.my - (key.my % 8)) / 8;
|
||||
|
||||
if (gameScreen.scalingMode == SCALING_STRETCH) {
|
||||
// In this mode specifically, we have to fix the mouse coordinates
|
||||
int screenwidth, screenheight;
|
||||
gameScreen.GetScreenSize(&screenwidth, &screenheight);
|
||||
ed.tilex = ed.tilex * 320 / screenwidth;
|
||||
ed.tiley = ed.tiley * 240 / screenheight;
|
||||
}
|
||||
ed.tilex = key.mousex / 8;
|
||||
ed.tiley = key.mousey / 8;
|
||||
|
||||
bool up_pressed = key.isDown(SDLK_UP) || key.isDown(SDL_CONTROLLER_BUTTON_DPAD_UP);
|
||||
bool down_pressed = key.isDown(SDLK_DOWN) || key.isDown(SDL_CONTROLLER_BUTTON_DPAD_DOWN);
|
||||
|
||||
Reference in New Issue
Block a user