Skip to main content

History: BasicTutorial1SourceCurrent

Preview of version: 3

TutorialApplication.h
Copy to clipboard
#ifndef __TutorialApplication_h_ #define __TutorialApplication_h_ #include "BaseApplication.h" class TutorialApplication : public BaseApplication { public: TutorialApplication(); virtual ~TutorialApplication(); protected: virtual void createScene(); virtual void createCamera(); virtual void createViewports(); }; #endif // #ifndef __TutorialApplication_h_

{CODE(caption="TutorialApplication.cpp" wrap="1" colors="c++"}

  1. include "TutorialApplication.h"


//---------------------------
TutorialApplication::TutorialApplication(void)
{
}
//---------------------------
TutorialApplication::~TutorialApplication(void)
{
}

//---------------------------
void TutorialApplication::createScene(void)
{

mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));

Ogre::Entity* ogreEntity = mSceneMgr->createEntity("ogrehead.mesh");

Ogre::SceneNode* ogreNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();

ogreNode->attachObject(ogreEntity);

Ogre::Entity* ogreEntity2 = mSceneMgr->createEntity("ogrehead.mesh");

Ogre::SceneNode* ogreNode2 = mSceneMgr->getRootSceneNode()->createChildSceneNode(

Ogre::Vector3(100, 0, 0));

ogreNode2->attachObject(ogreEntity2);

Ogre::Light* light = mSceneMgr->createLight("MainLight");

light->setPosition(20.0, 80.0, 50.0);

}
//---------------------------

  1. if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
  2. define WIN32_LEAN_AND_MEAN
  3. include "windows.h"
  4. endif

  1. ifdef __cplusplus

extern "C" {

  1. endif

  1. if OGRE_PLATFORM == OGRE_PLATFORM_WIN32

INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)

  1. else

int main(int argc, char *argv[])

  1. endif

{
// Create application object
TutorialApplication app;

try {
app.go();
} catch(Ogre::Exception& e) {

  1. if OGRE_PLATFORM == OGRE_PLATFORM_WIN32

MessageBox(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);

  1. else

std::cerr << "An exception has occurred: " <<
e.getFullDescription().c_str() << std::endl;

  1. endif

}

return 0;

}

  1. ifdef __cplusplus

}

  1. endif


//---------------------------
{CODE}

History

Information Version
Wed 01 of Apr, 2015 06:37 GMT-0000 kabbotta 6
Mon 30 of Mar, 2015 22:08 GMT-0000 kabbotta 5
Mon 30 of Mar, 2015 22:07 GMT-0000 kabbotta 4
Mon 30 of Mar, 2015 22:07 GMT-0000 kabbotta 3
Mon 30 of Mar, 2015 22:07 GMT-0000 kabbotta 2
Mon 30 of Mar, 2015 22:06 GMT-0000 kabbotta 1