• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM mouse lock problem

A

Amazing creature

Guest
the mouse is locked in a radius in the center of the view, in windowed mode it works fine, but in fullscreen the mouse stays in one place without moving

Code:
if instance_exists(obj_center)
{
dir = point_direction(obj_center.x, obj_center.y, mouse_x, mouse_y);
dis = clamp(point_distance(obj_center.x, obj_center.y, mouse_x, mouse_y),99,100);

tar_x = obj_center.x + lengthdir_x(dis, dir);
tar_y = obj_center.y + lengthdir_y(dis, dir);

if (m_lock)
{
window_mouse_set(tar_x - obj_center.x + obj_center.offset_x, tar_y - obj_center.y + obj_center.offset_y)
}
}
basically what I need is that the mouse stays in the radius in fullscreen like it does in windowed mode
 

Attachments

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
For starters, you are getting room-space coordinates but then giving them to window_mouse_set, which might have a different coordinate space and scale (especially in fullscreen) - should use window_mouse_get_x() at least.
 
Top