Skip to content

Commit ff6f3f0

Browse files
committed
use getter function for screenw/h in input.cpp
1 parent 482f3d2 commit ff6f3f0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/engine/interface/input.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static bool filterevent(const SDL_Event &event)
114114
case SDL_MOUSEMOTION:
115115
if(grabinput && !relativemouse && !(SDL_GetWindowFlags(screen) & SDL_WINDOW_FULLSCREEN))
116116
{
117-
if(event.motion.x == screenw / 2 && event.motion.y == screenh / 2)
117+
if(event.motion.x == hudw() / 2 && event.motion.y == hudh() / 2)
118118
{
119119
return false; // ignore any motion events generated by SDL_WarpMouse
120120
}
@@ -188,7 +188,7 @@ static void resetmousemotion()
188188
{
189189
if(grabinput && !relativemouse && !(SDL_GetWindowFlags(screen) & SDL_WINDOW_FULLSCREEN))
190190
{
191-
SDL_WarpMouseInWindow(screen, screenw / 2, screenh / 2); //move to middle of screen
191+
SDL_WarpMouseInWindow(screen, hudw() / 2, hudh() / 2); //move to middle of screen
192192
}
193193
}
194194

@@ -328,8 +328,8 @@ void checkinput(int map)
328328
if(!(SDL_GetWindowFlags(screen) & SDL_WINDOW_FULLSCREEN))
329329
{
330330
//need to cast enums to ints for std's clamp implementation
331-
scr_w = std::clamp(screenw, static_cast<int>(SCR_MINW), static_cast<int>(SCR_MAXW));
332-
scr_h = std::clamp(screenh, static_cast<int>(SCR_MINH), static_cast<int>(SCR_MAXH));
331+
scr_w = std::clamp(hudw(), static_cast<int>(SCR_MINW), static_cast<int>(SCR_MAXW));
332+
scr_h = std::clamp(hudh(), static_cast<int>(SCR_MINH), static_cast<int>(SCR_MAXH));
333333
}
334334
gl_resize();
335335
break;

0 commit comments

Comments
 (0)