之前看代码都是纠结于widget的创建,以为只要看懂widget创建的问题,就基本上看懂MyGui
但是当看到widget的渲染就没从着手。下面的博客给了很大的提示。
http://blog.csdn.net/liigo/article/details/7089832
void DirectXRenderManager::drawOneFrame()
{
static Timer timer;
//static variable first initialized
//it will keep his value during next change!
static unsigned long last_time = timer.getMilliseconds();
unsigned long now_time = timer.getMilliseconds();
unsigned long time = now_time - last_time;
Gui* gui = Gui::getInstancePtr();
if (gui != nullptr)
gui->_injectFrameEntered((float)((double)(time) / (double)1000));
last_time = now_time;
begin();
LayerManager::getInstance().renderToTarget(this, mUpdate);
end();
mUpdate = false;
}
render 从LayerManager上把render的渲染结构理清。