1 | #include "ExampleApplication.h" |
---|
2 | |
---|
3 | SceneNode *lightNode; |
---|
4 | |
---|
5 | class TutorialFrameListener : public ExampleFrameListener |
---|
6 | { |
---|
7 | public: |
---|
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 | } |
---|
20 | private: |
---|
21 | }; |
---|
22 | |
---|
23 | |
---|
24 | class TutorialApplication : public ExampleApplication |
---|
25 | { |
---|
26 | protected: |
---|
27 | public: |
---|
28 | TutorialApplication() |
---|
29 | { |
---|
30 | } |
---|
31 | |
---|
32 | ~TutorialApplication() |
---|
33 | { |
---|
34 | } |
---|
35 | protected: |
---|
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 | |
---|
64 | INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) |
---|
65 | #else |
---|
66 | int 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 | } |
---|