Sign in to follow this  
Waaayoff

Not getting Input fast enough?

Recommended Posts

In my tetris game (which is taking way too long to finish :( ) The user can rotate the camera around the grid box by clicking on the left mouse button and moving the curser around. But, there is always a couple of seconds' delay. When i stop clicking on the mouse button, rotation should stop, but the camera keeps rotating for a couple of seconds (more or less). Same goes for starting the rotation. I would post the code if you want to, but i doubt that the rotation code is the culprit: I used the same code to rotate the camera in a project where the only thing being done is rendering a teapot, and it worked just fine.. Thanks for your help :)

Share this post


Link to post
Share on other sites
Are you using Win32? If so, are you processing all of your window messages before rendering a frame (I.e. while(PeekMessage())... )?

Share this post


Link to post
Share on other sites
I'm such an idiot!

I found the problem -.-

I have a loop function that calls a handlemessages function:

Loop.cpp:

while (HandleMessages())

//code here

HandleMessages Function:

bool HandleMessages()
{
static MSG msg;

if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) // NOTICE THE IF
{
if (msg.message == WM_QUIT)
return FALSE;

TranslateMessage(&msg);
DispatchMessage(&msg);
}

return TRUE;
}


I put in if instead of while by mistake..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this