C:/Users/Mike/Documents/Visual Studio Projects/GameEngine/include/BaseGame.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 GAMESESSION_H
00022 #define GAMESESSION_H
00023 
00024 #include "GameEnginePrerequisites.h"
00025 
00026 #include "ProcessManager.h"
00027 #include "IEventListener.h"
00028 #include "IGameView.h"
00029 #include "HumanView.h"
00030 #include "Singleton.h"
00031 #include "Vector3.h"
00032 #include "GameApp.h"
00033 
00034 
00035 namespace GameEngine {
00036 
00037         class GameState;
00038         class GameApp;
00039         class HumanView;
00040 
00041         
00042         typedef std::vector<GameState*> GameStateStack;
00043 
00048         class ENGINE_DECL BaseGame : public Ogre::FrameListener, public IEventListener, public boost::enable_shared_from_this<BaseGame> {
00049 
00050         public:
00062                 BaseGame(Real width, Real height, Real depth, GameApp& application); // Default gravity is 0,-9.81,0
00063                 
00066                 virtual ~BaseGame();
00067 
00068                 
00072                 bool init(); // Not to self: Pointless function ?
00073 
00076                 virtual void loadGame() { }
00077 
00078                 
00086                 virtual bool handleEvent(const Event& event);
00087                 
00088                 
00092                 virtual void onUpdate(const double dt);
00093 
00094                 
00098                 virtual void changeState(GameState* state);
00099                 
00103                 virtual void changeState(std::string stateName);
00104                 
00108                 virtual void pushState(GameState* state);
00109                 
00112                 virtual void popState();
00113                 
00117                 virtual GameState* getState(std::string stateName) = 0;
00118 
00119                 
00120                 
00124                 const Real& getWidth() const { return mWidth; }
00125                 
00129                 const Real& getHeight() const { return mHeight; }
00130                 
00134                 const Real& getDepth() const { return mDepth; }
00135 
00136                 
00137                 
00141                 boost::shared_ptr<HumanView> getHumanView() const { return mHumanView; }
00142 
00143                 
00144                 
00149                 Vector3& wrapCoords(Vector3& coords) const;
00150 
00151         protected:
00152                 GameApp& mApplication;
00153 
00154                 boost::shared_ptr<HumanView> mHumanView;
00155                 GameStateStack mGameStatesStack; // Stack to control ordering of states
00156 
00157 
00158                 Real mWidth;
00159                 Real mHeight;
00160                 Real mDepth;
00161 
00162         };
00163 }
00164 
00165 #endif

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