Plik nazwa_aplikacji.ccp

Zawartość pliku nazwa_aplikacji.ccp w przypadku zastosowania VS, VC++ i Ogre SDK Wizard oraz wybrania opcji "Standard Application":

#include "nazwa_aplikacji.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN #include "windows.h" #endif

#ifdef __cplusplus extern "C" { #endif

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) #else int main(int argc, char *argv[]) #endif

// Create application object App3App app;

SET_TERM_HANDLER;

try { app.go(); } catch( Ogre::Exception& e ) { #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); #else std::cerr << "An exception has occured: " << e.getFullDescription().c_str() << std::endl; #endif

return 0;

#ifdef __cplusplus

#endif

Plik nazwa_aplikacji.h

Zawartość pliku nazwa_projektu.h w przypadku zastosowania VS, VC++ i Ogre SDK Wizard oraz wybrania opcji "Standard Application":

#ifndef __nazwa_projektu_h_ #define __nazwa_projektu_h_

#include "ExampleApplication.h"

class nazwa_projektuFrameListener : public ExampleFrameListener

private: SceneManager* mSceneMgr; public: nazwa_projektuFrameListener(SceneManager *sceneMgr, RenderWindow* win, Camera* cam) : ExampleFrameListener(win, cam), mSceneMgr(sceneMgr)

bool frameStarted(const FrameEvent& evt)

bool ret = ExampleFrameListener::frameStarted(evt);

return ret;

class nazwa_projektuApp : public ExampleApplication

public: nazwa_projektuApp()

~nazwa_projektuApp()

protected:

virtual void createCamera(void)

// Create the camera mCamera = mSceneMgr->createCamera("PlayerCam");

// Position it at 500 in Z direction mCamera->setPosition(Vector3(0,0,80)); // Look back along -Z mCamera->lookAt(Vector3(0,0,-300)); mCamera->setNearClipDistance(5);

// Just override the mandatory create scene method virtual void createScene(void)

Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");

SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); headNode->attachObject(ogreHead);

// Set ambient light mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));

// Create a light Light* l = mSceneMgr->createLight("MainLight"); l->setPosition(20,80,50);

// Create new frame listener void createFrameListener(void)

mFrameListener= new nazwa_projektuFrameListener(mSceneMgr, mWindow, mCamera); mRoot->addFrameListener(mFrameListener);

#endif // #ifndef __nazwa_projektu_h_