Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TankAviator

Real Time Loop In Managed C++

This topic is 5394 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Check out this tutorial, it may help. It discusses the game loop using MDX9. Good luck!

Marcus

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Oops! Forgot the link. Sorry.

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

Marcus

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!