-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaseApplication.h
141 lines (119 loc) · 4.49 KB
/
BaseApplication.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
-----------------------------------------------------------------------------
Filename: BaseApplication.h
-----------------------------------------------------------------------------
This source file is part of the
___ __ __ _ _ _
/___\__ _ _ __ ___ / / /\ \ (_) | _(_)
// // _` | '__/ _ \ \ \/ \/ / | |/ / |
/ \_// (_| | | | __/ \ /\ /| | <| |
\___/ \__, |_| \___| \/ \/ |_|_|\_\_|
|___/
Tutorial Framework (for Ogre 1.10)
http://www.ogre3d.org/wiki/
-----------------------------------------------------------------------------
*/
#ifndef __BaseApplication_h_
#define __BaseApplication_h_
#include <OgreCamera.h>
#include <OgreEntity.h>
#include <OgreLogManager.h>
#include <OgreRoot.h>
#include <OgreViewport.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include <OgreConfigFile.h>
#include <OgreMaterialManager.h>
#include <OgreTextureManager.h>
#include <OgreWindowEventUtilities.h>
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
# include <OIS/OISEvents.h>
# include <OIS/OISInputManager.h>
# include <OIS/OISKeyboard.h>
# include <OIS/OISMouse.h>
# include <OGRE/SdkTrays.h>
# include <OGRE/SdkCameraMan.h>
#else
# include <OISEvents.h>
# include <OISInputManager.h>
# include <OISKeyboard.h>
# include <OISMouse.h>
# include <SdkTrays.h>
# include <SdkCameraMan.h>
#endif
#ifdef OGRE_STATIC_LIB
# define OGRE_STATIC_GL
# if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
# define OGRE_STATIC_Direct3D9
// D3D10 will only work on vista, so be careful about statically linking
# if OGRE_USE_D3D10
# define OGRE_STATIC_Direct3D10
# endif
# endif
# define OGRE_STATIC_BSPSceneManager
# define OGRE_STATIC_ParticleFX
# define OGRE_STATIC_CgProgramManager
# ifdef OGRE_USE_PCZ
# define OGRE_STATIC_PCZSceneManager
# define OGRE_STATIC_OctreeZone
# else
# define OGRE_STATIC_OctreeSceneManager
# endif
# include "OgreStaticPluginLoader.h"
#endif
//---------------------------------------------------------------------------
class BaseApplication : public Ogre::FrameListener, public Ogre::WindowEventListener, public OIS::KeyListener, public OIS::MouseListener, OgreBites::SdkTrayListener
{
public:
BaseApplication(void);
virtual ~BaseApplication(void);
virtual void go(void);
protected:
virtual bool setup();
virtual bool configure(void);
virtual void chooseSceneManager(void);
virtual void createCamera(void);
virtual void createFrameListener(void);
virtual void createScene(void) = 0; // Override me!
virtual void destroyScene(void);
virtual void createViewports(void);
virtual void setupResources(void);
virtual void createResourceListener(void);
virtual void loadResources(void);
virtual bool frameRenderingQueued(const Ogre::FrameEvent& evt);
virtual bool keyPressed(const OIS::KeyEvent &arg);
virtual bool keyReleased(const OIS::KeyEvent &arg);
virtual bool mouseMoved(const OIS::MouseEvent &arg);
virtual bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
virtual bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
// Adjust mouse clipping area
virtual void windowResized(Ogre::RenderWindow* rw);
// Unattach OIS before window shutdown (very important under Linux)
virtual void windowClosed(Ogre::RenderWindow* rw);
Ogre::Root* mRoot;
Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;
Ogre::String mResourcesCfg;
Ogre::String mPluginsCfg;
Ogre::OverlaySystem* mOverlaySystem;
// OgreBites
OgreBites::InputContext mInputContext;
OgreBites::SdkTrayManager* mTrayMgr;
OgreBites::SdkCameraMan* mCameraMan; // Basic camera controller
OgreBites::ParamsPanel* mDetailsPanel; // Sample details panel
bool mCursorWasVisible; // Was cursor visible before dialog appeared?
bool mShutDown;
//OIS Input devices
OIS::InputManager* mInputManager;
OIS::Mouse* mMouse;
OIS::Keyboard* mKeyboard;
// Added for Mac compatibility
Ogre::String m_ResourcePath;
#ifdef OGRE_STATIC_LIB
Ogre::StaticPluginLoader m_StaticPluginLoader;
#endif
};
//---------------------------------------------------------------------------
#endif // #ifndef __BaseApplication_h_
//---------------------------------------------------------------------------