[SOLVED]Strange Ogre::Overlay error

Problems building or running the engine, queries about how to use features etc.
Post Reply
drwbns
Orc Shaman
Posts: 788
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California
x 24

[SOLVED]Strange Ogre::Overlay error

Post by drwbns »

Hi guys, I'm updating PagedGeometry to support latest casting changes but I get this strange error in the exampleFrameListener::updateStats implementation. I thought I'd ask here since it seems as though the PagedGeo moderators are long gone. The lib builds fine after adding .staticCast<>() changes but I'd like the examples to build as well for completeness.

Code: Select all

error C2027: use of undefined type 'Ogre::OverlayElement'
I even added #include "OgreOverlayManager.h" ( which I'm not sure why it was missing ) to the header file and I still get the error. The OverlayElement definition is available but the error is triggered when using the pointers such as on these lines -

Code: Select all

guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
			guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
			guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
Here's the header file in question - just showing updateStats() for simplicity.

Code: Select all

#ifndef __ExampleFrameListener_H__
#define __ExampleFrameListener_H__



#include "Ogre.h"
#include "OgreStringConverter.h"
#include "OgreException.h"
//#include "HeightFunction.h"
#include "OgreOverlayManager.h"

#include "PagedGeometryConfig.h"

//Use this define to signify OIS will be used as a DLL
//(so that dll import/export macros are in effect)
//#define OIS_DYNAMIC_LIB
#ifdef OIS_USING_DIR
# include "OIS/OIS.h"
#else
# include "OIS.h"
#endif //OIS_USING_DIR

using namespace Ogre;
using namespace Forests;

#ifdef USE_RTSHADER_SYSTEM
#include "OgreRTShaderSystem.h"
#endif

class ExampleFrameListener: public FrameListener, public WindowEventListener
{
protected:
	virtual 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 */ }
	}
Last edited by drwbns on Wed Jul 10, 2013 6:29 pm, edited 1 time in total.
User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
x 94
Contact:

Re: Strange Ogre::Overlay error

Post by tod »

Maybe you should include OgreOverlayElement.h, or some other header.
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: Strange Ogre::Overlay error

Post by dermont »

Looks like your ExampleFrameListener header may be not be up-tp-date, Try adding #include "OgreOverlaySystem.h".

https://bitbucket.org/sinbad/ogre/src/9 ... .h?at=v1-9
drwbns
Orc Shaman
Posts: 788
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California
x 24

Re: Strange Ogre::Overlay error

Post by drwbns »

That was it, thanks Dermont :)
Post Reply