C:/Users/Mike/Documents/Visual Studio Projects/GameEngine/include/GameState.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_STATE_H
00022 #define GAME_STATE_H
00023 
00024 
00025 #include "GameEnginePrerequisites.h"
00026 #include "IEventListener.h"
00027 #include "Vector3.h"
00028 #include "Quaternion.h"
00029 #include "PhysicsManager.h"
00030 
00031 namespace GameEngine {
00032 
00033         class GameObject;
00034         class PhysicsManager;
00035         class GameState;
00036 
00039         class ENGINE_DECL GameState : public IEventListener {
00040 
00041         public:
00042 
00049                 GameState(GameApp* const application, BaseGame* const game, const Vector3& gravity);
00050                 
00053                 virtual ~GameState();
00054 
00057                 virtual void init() {} // Note to self : Is this actually required now that GameStates aren't singletons ? Seems like it's pointless
00058 
00059                 
00060                 
00063                 virtual void start() { mActive = true; }
00064                 
00067                 virtual void stop() { mActive = false; }
00068                 
00069                 
00070                 
00073                 virtual void pause() { mActive = false; }
00074                 
00077                 virtual void resume() { mActive = true; } 
00078 
00079                 
00080                 
00085                 void changeState(GameState* state) const;
00086 
00087                 
00088 
00094                 virtual bool handleEvent(const Event& event) { assert(mActive); return false; /* Dont consume event */ }
00095                 
00100                 virtual void onUpdate(const double& dt) { mProcessManager->updateProcesses(dt); }
00101 
00102                 
00103                 // Note to self: No point in returning these boolean values from input handlers if we don't use them
00104                 // see BaseGame class
00105                 
00111                 virtual bool keyPressed (const OIS::KeyEvent& arg) {    return false;   }
00112                 
00118                 virtual bool keyReleased (const OIS::KeyEvent& arg) {   return false;   }
00119 
00125                 virtual bool mouseMoved (const OIS::MouseEvent &arg) {  return false;   }
00126                 
00133                 virtual bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id) { return false;   }
00134                 
00141                 virtual bool mouseReleased (const OIS::MouseEvent &arg, OIS::MouseButtonID id) {        return false;   }
00142 
00143                 
00144                 
00145                 
00150                 virtual void addObject( boost::shared_ptr<GameObject> ptr );
00151                 
00156                 virtual void removeObject( boost::shared_ptr<GameObject> ptr );
00157 
00158                 
00159                 
00164                 BaseGame* const getGame() const { return mGame; }
00165                 
00170                 PhysicsManager* getPhysicsManager() { return  mPhysicsMan; }
00171 
00172         protected: 
00173                 GameApp* mApplication;
00174                 BaseGame* mGame;
00175 
00176                 ProcessManager* mProcessManager;
00177                 Ogre::SceneManager* mSceneManager;
00178                 Ogre::SceneNode* mRootSceneNode;
00179                 PhysicsManager* mPhysicsMan;
00180 
00181                 bool mInitialised;
00182                 bool mActive;
00183 
00184                 std::string mName;
00185         };
00186 
00187 }
00188 
00189 #endif

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