Jump to content
  • Advertisement
Sign in to follow this  

FPS movement question

This topic is 2794 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

Hey guys

So basically, how do you move the camera??
I used to just basically use WM_LBUTTONDOWN to invoke SetCapture() and save the current mouse position, and then, in WM_MOUSEMOVE, i just capture the new mouse position and get the difference as dx and dy for the movement.

But i just want to move the camera without the need to press LMB every time(like in a real FPS shooter).

So what is wrong with my current code??

return 0;

return 0;


mOldMousePos = mMousePos;
mMousePos.x = (int)LOWORD(lparam);
mMousePos.y = (int)HIWORD(lparam);

mCameraDx = mMousePos.x - mOldMousePos.x;
mCameraDy = mMousePos.y - mOldMousePos.y;

return 0;

mMousePos is initially initialized as (0,0) and both it and mOldMousePos are ::POINT members.

my current problem with this code is that it is moving SO SLOWLY every two seconds or so. It is not in real-time

Share this post

Link to post
Share on other sites
Im not an expert with Windows, but that code looks fine. How are you handling your Messages? (DispatchMessage(),etc) Why not use RawInput?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!