阿来(一)---让你的demo也有loadingBar
做法:
(1)先在你的demo主类头文件里加入
#include "ExampleLoadingBar.h"
(2)再在主类的protected域内加入data member:
ExampleLoadingBar mLoadingBar;
(3)再在主类的protected域内加入member function:
void loadResources(void)
{
mLoadingBar.start(mWindow, 1, 1, 0.75);
// Turn off rendering of everything except overlays
mSceneMgr->clearSpecialCaseRenderQueues();
mSceneMgr->addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
mSceneMgr->setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
// Initialise the rest of the resource groups, parse scripts etc
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
ResourceGroupManager::getSingleton().loadResourceGroup(
ResourceGroupManager::getSingleton().getWorldResourceGroupName(),
false, true);
// Back to full rendering
mSceneMgr->clearSpecialCaseRenderQueues();
mSceneMgr->setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
mLoadingBar.finish();
}
释疑:
在Demo的父类ExampleApplication中 loadResources如下实现:
virtual void loadResources(void)
{
// Initialise, parse scripts etc
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
这个被override后,里面的操作被包含了,如红色的所示。咱不会少做事,所以放心用吧!