示例#1
0
/*
ResourceGroupListener Methods
*/
void LogoState::start(RenderWindow* window,unsigned short numGroupsInit = 1,unsigned short numGroupsLoad = 1, Real initProportion = 0.70f)
{
    mWindow = window;
    mNumGroupsInit = numGroupsInit;
    mNumGroupsLoad = numGroupsLoad;
    mInitProportion = initProportion;
    OverlayManager&	omgr = OverlayManager::getSingleton();

    mLoadOverlay = (Overlay*)omgr.getByName("Core/LoadOverlay");
    if (!mLoadOverlay) {
        OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
                    "Cannot find loading overlay", "LoadingBar::start");
    }
    mLoadOverlay->show();

    // Save links to the bar and to the loading text, for updates as we go
    mLoadingBarElement = omgr.getOverlayElement("Core/LoadPanel/Bar/Progress");
    mLoadingCommentElement = omgr.getOverlayElement("Core/LoadPanel/Comment");
    mLoadingDescriptionElement = omgr.getOverlayElement("Core/LoadPanel/Description");

    OverlayElement* barContainer = omgr.getOverlayElement("Core/LoadPanel/Bar");
    mProgressBarMaxSize = barContainer->getWidth();
    mLoadingBarElement->setWidth(0);

    // self is listener
    ResourceGroupManager::getSingleton().addResourceGroupListener(LogoState::getInstance());
}
示例#2
0
  /** Show the loading bar and start listening.
      @param window The window to update 
      @param numGroupsInit The number of groups you're going to be initialising
      @param numGroupsLoad The number of groups you're going to be loading
      @param initProportion The proportion of the progress which will be taken
      up by initialisation (ie script parsing etc). Defaults to 0.7 since
      script parsing can often take the majority of the time.
  */
void LoadingBar::
start(RenderWindow* window,  unsigned short numGroupsInit , 
      unsigned short numGroupsLoad, Real initProportion)
{
    mWindow = window;
    mNumGroupsInit = numGroupsInit;
    mNumGroupsLoad = numGroupsLoad;
    mInitProportion = initProportion;
    // We need to pre-initialise the 'Bootstrap' group so we can use
    // the basic contents in the loading screen
    ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap");
    
    OverlayManager& omgr = OverlayManager::getSingleton();
    mLoadOverlay = (Overlay*)omgr.getByName("Core/LoadOverlay");
    if (!mLoadOverlay)
      {
	OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
		    "Cannot find loading overlay", "ExampleLoadingBar::start");
      }
    mLoadOverlay->show();
    
    // Save links to the bar and to the loading text, for updates as we go
    mLoadingBarElement = omgr.getOverlayElement("Core/LoadPanel/Bar/Progress");
    mLoadingCommentElement = omgr.getOverlayElement("Core/LoadPanel/Comment");
    mLoadingDescriptionElement = omgr.getOverlayElement("Core/LoadPanel/Description");
    
    OverlayElement* barContainer = omgr.getOverlayElement("Core/LoadPanel/Bar");
    mProgressBarMaxSize = barContainer->getWidth();
    mLoadingBarElement->setWidth(0);
    
    // self is listener
    ResourceGroupManager::getSingleton().addResourceGroupListener(this);
  }