00001 /* 00002 ----------------------------------------------------------------------------- 00003 Filename: application.h 00004 Description: Application handlers, etc. Based off the exampleApplication.h file included with OGRE. (http://www.ogre3d.org/) 00005 ----------------------------------------------------------------------------- 00006 */ 00007 00008 #ifndef __IKAPPLICATION_H__ 00009 #define __IKAPPLICATION_H__ 00010 00011 #include "Common.h" 00012 #include "FrameListener.h" 00013 #include "InputHandler.h" 00014 #include "CameraManager.h" 00015 #include "ObjectManager.h" 00016 #include "PhysicsManager.h" 00017 #include "GUI.h" 00018 00019 class InputHandler; 00020 class CameraManager; 00021 class FrameListener; 00022 class ObjectManager; 00023 class PhysicsManager; 00024 class GUI; 00025 00028 class Application 00029 { 00030 public: 00031 Application(); 00032 ~Application(); 00033 00034 static Application* getSingleton(); 00035 00036 bool run(); 00037 00039 appState getAppState(); 00041 bool setAppState(appState _val); 00042 00044 gameState getGameState(); 00046 bool setGameState(gameState _val); 00047 00049 Ogre::SceneManager* getOverlayManager(); 00050 00052 Ogre::SceneManager* getViewerManager(); 00053 00055 Ogre::Real getTimeSinceLastFrame() const; 00056 00057 InputHandler* getInputHandler(); 00058 CameraManager* getCameraManager(); 00059 ObjectManager* getObjectManager(); 00060 PhysicsManager* getPhysicsManager(); 00061 GUI* getGUI(); 00062 00063 const Ogre::Vector3* getCraftPositionPtr(); 00064 void setCraftPositionPtr(const Ogre::Vector3* _val); 00065 00066 Ogre::ColourValue getColourValue(); 00067 void setColourValue(Ogre::ColourValue& _val); 00068 00069 protected: 00070 00071 bool setup(); 00072 bool configure(); 00073 00074 void chooseSceneManager(); 00075 void createCameraManager(); 00076 void createObjectManager(); 00077 void createFrameListener(); 00078 void createPhysicsManager(); 00079 void createGUI(); 00080 void createScene(); 00081 void destroyScene(); 00082 00083 void createViewports(); 00084 00085 void setupResources(); 00086 00087 void createResourceListener(); 00088 00089 void loadResources(); 00090 00091 void createInputHandler(); 00092 00093 Ogre::Root *m_root; 00094 00095 Ogre::SceneManager* m_sceneManagerViewer; 00096 Ogre::SceneManager* m_sceneManagerOverlay; 00097 FrameListener* m_frameListener; 00098 Ogre::RenderWindow* m_window; 00099 Ogre::String m_resourcePath; 00100 Ogre::String m_configPath; 00101 Ogre::RenderTarget* m_renderTarget; 00102 00103 Ogre::Light* m_light; 00104 00105 InputHandler* m_inputHandler; 00106 CameraManager* m_cameraManager; 00107 ObjectManager* m_objectManager; 00108 PhysicsManager* m_physicsManager; 00109 GUI* m_GUI; 00110 00111 appState m_appState; 00112 gameState m_gameState; 00113 00114 // And this is where the hackiness comes into play. 00115 // I've accepted the fact there'll only be one craft (at present) 00116 // For the fading of the shaders to work correctly, we have to ensure that the player craft position is always known. 00117 // As such, we need to store a pointer to the player's craft. 00118 // This allows every renderable object to see the craft position. 00119 const Ogre::Vector3* m_craftPositionPtr; 00120 00121 Ogre::ColourValue m_colourValue; 00122 00123 static Application* s_self; 00124 }; 00125 00126 #endif // __IKAPPLICATION_H__