mardi 4 août 2015

How to set mouse move frequency

I need to update my window each time I catch the mouse move event, but I would like to call the update function not to many times (since it would be only a waste of computational time).

Let's say that I would like to update the window only once for each second, that is, if in a single second I receive 20 mouse move calls I will perform only the first call ignoring the following 19 calls.

LRESULT WndProc()
{
case WM_MOUSEMOVE:
   update(); // avoid to many calls
}

Should I use a simple counter and a stopwatch or are there better ways to do the same thing?

Aucun commentaire:

Enregistrer un commentaire