当前位置: 首页>>代码示例>>C++>>正文


C++ OverlayElement::setCaption方法代码示例

本文整理汇总了C++中OverlayElement::setCaption方法的典型用法代码示例。如果您正苦于以下问题:C++ OverlayElement::setCaption方法的具体用法?C++ OverlayElement::setCaption怎么用?C++ OverlayElement::setCaption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OverlayElement的用法示例。


在下文中一共展示了OverlayElement::setCaption方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: frameEnded

	bool frameEnded(const FrameEvent &evt)
	{
		// Fill Here -----------------------------------------------
		static Ogre::DisplayString currFps = L"현재 FPS: ";
		static Ogre::DisplayString avgFps = L"평균 FPS: ";
		static Ogre::DisplayString bestFps = L"최고 FPS: ";
		static Ogre::DisplayString worstFps = L"최저 FPS: ";
		OverlayElement* guiAvg =
			OverlayManager::getSingleton().getOverlayElement("AverageFps");
		OverlayElement* guiCurr =
			OverlayManager::getSingleton().getOverlayElement("CurrFps");
		OverlayElement* guiBest =
			OverlayManager::getSingleton().getOverlayElement("BestFps");
		OverlayElement* guiWorst =
			OverlayManager::getSingleton().getOverlayElement("WorstFps");
		const RenderTarget::FrameStats& stats =
			mRoot->getAutoCreatedWindow()->getStatistics();
		guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
		guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
		guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS));
		guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS));
		// ---------------------------------------------------------

		return mContinue;
	}
开发者ID:jonghyunChae,项目名称:2016OgrePractice,代码行数:25,代码来源:main.cpp

示例2: createTextArea

    //-----------------------------------------------------------------------
    OverlayElement* Profiler::createTextArea(const String& name, Real width, Real height, Real top, Real left, 
                                         uint fontSize, const String& caption, bool show) {


        OverlayElement* textArea = 
			OverlayManager::getSingleton().createOverlayElement("TextArea", name);
        textArea->setMetricsMode(GMM_PIXELS);
        textArea->setWidth(width);
        textArea->setHeight(height);
        textArea->setTop(top);
        textArea->setLeft(left);
        textArea->setParameter("font_name", "BlueHighway");
        textArea->setParameter("char_height", StringConverter::toString(fontSize));
        textArea->setCaption(caption);
        textArea->setParameter("colour_top", "1 1 1");
        textArea->setParameter("colour_bottom", "1 1 1");

        if (show) {
            textArea->show();
        }
        else {
            textArea->hide();
        }

        return textArea;

    }
开发者ID:Anti-Mage,项目名称:ogre,代码行数:28,代码来源:OgreProfiler.cpp

示例3: _setOverlay

  void _setOverlay(void)
  {
    mOverlayMgr = OverlayManager::getSingletonPtr();
    mTextOverlay = mOverlayMgr->create("TextOverlay");

    mPanel = static_cast<Ogre::OverlayContainer*>(mOverlayMgr->createOverlayElement("Panel", "container1"));
    mPanel->setDimensions(1, 1);
    mPanel->setPosition(-0.3f, 0.5f);

    OverlayElement* textBox = mOverlayMgr->createOverlayElement("TextArea", "TextID");
    textBox->setMetricsMode(Ogre::GMM_PIXELS);
    textBox->setPosition(10, 10);
    textBox->setWidth(100);
    textBox->setHeight(20);
    textBox->setParameter("font_name", "Font/NanumBold18");
    textBox->setParameter("char_height", "40");
    textBox->setColour(Ogre::ColourValue::White);
    textBox->setCaption(L"한국산업기술대학교 이대현 선수");
    mPanel->addChild(textBox);

    mTextOverlay->add2D(mPanel);
    mTextOverlay->show();

    mLogoOverlay = OverlayManager::getSingleton().getByName("Overlay/KPU_LOGO");
    mLogoOverlay->show();

mLogoOverlay = OverlayManager::getSingleton().getByName("Overlay/Information");
mLogoOverlay->show(); 
  }
开发者ID:InvitationToDeath,项目名称:GameEngine,代码行数:29,代码来源:OldMain.cpp

示例4: updateStats

