Real Time Loop In Managed C++

Started by
4 comments, last by TankAviator 20 years, 2 months ago
Is there a method in C++ .NET to emulate a real time loop while still using the managed forms editor? while(true) { if(PeekMessage(msg, hWnd, 0, 0, PM_REMOVE) { if(msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } fGameLoop(); } James Meade Lt(jg) VAQ-140 VUSN
James MeadeLt(jg)VAQ-140 VUSN
Advertisement
I''m sorry I don''t have an answer to your question, but please don''t crosspost.

Enigma
Check out this tutorial, it may help. It discusses the game loop using MDX9. Good luck!

Marcus
Oops! Forgot the link. Sorry.

http://staff.develop.com/candera/weblog2/articleview.aspx/DirectX/Direct3D/01%20GameLoop.xml

Marcus
Thanks for the tip. with a bit of trial and error I got it to work. Instead of calling Application ::Run(new Form1), I call Form1::Main() (static function), and here is the code for the Main:::

public: static void Main()
{
Form1* app = new Form1;
app->Show();
while(app->Created)
{
if(app->get_Events())
{
if(app->msg.message == WM_DESTROY)
break;
Application::DoEvents();
}
app->count++;
app->label1->Text = Convert::ToString(app->count);
}
app->Dispose(true);
}

Worked great as a test! Thanks.

PS I don''t know if I need the app->msg.message test.

James Meade
Lt(jg)
VAQ-140 VUSN
James MeadeLt(jg)VAQ-140 VUSN
FYI the test for WM_DESTROY isn''t needed. That is taken care of by Application::DoEvents().

James Meade
Lt(jg)
VAQ-140 VUSN
James MeadeLt(jg)VAQ-140 VUSN

This topic is closed to new replies.

Advertisement