From 3e9bd3aaac77aec75e787b67e39dc31d42dcc664 Mon Sep 17 00:00:00 2001 From: Info Teddy Date: Sun, 12 Jan 2020 01:09:32 -0800 Subject: [PATCH] Fix scaling editor mouse coords properly in stretch mode Now your cursor will properly align with the editor's cursor if you're in stretch mode. Closes #27. --- desktop_version/src/editor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 4db1b7d5..5330c2c5 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -3642,6 +3642,13 @@ void editorinput( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, enti game.my = (float) key.my; ed.tilex=(game.mx - (game.mx%8))/8; ed.tiley=(game.my - (game.my%8))/8; + if (game.stretchMode == 1) { + // In this mode specifically, we have to fix the mouse coordinates + int winwidth, winheight; + dwgfx.screenbuffer->GetWindowSize(&winwidth, &winheight); + ed.tilex = ed.tilex * 320 / winwidth; + ed.tiley = ed.tiley * 240 / winheight; + } game.press_left = false; game.press_right = false;