AGS: Engine: prevent cursor from leaving game area

From upstream 8cf49996d05a6fb4fd8691fa87fb6a12114e45d7
This commit is contained in:
Walter Agazzi 2023-01-17 15:10:55 +01:00 committed by Thierry Crozat
parent 2ef1dfd3a6
commit 5614bc15de

View File

@ -72,8 +72,8 @@ void mgetgraphpos() {
_G(real_mouse_y) = CLIP(_G(real_mouse_y) + rel_y, _GP(mouse).ControlRect.Top, _GP(mouse).ControlRect.Bottom);
} else {
// Save real cursor coordinates provided by system
_G(real_mouse_x) = _G(sys_mouse_x);
_G(real_mouse_y) = _G(sys_mouse_y);
_G(real_mouse_x) = CLIP((int)_G(sys_mouse_x), _GP(mouse).ControlRect.Left, _GP(mouse).ControlRect.Right);
_G(real_mouse_y) = CLIP((int)_G(sys_mouse_y), _GP(mouse).ControlRect.Top, _GP(mouse).ControlRect.Bottom);
}
// Set new in-game cursor position