Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutorial/Tutorial/src/main.cpp @ 35

Last change on this file since 35 was 35, checked in by nicolasc, 17 years ago

reset all files to original state
included all win32/macosx ifdefs…

File size: 1.9 KB
Line 
1#include "ExampleApplication.h"
2
3SceneNode *lightNode;
4
5class TutorialFrameListener : public ExampleFrameListener
6{
7public:
8    TutorialFrameListener(RenderWindow* win, Camera* cam, SceneManager *sceneMgr)
9        : ExampleFrameListener(win, cam, false, false)
10    {
11    }
12
13    bool frameStarted(const FrameEvent &evt)
14    {
15        // add tutorial code here:
16        // ...
17
18        return ExampleFrameListener::frameStarted(evt);
19    }
20private:
21};
22
23
24class TutorialApplication : public ExampleApplication
25{
26protected:
27public:
28    TutorialApplication()
29    {
30    }
31
32    ~TutorialApplication()
33    {
34    }
35protected:
36    void createCamera(void)
37    {
38        // create camera
39        mCamera = mSceneMgr->createCamera("PlayerCam");
40        mCamera->setNearClipDistance(5);
41        mCamera->setPosition(Vector3(0,10,500));
42        mCamera->lookAt(Vector3(0,0,0));
43    }
44
45    void createScene(void)
46    {
47        // add tutorial code here:
48        // ...
49
50    }
51
52    void createFrameListener(void)
53    {
54        // create frame listener
55        mFrameListener = new TutorialFrameListener(mWindow, mCamera, mSceneMgr);
56        mRoot->addFrameListener(mFrameListener);
57    }
58};
59
60#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
61#define WIN32_LEAN_AND_MEAN
62#include "windows.h"
63
64INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
65#else
66int main(int argc, char **argv)
67#endif
68{
69    // Create application object
70    TutorialApplication app;
71
72    try {
73        app.go();
74    } catch( Exception& e ) {
75#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
76        MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
77#else
78        fprintf(stderr, "An exception has occurred: %s\n",
79                e.getFullDescription().c_str());
80#endif
81    }
82
83    return 0;
84}
Note: See TracBrowser for help on using the repository browser.