Stopping the mouse

Started by
2 comments, last by hibiki_konzaki 21 years, 5 months ago
Ok, heres the thing. In my game I''ve got everythign set up and I''m just about ready to start on A.I. and stuff, but the mouse won''t stop at the edge of the screen. I''ve tested for hitting the bounds of the screen, and even out to 30 pixels away from the edge on the top and bottom, but the mouse moves more than 30 pixels per frame. So I was wondering if there was some technique I didn''t know about or something. Thanks. Hibiki Wheres the any key?
find your element at mutedfaith.com. <º>
HibikiWheres the any key?www.geocities.com/dragongames123/home.html
find your elementat mutedfaith.com.<º>
Advertisement
Try ClipCursor().
If you''re talking about your in-game cursor, why not something like
if(cursor.x_pos > screen_max_x_pos)
cursor.x_pos = screen_max_x_pos;
etc.?

If Win32 cursor, you can grab the current mouse pos at the beginning and use SetCursorPos (IIRC) to set it back to that position every frame, taking the difference between that point and where it has moved to and using those coordinates as the movement vector.

Ask if you need implementation details.

Peace,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

Thank you! It works. I''m using a DX call with my own little class. Thanks again!

Hibiki
Wheres the any key?





find your element
at mutedfaith.com.
<º>
HibikiWheres the any key?www.geocities.com/dragongames123/home.html
find your elementat mutedfaith.com.<º>

This topic is closed to new replies.

Advertisement