Skip to content

Commit

Permalink
Fix 1 pixel offset in Y-coordinate for mouse events
Browse files Browse the repository at this point in the history
  • Loading branch information
schellingb committed Nov 11, 2019
1 parent a309763 commit fc75a5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/ZL_Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void ZL_Display_Process_Event(ZL_Event& event)
{
case ZL_EVENT_MOUSEMOTION:
if (use_inputscale) { event.motion.x -= window_viewport[0]; event.motion.x *= inputscale_x; event.motion.y -= window_viewport[1]; event.motion.y *= inputscale_y; event.motion.xrel *= inputscale_x; event.motion.yrel *= inputscale_y; }
event.motion.y = ZL_Display::Height - event.motion.y;
event.motion.y = ZL_Display::Height - 1 - event.motion.y;
ZL_Display::PointerX = event.motion.x;
ZL_Display::PointerY = event.motion.y;
event.motion.yrel = -event.motion.yrel;
Expand All @@ -69,7 +69,7 @@ void ZL_Display_Process_Event(ZL_Event& event)
case ZL_EVENT_MOUSEBUTTONUP:
assert(event.button.is_down == (event.type == ZL_EVENT_MOUSEBUTTONDOWN));
if (use_inputscale) { event.button.x -= window_viewport[0]; event.button.x *= inputscale_x; event.button.y -= window_viewport[1]; event.button.y *= inputscale_y; }
event.button.y = ZL_Display::Height - event.button.y;
event.button.y = ZL_Display::Height - 1 - event.button.y;
ZL_Display::PointerX = event.button.x;
ZL_Display::PointerY = event.button.y;
ZL_Display::MouseDown[event.button.button] = event.button.is_down;
Expand Down

0 comments on commit fc75a5c

Please sign in to comment.