Jump to content
  • Advertisement

Archived

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

- HQ -

render function in MFC

This topic is 5269 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

hi. where should i put the render() function in MFC created application? i''ve tried to put it on WM_PAINT and do InvalidateRect() every th of second. but this means i PREdetermined the FramePerSecs which is i not really like. or should there any extra job to do this? currently for testing purposes my render() only consist of m_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(m_R,m_G,m_B), 1.0f, 0 ); m_pd3dDevice->Present( NULL, NULL, NULL, NULL );

Share this post


Link to post
Share on other sites
Advertisement
Are you making a game in MFC or only an editor?

Anyway, put render into the OnDraw of your view(s). Put an InvalidateRect (or better, UpdateAllViews) in your CWinApp-derived classes OnIdle. This is probably as fast as it gets with proper MFC.

Share this post


Link to post
Share on other sites
Methinks: UpdateWindow is faster than Invalidate because UpdateWindow sends WM_PAINT directly rather than simply marking area for repainting when next WM_PAINT arrives...

OnIdle is probly best in your case. I personaly use a timer (I use a flag to keep it from trying to go to fast on slow machines) because I am (trying) to use DirectX to make an drawing program, and I don''t want to use up all the CPU time (I want to share with other apps).

In C++ .NET you can use a while ( 1 == 1 ) loop and do a render than pump and event (System::Windows::Forms::Application::DoEvents();
This is best IMO if you are writting a real time game etc.

Thank you for your time,
Arrummzen

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!