|
From: <sik...@us...> - 2006-05-21 04:52:18
|
Revision: 51 Author: sik0fewl Date: 2006-05-20 21:52:12 -0700 (Sat, 20 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=51&view=rev Log Message: ----------- Some documentation Modified Paths: -------------- trunk/perceptioncrash/src/GameManager.hpp Modified: trunk/perceptioncrash/src/GameManager.hpp =================================================================== --- trunk/perceptioncrash/src/GameManager.hpp 2006-05-20 21:13:19 UTC (rev 50) +++ trunk/perceptioncrash/src/GameManager.hpp 2006-05-21 04:52:12 UTC (rev 51) @@ -10,47 +10,127 @@ class GameState; +/** Main game class. + */ class GameManager : public Ogre::FrameListener, public Ogre::KeyListener, public Ogre::MouseMotionListener, public Ogre::Singleton<GameManager> { public: + /** Default constructor + */ GameManager(); + + /** Default destructor + */ ~GameManager(); + /** Start game from specified game state + * + * @param state game state to start from + */ void start(GameState* state); + + /** Change state to the specified state. + * This exits the current state, pops it, pushes the new state and enters + * it + * + * @param state game state to change to + */ void changeState(GameState* state); + + /** Push state onto state stack + * This pauses the current state, pushes the new state onto the game state + * stack and enters it + * + * @param state game state to push onto stack + */ void pushState(GameState* state); + + /** Pop state off of state stack + * This exits the current state, pops it off the state stack and resumes + * the previous state (if any) + */ void popState(); + + /** Override standard Ogre::Singleton retrieval. + * @remarks + * + * Why do we do this? Well, it's because the Singleton implementation is in + * a .h file, which means it gets compiled into anybody who includes it. + * This is needed for the Singleton template to work, but we actually only + * want it compiled into the implementation of the class based on the + * Singleton, not all of them. If we don't change this, we get link errors + * when trying to use the Singleton-based class from an outside dll. + * + * This method just delegates to the template version anyway, but the + * implementation stays in this single compilation unit, preventing link + * errors. + */ + static GameManager& getSingleton(void); + /** Override standard Ogre::Singleton retrieval. + * @remarks + * + * Why do we do this? Well, it's because the Singleton implementation is in + * a .h file, which means it gets compiled into anybody who includes it. + * This is needed for the Singleton template to work, but we actually only + * want it compiled into the implementation of the class based on the + * Singleton, not all of them. If we don't change this, we get link errors + * when trying to use the Singleton-based class from an outside dll. + * + * This method just delegates to the template version anyway, but the + * implementation stays in this single compilation unit, preventing link + * errors. + */ static GameManager* getSingletonPtr(void); protected: + /** OGRE Root */ Ogre::Root* mRoot; + /** Render window */ Ogre::RenderWindow* mRenderWindow; + /* Input manager */ InputManager* mInputManager; + /** Setup resource locations */ void setupResources(void); + /** Configure OGRE */ bool configure(void); + /** Ogre::KeyListener keyClicked event */ void keyClicked(Ogre::KeyEvent* e); + /** Ogre::KeyListener keyPressed event */ void keyPressed(Ogre::KeyEvent* e); + /** Ogre::KeyListener keyReleased event */ void keyReleased(Ogre::KeyEvent* e); + /** Ogre::MouseMotionListener mouseMoved event */ void mouseMoved(Ogre::MouseEvent* e); + /** Ogre::MouseMotionListener mouseDragged event */ void mouseDragged(Ogre::MouseEvent* e); + /** Ogre::MouseMotionListener mouseDragMoved event */ void mouseDragMoved(Ogre::MouseEvent* e); + /** Ogre::FrameListener frameStarted event */ bool frameStarted(const Ogre::FrameEvent& evt); + /** Ogre::FrameListener frameEnded event */ bool frameEnded(const Ogre::FrameEvent& evt); private: + /** Show/hide dubug panel overlay */ void toggleDebugPanelOverlay(); + /** Update debug panel overlay with current FPS, etc */ void updateDebugPanelOverlay(); + /** Debug panel overlay. + * Shows current FPS another stats on-screen + */ Ogre::Overlay* mDebugPanelOverlay; + + /** State stack */ std::vector<GameState*> mStates; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |