PeekMessage and DirectX issue

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.
 
W

Wiktor Zychla

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top