// -------------------------------------------------------------------------
void OgreBulletListener::updateStats(void)
{

    // update stats when necessary
    if (mFpsStaticText)
    {
        const RenderTarget::FrameStats& stats = mWindow->getStatistics();

        static String avgFps = "Average FPS: ";
        static String currFps = "Current FPS: ";
        static String tris = "Triangle Count: ";


        mFpsStaticText->setValue
            (
            avgFps + StringConverter::toString(stats.avgFPS) + " / " +
            currFps + StringConverter::toString(stats.lastFPS) + " / " +
            tris + StringConverter::toString(stats.triangleCount)
            );
    }

    try {
        OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
        guiDbg->setCaption(mDebugText);
    }
    catch(...) {}
}
开发者ID:bb123n4,项目名称:OgreBulletDemos,代码行数:28,代码来源:OgreBulletListener.cpp

示例5: updateStats

	void updateStats(void){
		static String currFps = "Current FPS: ";
		static String avgFps = "Average FPS: ";
		static String bestFps = "Best FPS: ";
		static String worstFps = "Worst FPS: ";
		static String tris = "Triangle Count: ";
		static String batches = "Batch Count: ";

		// update stats when necessary
		try {
			OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");
			OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");
			OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");
			OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");

			const RenderTarget::FrameStats& stats = mWindow->getStatistics();
			guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
			guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
			guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
				+" "+StringConverter::toString(stats.bestFrameTime)+" ms");
			guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
				+" "+StringConverter::toString(stats.worstFrameTime)+" ms");

			OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
			guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));

			OverlayElement* guiBatches = OverlayManager::getSingleton().getOverlayElement("Core/NumBatches");
			guiBatches->setCaption(batches + StringConverter::toString(stats.batchCount));

			OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
			guiDbg->setCaption(mDebugText);
		}
		catch(...) { /* ignore */ }
	}
开发者ID:ramyD,项目名称:boksey,代码行数:34,代码来源:main.cpp

示例6: UpdateStats

void OgreFramework::UpdateStats()
{
	static String currFps = "Current FPS: ";
    static String avgFps = "Average FPS: ";
    static String bestFps = "Best FPS: ";
    static String worstFps = "Worst FPS: ";
    static String tris = "Triangle Count: ";
    static String batches = "Batch Count: ";

    OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");
    OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");
    OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");
    OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");

	const RenderTarget::FrameStats& stats = m_renderWnd->getStatistics();
    guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
    guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
    guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
            +" "+StringConverter::toString(stats.bestFrameTime)+" ms");
    guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
            +" "+StringConverter::toString(stats.worstFrameTime)+" ms");

    OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
    guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));

	OverlayElement* guiBatches = OverlayManager::getSingleton().getOverlayElement("Core/NumBatches");
    guiBatches->setCaption(batches + StringConverter::toString(stats.batchCount));

	OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
	guiDbg->setCaption("");
}
开发者ID:abhimir,项目名称:RealTimeTactics,代码行数:31,代码来源:AdvancedOgreFramework.cpp

示例7: updateStats

	void DebugText::updateStats(Ogre::String text)
	{
		static String currFps = "Current FPS: ";
		//static String avgFps = "Average FPS: ";
		//static String bestFps = "Best FPS: ";
		//static String worstFps = "Worst FPS: ";
		//static String tris = "Triangle Count: ";

		// update stats when necessary
		OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");
		OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");
		OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");
		OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");
		
		guiAvg->hide();
		//guiCurr->hide();
		guiBest->hide();
		guiWorst->hide();

		//OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");

		/*guiAvg->setCaption(avgFps + StringConverter::toString(mWindow->getAverageFPS()));*/
		guiCurr->setCaption(currFps + StringConverter::toString(mWindow->getLastFPS()));
		//guiBest->setCaption(bestFps + StringConverter::toString(mWindow->getBestFPS())
		//	+" "+StringConverter::toString(mWindow->getBestFrameTime())+" ms");
		//guiWorst->setCaption(worstFps + StringConverter::toString(mWindow->getWorstFPS())
		//	+" "+StringConverter::toString(mWindow->getWorstFrameTime())+" ms");

		//OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
		//guiTris->setCaption(tris + StringConverter::toString(mWindow->getTriangleCount()));

		OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
		guiDbg->setCaption(text);
		//guiDbg->setPosition(0,0);

		
		//mDebugOverlay->

	}
开发者ID:alexribek,项目名称:apeengine2,代码行数:39,代码来源:DebugText.cpp

示例8: updateStats

void CoreListener::updateStats(void)
{
	static String currFps = "Current FPS: ";
    static String avgFps = "Average FPS: ";
    static String bestFps = "Best FPS: ";
    static String worstFps = "Worst FPS: ";
    static String tris = "Triangle Count: ";
    static String missTime = "Mission Time: ";

    // update stats when necessary
    try {
        OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("USCA/AverageFps");
        OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("USCA/CurrFps");
        OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("USCA/BestFps");
        OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("USCA/WorstFps");
        OverlayElement* guiTime = OverlayManager::getSingleton().getOverlayElement("USCA/MissionTime");

		const RenderTarget::FrameStats& stats = Shmoulette::Core::getSingleton()->getWindow()->getStatistics();

		guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS)+"("+ts(Shmoulette::Level::getSingleton()->getCurrentSegment()->getTimeTrack())+")");
        guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
        guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
            +" "+StringConverter::toString(stats.bestFrameTime)+" ms");
        guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
            +" "+StringConverter::toString(stats.worstFrameTime)+" ms");
		guiTime->setCaption(missTime + ts(Level::getSingleton()->getCurrentSegment()->getTimeTrack())
            +" "+StringConverter::toString(stats.worstFrameTime)+" secs");
        OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("USCA/NumTris");
        guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));

        OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("USCA/DebugText");
        //guiDbg->setCaption(Shmoulette::Core::getSingleton()->getWindow()->getDe->getDebugText());
    }
    catch(...)
    {
        // ignore
    }
}
开发者ID:christianboutin,项目名称:Shmoulette,代码行数:38,代码来源:core.cpp

