Real Time Loop In Managed C++
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
Check out this tutorial, it may help. It discusses the game loop using MDX9. Good luck!
Marcus
Marcus
Oops! Forgot the link. Sorry.
http://staff.develop.com/candera/weblog2/articleview.aspx/DirectX/Direct3D/01%20GameLoop.xml
Marcus
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement