0

I was wondering would I still need to use a basic game loop for this particular operation?

Peter Alexander
  • 53,344
  • 14
  • 119
  • 168
cpx
  • 17,009
  • 20
  • 87
  • 142
  • If your application has a UI then it is required, if it is a console application then you don't need a message loop. – Ismael Mar 08 '10 at 16:32
  • please note that by "game loop" I assume you mean a loop that runs as often as possible or at the VSYNC rate of the display, not event driven – Ben Voigt Mar 08 '10 at 20:26

3 Answers3

4

No, just use CreateWaitableTimer, SetWaitableTimer, and then use MsgWaitForMultipleObjects instead of GetMessage or PeekMessage in your event dispatch loop (typically in WinMain).

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
3

You could create a timer and perform that action on WM_TIMER message handling or on timer proc function you specify when creating the timer.

See SetTimer and WM_TIMER.

Cătălin Pitiș
  • 14,123
  • 2
  • 39
  • 62
1

You can implement timers more generally and portably by using the Boost Asio library.

Here's an example of creating an asynchronous timer.

Peter Alexander
  • 53,344
  • 14
  • 119
  • 168