I am learning Direct2D from MSD documentation. I created one object which is "animated" (resizing to desired size and back in infinite loop) and want update it. Problem is, I can't find any info about that, therefore I start experimenting.
What I did:
// main loop
while (RUN)
{
if (ok = GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else RUN = false;
mw.Update();
mw.Render();
}
// HandleMessage(...)
case WM_PAINT:
{
m_program.Update();
m_renderer.Render();
return 0;
}
break;
I don't call any SendMessage
, InvalidateRect
inside my application. I am satisfied with this because I can resize or move with window and animated object is still animated during resizing or moving with window.
I have question about if I am doing it right, or are there better ways to achieve animated object still animated while windows is resizing and moving?
What about multithreading way, where second thread will rendering and main thread working with windows messages? Can Direct2D update window from second thread automatically (with desired effect where animated object still will be animated while window resizeing)?