diff --git a/src/core_lua.c b/src/core_lua.c index 6f76d427fc46234c9aa8c6a6fa9414d460e1a8a4..8e7edf9192628328d7b7f71471d848d2e46e4f44 100644 --- a/src/core_lua.c +++ b/src/core_lua.c @@ -2216,7 +2216,12 @@ static int gl_scissor(lua_State *L) { if (lua_toboolean(L, 1)) { glEnable(GL_SCISSOR_TEST); - glScissor(luaL_checknumber(L, 2), screen->h - luaL_checknumber(L, 3) - luaL_checknumber(L, 5), luaL_checknumber(L, 4), luaL_checknumber(L, 5)); + float x = luaL_checknumber(L, 2); + float y = luaL_checknumber(L, 3); + float w = luaL_checknumber(L, 4); + float h = luaL_checknumber(L, 5); + y = screen->h / screen_zoom - y - h; + glScissor(x, y, w, h); } else glDisable(GL_SCISSOR_TEST); return 0; } diff --git a/src/main.c b/src/main.c index 194942f7a9b6b3997403f45cbfea5ea8adcbbcd5..ff0c48e83905052b9e9feb7cad026412de859143 100644 --- a/src/main.c +++ b/src/main.c @@ -459,8 +459,8 @@ bool on_event(SDL_Event *event) } return TRUE; case SDL_MOUSEMOTION: - mousex = event->motion.x; - mousey = event->motion.y; + mousex = event->motion.x / screen_zoom; + mousey = event->motion.y / screen_zoom; if (current_mousehandler != LUA_NOREF) { diff --git a/src/wait.c b/src/wait.c index cd59b3166b4030a175d57bcaa0381a7fcfef776c..10f1ad31cca9eecae61d6df1b187706e2dc0fa64 100644 --- a/src/wait.c +++ b/src/wait.c @@ -46,13 +46,13 @@ static int draw_last_frame(lua_State *L) { if (!bkg_t) return 0; - int w, h; - SDL_GetWindowSize(window, &w, &h); + float w = screen->w / screen_zoom; + float h = screen->h / screen_zoom; GLfloat btexcoords[2*4] = { - 0, (float)h/(float)bkg_realh, - (float)w/(float)bkg_realw, (float)h/(float)bkg_realh, - (float)w/(float)bkg_realw, 0, + 0, (float)screen->h/(float)bkg_realh, + (float)screen->w/(float)bkg_realw, (float)screen->h/(float)bkg_realh, + (float)screen->w/(float)bkg_realw, 0, 0, 0 }; GLfloat bcolors[4*4] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; @@ -119,8 +119,8 @@ static int enable(lua_State *L) SDL_GL_SwapWindow(window); - int w, h; - SDL_GetWindowSize(window, &w, &h); + float w = screen->w; + float h = screen->h; bkg_w = w; bkg_h = h;