Alright no one said I was pro at c++ so I got no idea how to put that into my code. But here I will just give FULL code...
Code:
#include <windows.h>
#include <Ogre.h>
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
{
using namespace Ogre;
using namespace std;
//you’ll start inserting your code here
Root *mRoot;
mRoot = new Root("plugins.cfg", "display.cfg", "log.txt");
if(! mRoot->showConfigDialog())
{
//gotta pick a valid renderer and hit the big Okay button man..
return 0;
}
RenderWindow* mWindow;
mWindow = mRoot->initialise(true, "Some Window Title");
SceneManager* mSceneMgr;
mSceneMgr = mRoot->getSceneManager(ST_GENERIC);
//Oh a camera, how nice.
Camera* mCamera;
mCamera = mSceneMgr->createCamera("PlayerCam");
// Position it at 500 in Z direction
mCamera->setPosition(Vector3(0,0,500));
// Look back along -Z
mCamera->lookAt(Vector3(0,0,-300));
mCamera->setNearClipDistance(5);
// Create one viewport, entire window
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,255));
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
class MyFrameListener : public Ogre::FrameListener
{
public:
InputReader* mInputReader;
virtual bool frameStarted(const FrameEvent& evt)
{
return true;
}
virtual bool frameEnded(const FrameEvent& evt)
{
return true;
}
MyFrameListener();
};
MyFrameListener::MyFrameListener()
{
mInputReader = PlatformManager::getSingleton().createInputReader();
mInputReader->initialise(mWindow,true,true);
};
Ogre::FrameListener* listener = new MyFrameListener;
mRoot->addFrameListener(listener);
mRoot->startRendering();
return 0;
}
This is probebly going to the bit extream. And when I take that ; at the constructor out, I get a new error.
That code compiles just fine without the FrameListener stuff in it. (Of course I got the lib file included so it does compile).
I am also using Visual Toolkit 2003 (7.1 or somtin like that) for my compiler, Code::Blocks for my IDE, and Windows Platform SDK and MinGW and other stuff for my include files, libs, etc.