Jump to content
  • Advertisement
Sign in to follow this  
Samurai Jack

Mouse & WM_INPUT problems

This topic is 4217 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings! My problem is that when someone moves the mouse WM_INPUT is called like it should. That is ok. But let us say, you move the mouse to the left and WM_INPUT comes with the relative x change = -1. That is ok. But my problem is the following: I have a loop which calls m_pInput->Update(); what is when the user moves the mouse after Update() and the next update clears the mouse? Should I add the mouse movement changes or is there any better suggestion?

Share this post


Link to post
Share on other sites
Advertisement
It's not clear what you're doing. What is 'm_pInput', what does its Update() function do, and how are you handling the mouse? If you handle individual messages, then nothing gets cleared, as such. So it would help to know exactly what you're doing. If the problem is that you poll for input twice in one frame, it's usually simplest just to stop doing that!

Share this post


Link to post
Share on other sites
Hm, the problem was that the engine calls once per frame the Update() function which should check keystrokes, mouse and joysticks and then fire up action mapping. Update was not called by WM_INPUT but from the engine loop instead. The problem was what if, the update() block was allready processed and we were in the middle of the rendering and someone moves the mouse. Even if he left the mouse alone my variable still had the value of -1 for example. In this case it ment the following: if one moved mouse to the left (Relavtive X=-1) there IS no message, that says he does not move the mouse anymore, so the RelativeX is still -1. I did the following: if a WM_INPUT message gets processed it sums all X and Y into a buffer. And then when Input() gets called it copyies the BUFFER into RELATIVEXY and then clears the buffer. If no mouse movement available, mouse buffer is empty and RELATIVEXY will be empty by the next call on Update();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!