PeekMessage and DirectX issue

  • Thread starter Thread starter Adam Hamilton
  • Start date Start date
A

Adam Hamilton

I am trying to write a simple space invaders game using DirectX and
Visual C++.NET. There are DirectX classes for managed DirectX and I
would like to use these to write my game. In traditional Win32
programming, you can peek a message from the queue, do what needs to
be done and then call your update frame procedure, however, I can not
seem to find an equivalent for .NET. I have looked in the
System.Messaging.MessageQueue class but it looks as though I can't use
it as I can't get access to the main message queue.

How would I go about writing my own message loop?

Thankyou for any help you might offer.
 
How would I go about writing my own message loop?

Instead of typical

Application.Run( new fMain() );

that hides the message loop, you would rather write something that "mimics"
the message loop.

using ( DirectXForm dxForm = new DirectXForm() )
{
. . .
dxForm.Show();
. . .
while ( dxForm.Created )
{
dxForm.AdvanceFrame();
dxForm.Render();
Application.DoEvents();
}
}

I hope this is what you look for.
Wiktor Zychla
 
Back
Top