示例9: displayResults

    //-----------------------------------------------------------------------
    void Profiler::displayResults() {

        if (!mEnabled) {

            return;

        }

        // if its time to update the display
        if (!(mCurrentFrame % mUpdateDisplayFrequency)) {


            ProfileHistoryList::iterator iter;
            ProfileBarList::iterator bIter;

            OverlayElement* g;

            Real newGuiHeight = mGuiHeight;

            int profileCount = 0; 

			Real maxTimeMillisecs = (Real)mMaxTotalFrameTime / 1000.0f;

            // go through each profile and display it
            for (iter = mProfileHistory.begin(), bIter = mProfileBars.begin(); 
				iter != mProfileHistory.end() && bIter != mProfileBars.end(); 
				++iter, ++bIter) 
			{

                // display the profile's name and the number of times it was called in a frame
                g = *bIter;
                g->show();
                g->setCaption(String((*iter).name + " (" + StringConverter::toString((*iter).numCallsThisFrame) + ")"));
                g->setLeft(10 + (*iter).hierarchicalLvl * 15.0f);

                // display the main bar that show the percentage of the frame time that this
                // profile has taken
                bIter++;
                g = *bIter;
                g->show();
                // most of this junk has been set before, but we do this to get around a weird
                // Ogre gui issue (bug?)
                g->setMetricsMode(GMM_PIXELS);
                g->setHeight(mBarHeight);
				if (mDisplayMode == DISPLAY_PERCENTAGE)
					g->setWidth(((*iter).currentTimePercent) * mGuiWidth);
				else
					g->setWidth(((*iter).currentTimeMillisecs / maxTimeMillisecs) * mGuiWidth);
                g->setLeft(mGuiWidth);
                g->setTop(mGuiBorderWidth + profileCount * (mBarHeight + mBarSpacing));

                // display line to indicate the minimum frame time for this profile
                bIter++;
                g = *bIter;
                g->show();
				if (mDisplayMode == DISPLAY_PERCENTAGE)
		            g->setLeft(mBarIndent + (*iter).minTimePercent * mGuiWidth);
				else
					g->setLeft(mBarIndent + ((*iter).minTimeMillisecs / maxTimeMillisecs) * mGuiWidth);

                // display line to indicate the maximum frame time for this profile
                bIter++;
                g = *bIter;
                g->show();
				if (mDisplayMode == DISPLAY_PERCENTAGE)
	                g->setLeft(mBarIndent + (*iter).maxTimePercent * mGuiWidth);
				else
					g->setLeft(mBarIndent + ((*iter).maxTimeMillisecs / maxTimeMillisecs) * mGuiWidth);
                // display line to indicate the average frame time for this profile
                bIter++;
                g = *bIter;
                g->show();
                if ((*iter).totalCalls != 0)
					if (mDisplayMode == DISPLAY_PERCENTAGE)
	                    g->setLeft(mBarIndent + ((*iter).totalTimePercent / (*iter).totalCalls) * mGuiWidth);
					else
						g->setLeft(mBarIndent + (((*iter).totalTimeMillisecs / (*iter).totalCalls) / maxTimeMillisecs) * mGuiWidth);
                else
                    g->setLeft(mBarIndent);

				// display text
				bIter++;
				g = *bIter;
				g->show();
				if (mDisplayMode == DISPLAY_PERCENTAGE)
				{
					g->setLeft(mBarIndent + (*iter).currentTimePercent * mGuiWidth + 2);
					g->setCaption(StringConverter::toString((*iter).currentTimePercent * 100.0f, 3, 3) + "%");
				}
				else
				{
					g->setLeft(mBarIndent + ((*iter).currentTimeMillisecs / maxTimeMillisecs) * mGuiWidth + 2);
					g->setCaption(StringConverter::toString((*iter).currentTimeMillisecs, 3, 3) + "ms");
				}

				// we set the height of the display with respect to the number of profiles displayed
                newGuiHeight += mBarHeight + mBarSpacing;

                profileCount++;
//.........这里部分代码省略.........
开发者ID:Anti-Mage,项目名称:ogre,代码行数:101,代码来源:OgreProfiler.cpp

示例10: update

bool TruckHUD::update(float dt, Beam *truck, bool visible)
{
	OverlayElement *overlayElement = 0;

	// only update every 300 ms
	if (visible)
	{
		updatetime -= dt;
		if (updatetime <= 0.0f)
		{
			// update now, reset timer
			updatetime = 0.3f;
		} else
		{
			// don't update visuals, only count stats
			visible = false;
		}
	}

	if (visible)
	{
		overlayElement = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/Truckname");
		overlayElement->setCaption(truck->getTruckName());
		checkOverflow(overlayElement);

		overlayElement = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/Truckauthor");
		overlayElement->setCaption(_L("(no author information available)"));
		std::vector<authorinfo_t> file_authors = truck->getAuthors();
		if (!file_authors.empty())
		{
			String authors = "";
			for (std::vector<authorinfo_t>::iterator it = file_authors.begin(); it != file_authors.end(); ++it)
			{
				authors += (*it).name + " ";
			}
			overlayElement->setCaption(_L("Authors: ") + authors);
		}
		checkOverflow(overlayElement);

		std::vector<std::string> description = truck->getDescription();
		for (unsigned int i=1; i < 3; i++)
		{
			overlayElement = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/DescriptionLine" + TOSTRING(i+1));
			overlayElement->setCaption("");
			if (i < description.size())
			{
				overlayElement->setCaption(ANSI_TO_UTF(description[i]));
			}
			checkOverflow(overlayElement);
		}

		beam_t *beam = truck->getBeams();
		float average_deformation = 0.0f;
		float beamstress = 0.0f;
		float current_deformation = 0.0f;
		float mass = truck->getTotalMass();
		int beamCount = truck->getBeamCount();
		int beambroken = 0;
		int beamdeformed = 0;

		for (int i=0; i < beamCount; i++, beam++)
		{
			if (beam->broken != 0)
			{
				beambroken++;
			}
			beamstress += beam->stress;
			current_deformation = fabs(beam->L-beam->refL);
			if (fabs(current_deformation) > 0.0001f && beam->type != BEAM_HYDRO && beam->type != BEAM_INVISIBLE_HYDRO)
			{
				beamdeformed++;
			}
			average_deformation += current_deformation;
		}

		overlayElement = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/BeamTotal");
		overlayElement->setCaption(_L("beam count: ") + TOUTFSTRING(beamCount));
		checkOverflow(overlayElement);

		overlayElement = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/BeamBroken");
		overlayElement->setCaption(_L("broken: ") + TOUTFSTRING(beambroken) + U(" (") + TOUTFSTRING(Round((float)beambroken / (float)beamCount, 2) * 100.0f) + U("%)"));
		checkOverflow(overlayElement);

		overlayElement = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/BeamHealth");
		float health = ((float)beambroken / (float)beamCount) * 10.0f + ((float)beamdeformed / (float)beamCount);
		if (health < 1.0f)
		{
			overlayElement->setCaption(_L("health: ") + TOUTFSTRING(Round((1.0f - health) * 100.0f, 2)) + U("%"));
			overlayElement->setColour(ColourValue(0.6f, 0.8f, 0.4f, 1.0f));
		} else if (health >= 1.0f)
		{
			health = ((float)beambroken / (float)beamCount) * 3.0f;
			health = std::min(health, 1.0f);
			overlayElement->setCaption(_L("destruction: ") + TOUTFSTRING(Round(health * 100.0f, 2)) + U("%"));
			overlayElement->setColour(ColourValue(0.8f, 0.4f, 0.4f, 1.0f));
		}
		checkOverflow(overlayElement);


		overlayElement = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/BeamDeformed");
//.........这里部分代码省略.........
开发者ID:Bob-Z,项目名称:rigs-of-rods,代码行数:101,代码来源:TruckHUD.cpp

示例11: displayResults

    //-----------------------------------------------------------------------
    void OverlayProfileSessionListener::displayResults(ProfileInstance* instance, ProfileBarList::const_iterator& bIter, Real& maxTimeMillisecs, Real& newGuiHeight, int& profileCount)
    {
        OverlayElement* g;

        // display the profile's name and the number of times it was called in a frame
        g = *bIter;
        ++bIter;
        g->show();
        g->setCaption(String(instance->name + " (" + StringConverter::toString(instance->history.numCallsThisFrame) + ")"));
        g->setLeft(10 + instance->hierarchicalLvl * 15.0f);


        // display the main bar that show the percentage of the frame time that this
        // profile has taken
        g = *bIter;
        ++bIter;
        g->show();
        // most of this junk has been set before, but we do this to get around a weird
        // Ogre gui issue (bug?)
        g->setMetricsMode(GMM_PIXELS);
        g->setHeight(mBarHeight);

        if (mDisplayMode == DISPLAY_PERCENTAGE)
            g->setWidth( (instance->history.currentTimePercent) * mGuiWidth);
        else
            g->setWidth( (instance->history.currentTimeMillisecs / maxTimeMillisecs) * mGuiWidth);

        g->setLeft(mGuiWidth);
        g->setTop(mGuiBorderWidth + profileCount * (mBarHeight + mBarSpacing));



        // display line to indicate the minimum frame time for this profile
        g = *bIter;
        ++bIter;
        g->show();
        if(mDisplayMode == DISPLAY_PERCENTAGE)
            g->setLeft(mBarIndent + instance->history.minTimePercent * mGuiWidth);
        else
            g->setLeft(mBarIndent + (instance->history.minTimeMillisecs / maxTimeMillisecs) * mGuiWidth);

        // display line to indicate the maximum frame time for this profile
        g = *bIter;
        ++bIter;
        g->show();
        if(mDisplayMode == DISPLAY_PERCENTAGE)
            g->setLeft(mBarIndent + instance->history.maxTimePercent * mGuiWidth);
        else
            g->setLeft(mBarIndent + (instance->history.maxTimeMillisecs / maxTimeMillisecs) * mGuiWidth);

        // display line to indicate the average frame time for this profile
        g = *bIter;
        ++bIter;
        g->show();
        if(instance->history.totalCalls != 0)
        {
            if (mDisplayMode == DISPLAY_PERCENTAGE)
                g->setLeft(mBarIndent + (instance->history.totalTimePercent / instance->history.totalCalls) * mGuiWidth);
            else
                g->setLeft(mBarIndent + ((instance->history.totalTimeMillisecs / instance->history.totalCalls) / maxTimeMillisecs) * mGuiWidth);
        }
        else
            g->setLeft(mBarIndent);

        // display text
        g = *bIter;
        ++bIter;
        g->show();
        if (mDisplayMode == DISPLAY_PERCENTAGE)
        {
            g->setLeft(mBarIndent + instance->history.currentTimePercent * mGuiWidth + 2);
            g->setCaption(StringConverter::toString(instance->history.currentTimePercent * 100.0f, 3, 3) + "%");
        }
        else
        {
            g->setLeft(mBarIndent + (instance->history.currentTimeMillisecs / maxTimeMillisecs) * mGuiWidth + 2);
            g->setCaption(StringConverter::toString(instance->history.currentTimeMillisecs, 3, 3) + "ms");
        }

        // we set the height of the display with respect to the number of profiles displayed
        newGuiHeight += mBarHeight + mBarSpacing;

        ++profileCount;

        // display children
        ProfileInstance::ProfileChildren::const_iterator it = instance->children.begin(), endit = instance->children.end();
        for(;it != endit; ++it)
        {
            ProfileInstance* child = it->second;
            displayResults(child, bIter, maxTimeMillisecs, newGuiHeight, profileCount);
        }
    }
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:93,代码来源:OgreOverlayProfileSessionListener.cpp

示例12: update

	void GamePlayState::update(unsigned long timePassed) {
        mMoveScale = mMoveSpeed * timePassed / 1000000.0f;
        mRotScale = mRotateSpeed * timePassed / 1000000.0f;

		// Quick hack. Let the camera move:
		if (mForward)
			mTranslateVector.z = -mMoveScale;

		if (mBackward)
			mTranslateVector.z =  mMoveScale;

		if (mLeft)
			mTranslateVector.x = -mMoveScale;

		if (mRight)
			mTranslateVector.x =  mMoveScale;

		mCamera->yaw(mRotX * mRotScale);
		mCamera->pitch(mRotY * mRotScale);
		mCamera->moveRelative(mTranslateVector);

		mTranslateVector = Vector3::ZERO;
		mRotX = 0;
		mRotY = 0;

		if (mSceneDisplay) {
			mSceneDetailIndex = (mSceneDetailIndex+1)%2 ; // I Do not need points for now
			switch(mSceneDetailIndex) {
				case 0 : mCamera->setPolygonMode(PM_SOLID) ; break ;
				case 1 : mCamera->setPolygonMode(PM_WIREFRAME) ; break ;
				//case 2 : mCamera->setPolygonMode(PM_POINTS) ; break ;
			}
			mSceneDisplay = false;
		}

		if (mPortalDisplay) {
			// reuse
			mSceneMgr->getOption("ShowPortals", &mPortalDisplay);
			mPortalDisplay = !mPortalDisplay;
			mSceneMgr->setOption("ShowPortals", &mPortalDisplay);

			mPortalDisplay = false;
		}

		if (mScreenShot) {
			char tmp[20];
			sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots);
			RenderWindow* w = Ogre::Root::getSingleton().getAutoCreatedWindow();

			w->writeContentsToFile(tmp);

			mScreenShot = false;
		}

		// mConsole->update(timePassed);

		if (mDebug) {
			// update stats when necessary
			try {

				// Temporary: Debug Overlay
				static String currFps = "Current FPS: ";
				static String avgFps = "Average FPS: ";
				static String bestFps = "Best FPS: ";
				static String worstFps = "Worst FPS: ";
				static String tris = "Triangle Count: ";
				static String batches = "Batch Count: ";

				OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Opde/AverageFps");
				OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Opde/CurrFps");
				OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Opde/BestFps");
				OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Opde/WorstFps");

				const RenderTarget::FrameStats& stats = mWindow->getStatistics();

				guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
				guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
				guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
				+" "+StringConverter::toString(stats.bestFrameTime)+" ms");
				guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
				+" "+StringConverter::toString(stats.worstFrameTime)+" ms");

				OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Opde/NumTris");
				guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));

				OverlayElement* guiBatches = OverlayManager::getSingleton().getOverlayElement("Opde/NumBatches");
				guiBatches->setCaption(batches + StringConverter::toString(stats.batchCount));

				// OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
			}
			catch(...)
			{
				// ignore
			}

			// update the portal statistics
			try {
				// Volca: I've disabled the timing reports, they need a patch of SM to work
				OverlayElement* guibc = OverlayManager::getSingleton().getOverlayElement("Opde/BackCulls");
				OverlayElement* guiep = OverlayManager::getSingleton().getOverlayElement("Opde/EvalPorts");
//.........这里部分代码省略.........
开发者ID:Painpillow,项目名称:openDarkEngine,代码行数:101,代码来源:GamePlayState.cpp

示例13: update

bool TruckHUD::update(float dt, Beam *truck, SceneManager *mSceneMgr, Camera* mCamera, RenderWindow* mWindow, bool visible)
{
	OverlayElement *descl = 0;

	//only update every 300 ms
	if(visible)
	{
		updatetime -= dt;
		if(updatetime <= 0)
		{
			// update now, reset timer
			updatetime = 0.3;
		} else
			// dont update visuals, only count stats
			visible = false;
	}


	if(visible)
	{
		OverlayElement* oTruckname = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/Truckname");
		oTruckname->setCaption(truck->getTruckName());
		checkOverflow(oTruckname);

		OverlayElement* oTruckauthor = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/Truckauthor");
		std::vector<authorinfo_t> file_authors = truck->getAuthors();
		if(file_authors.size() > 0)
		{
			String author_string = String("");
			for(unsigned int i=0;i<file_authors.size();i++)
				author_string += file_authors[i].name + String(" ");
			oTruckauthor->setCaption(_L("Authors: ") + author_string);
		} else
		{
			oTruckauthor->setCaption(_L("(no author information available)"));
		}
		checkOverflow(oTruckauthor);
		std::vector<std::string> desc = truck->getDescription();

		descl = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/DescriptionLine1");
		if(desc.size() > 0)
			descl->setCaption(ANSI_TO_UTF(desc[0]));
		else
			descl->setCaption("");
		checkOverflow(descl);

		descl = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/DescriptionLine2");
		if(desc.size() > 1)
			descl->setCaption(ANSI_TO_UTF(desc[1]));
		else
			descl->setCaption("");
		checkOverflow(descl);

		descl = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/DescriptionLine3");
		if(desc.size() > 2)
			descl->setCaption(ANSI_TO_UTF(desc[2]));
		else
			descl->setCaption("");
		checkOverflow(descl);

		int beamCount = truck->getBeamCount();
		beam_t *beam = truck->getBeams();
		int beambroken = 0;
		float beamstress = 0;
		int beamdeformed = 0;
		float average_deformation = 0;
		float current_deformation = 0;
		float mass = truck->getTotalMass();

		for(int i=0; i<beamCount; i++, beam++)
		{
			if(beam->broken != 0)
				beambroken++;
			beamstress += beam->stress;
			current_deformation = fabs(beam->L-beam->refL);
			if (fabs(current_deformation) > 0.0001f && beam->type != BEAM_HYDRO && beam->type != BEAM_INVISIBLE_HYDRO) beamdeformed++;
			average_deformation += current_deformation;
		}

		wchar_t beamcountstr[256];
		swprintf(beamcountstr, 256, L"%d", beamCount);
		descl = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/BeamTotal");
		descl->setCaption(_L("beam count: ") + UTFString(beamcountstr));
		checkOverflow(descl);

		wchar_t beambrokenstr[256];
		swprintf(beambrokenstr, 256, L"%0.2f", ((float)beambroken/(float)beamCount)*100);
		descl = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/BeamBroken");
		descl->setCaption(_L("broken: ") + TOUTFSTRING(beambroken) + U(" (") + UTFString(beambrokenstr) + U("%)"));
		checkOverflow(descl);

		wchar_t beamhealthstr[256];
		float health = ((float)beambroken/(float)beamCount) * 10 + ((float)beamdeformed/(float)beamCount);
		if(health<1)
		{
			swprintf(beamhealthstr, 256, L"%0.2f", (1-health)*100);
			descl = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/BeamHealth");
			descl->setCaption(_L("health: ") + UTFString(beamhealthstr) + U("%"));
			checkOverflow(descl);
			descl = OverlayManager::getSingleton().getOverlayElement("tracks/TruckInfoBox/BeamHealth");
//.........这里部分代码省略.........
开发者ID:Winceros,项目名称:main,代码行数:101,代码来源:TruckHUD.cpp


注:本文中的OverlayElement::setCaption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。