C:/Users/Mike/Documents/Visual Studio Projects/GameEngine/include/GameApp.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 Copyright (C) 2006 Michael Harnetty
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 -----------------------------------------------------------------------------
00019 */
00020 
00021 #ifndef GAME_APP_H
00022 #define GAME_APP_H
00023 
00024 #include "GameEnginePrerequisites.h"
00025 
00026 #include "BaseGame.h"
00027 #include "InputManager.h"
00028 #include "ProcessManager.h"
00029 #include "SoundManager.h"
00030 #include "EventManager.h"
00031 #include "Singleton.h"
00032 
00033 namespace GameEngine {
00034         
00035         class InputManager;
00036         class SoundManager;
00037         class BaseGame;
00038 
00042         class ENGINE_DECL GameApp : public Ogre::FrameListener {
00043         public:
00046                 GameApp();
00047                 
00050                 virtual ~GameApp();
00051 
00054                 void start(); // Create the subsystems, load options, create game/views etc, then start the game
00055                 
00058                 void stop(); // Exit the main loop and quit
00059 
00060                 
00061                 // Note to self: Are the following functions all necesary ? Why no getInputManager etc...
00062                 
00066                 Ogre::RenderWindow* const getRenderWindow() const { return mWindow; }
00067                 
00071                 Ogre::Root* const getRenderer() const { return mRenderer; }
00072                 
00073 
00074         protected:
00075                 EventManager* mEventManager;
00076 
00077                 Ogre::Root* mRenderer;
00078                 Ogre::RenderWindow* mWindow; // Main app window
00079 
00080                 InputManager* mInputManager;
00081                 SoundManager* mSoundManager;
00082 
00083                 boost::shared_ptr<BaseGame> mGame;
00084 
00085                 double mTimeSinceLastFrame;
00086                 bool mRender; // Keep rendering or quit the game ?
00087                 bool mInitialised; // Has the application been initialised ?
00088 
00089 
00090 
00095                 virtual boost::shared_ptr<BaseGame> createGameAndViews() = 0; // Note to self: Remove the 'views' part ?
00096                 
00099                 virtual void loadGame() = 0; // Overides should load game options, then call loadGame in BaseGame
00100 
00101                 
00102                 
00107                 void onUpdate(const double& dt);
00108                 
00111                 void mainLoop();
00112 
00113                 
00120                 bool frameStarted(const Ogre::FrameEvent& evt);
00121                 
00128                 bool frameEnded(const Ogre::FrameEvent& evt);
00129 
00130                 
00131                 
00132                 
00135                 void setupResources();
00136                 
00142                 bool loadConfiguration();
00143                 
00144                 
00145                 static const int TICK_LIMIT = 200; // Maximum time EventManager is given to process events (in milliseconds)
00146         };
00147 
00148 }
00149 
00150 #endif

Generated on Thu Apr 19 09:47:02 2007 for GameEngine by  doxygen 1.5.2