Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Mouse Probs.

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Blue*Omega   Members   

150
Like
Likes
Like

Posted 01 April 2000 - 03:43 PM

Hi! I''m new to this forum but what I''ve seen so far has been VERY helpful... So I was wondering if anyone knew the answer to my problem. In my little engine i have a routine set up to capture mouse movement and clicks. Here''s the code. case WM_MOUSEMOVE: mousex = LOWORD (lParam) - 400; mousey = HIWORD (lParam) - 300; mouseclk = wParam; //SetCursorPos (400, 300); break; This works fine but... If I un-comment the SetCursor my program crashes! I want to set up a Quake II/III style console so I am trying to get the mouse to recenter it''s self whenever it is moved (by the way, this program runs in 800x600). I just don''t know how to get the mouse to center without SetCursor! Can anyone help me??? Blue*Omega :)

#2 Big Al   Members   

122
Like
Likes
Like

Posted 01 April 2000 - 04:16 PM

Okay,
Let's See here:

case WM_MOUSEMOVE:
mousex = LOWORD(lParam) - 400;
mousey = HIWORD(lParam) - 300;
mouseclk = wParam;
SetCursorPos(400,300);
break;

I assume you are letting Windows "blit" your cursor for you.

Hence: Whenever you call SetCursorPos() it sends the WM_MOUSEMOVE call to your app, resulting in a never ending loop. (I think)

Thus this code should fix it:
case WM_MOUSEMOVE:
mousex = LOWORD(lParam) - 400;
mousey = HIWORD(lParam) - 300;
mouseclk = wParam;
if ((LOWORD(lParam) != 400) /* OR MARKS */ // (HIWORD(lParam) != 300))
SetCursorPos(400,300);
break;


Edited by - Big Al on 4/3/00 2:51:09 AM




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.