Message handling

I’m writing a simple viewer that will allow user to view the object usign mouse (rotate, zoom, pan)… now after adding a timer to the application so as to do simple animation… I can see that the higher priority is given to the mouseMove as when i start the animation via the timer and at the same time use the mouse to move around the scence… the animation freezes up… why is this??

In game how do they achieve it it… i.e the almost simultaneous message processing…


You messed up your message loop apparently.

In your WinMain you want something like :


    while (TRUE)

		dt = difftime(NewTime,LastTime);
		LastTime = NewTime;*/

		//Player.pos.Y=-dl;redraw();Player.pos.Y= 0.0;
		/*if (GetMessage(&msg, NULL, 0, 0) == TRUE)
		while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) == TRUE)

            if (GetMessage(&msg, NULL, 0, 0) == TRUE)
            } else {
                return TRUE;
		/* real time !! ! !! ! !*/
		/*  TODO : insert some real time stuff here !*/
    return msg.wParam;

how did i mess up the messagee loop…? I’m a newbie could you an info at ur code… can anything in the OnNotify be done to handle this???

My point is if you want to do it ‘like in games’, you have one render loop that always updates the screen as fast as possible, and messages processings and timers just manipulate coordinates, animations etc. But not generate directly repaints.

I am no expert at win32 programming but I was able to do that with the code I gave you.

If you need more help, show your code, maybe someone more qualified may say something about it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.