Changeset 2805 for code/branches/gui
- Timestamp:
- Mar 19, 2009, 4:59:30 PM (16 years ago)
- Location:
- code/branches/gui/src
- Files:
-
- 2 added
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/Clock.h
r2171 r2805 45 45 class _CoreExport Clock 46 46 { 47 friend class RootGameState;48 49 47 public: 50 48 Clock(); 51 49 ~Clock(); 50 51 void capture(); 52 52 53 53 unsigned long long getMicroseconds() const { return tickTime_; } … … 63 63 private: 64 64 Clock(const Clock& instance); 65 void capture();66 65 67 66 Ogre::Timer* timer_; -
code/branches/gui/src/core/GameState.h
r1755 r2805 65 65 template <class ParentType> 66 66 friend class GameState; 67 // Hack 68 friend class Game; 67 69 68 70 public: -
code/branches/gui/src/core/RootGameState.cc
r2710 r2805 32 32 #include "util/Exception.h" 33 33 #include "Clock.h" 34 #include "CommandLine.h"35 34 36 35 namespace orxonox 37 36 { 38 SetCommandLineArgument(state, "gui").shortcut("s");39 40 37 RootGameState::RootGameState(const std::string& name) 41 38 : GameState<GameStateBase>(name) … … 119 116 this->stateRequest_ = name; 120 117 } 121 122 /**123 @brief124 Main loop of the orxonox game.125 Starts the game. The little 'while' denotes the main loop.126 Whenever the root state is selected, the game ends.127 @param name128 State to start with (usually main menu or specified by command line)129 @note130 We use the Ogre::Timer to measure time since it uses the most precise131 method an a platform (however the windows timer lacks time when under132 heavy kernel load!).133 */134 void RootGameState::start()135 {136 // Don't catch errors when having a debugger in msvc137 #if !defined(ORXONOX_COMPILER_MSVC) || defined(NDEBUG)138 try139 {140 #endif141 // start global orxonox time142 Clock clock;143 144 this->activate();145 146 // get initial state from command line147 gotoState(CommandLine::getValue("state"));148 149 while (this->activeChild_)150 {151 clock.capture();152 153 this->tick(clock);154 155 if (this->stateRequest_ != "")156 gotoState(stateRequest_);157 }158 159 this->deactivate();160 #if !defined(ORXONOX_COMPILER_MSVC) || defined(NDEBUG)161 }162 // Note: These are all unhandled exceptions that should not have made its way here!163 // almost complete game catch block to display the messages appropriately.164 catch (std::exception& ex)165 {166 COUT(0) << ex.what() << std::endl;167 COUT(0) << "Program aborted." << std::endl;168 abort();169 }170 // anything that doesn't inherit from std::exception171 catch (...)172 {173 COUT(0) << "An unidentifiable exception has occured. Program aborted." << std::endl;174 abort();175 }176 #endif177 }178 118 } -
code/branches/gui/src/core/RootGameState.h
r2662 r2805 37 37 class _CoreExport RootGameState : public GameState<GameStateBase> 38 38 { 39 // Hack! 40 friend class Game; 41 39 42 public: 40 43 RootGameState(const std::string& name); … … 42 45 43 46 void requestState(const std::string& name); 44 void start();45 47 46 48 private: -
code/branches/gui/src/orxonox/CMakeLists.txt
r2801 r2805 20 20 SET_SOURCE_FILES(ORXONOX_SRC_FILES 21 21 CameraManager.cc 22 Game.cc 22 23 GraphicsManager.cc 23 24 LevelManager.cc 24 Main.cc25 25 PawnManager.cc 26 26 PlayerManager.cc -
code/branches/gui/src/orxonox/GraphicsManager.h
r2801 r2805 34 34 */ 35 35 36 #ifndef _Graphics Engine_H__37 #define _Graphics Engine_H__36 #ifndef _GraphicsManager_H__ 37 #define _GraphicsManager_H__ 38 38 39 39 #include "OrxonoxPrereqs.h" … … 131 131 } 132 132 133 #endif /* _Graphics Engine_H__ */133 #endif /* _GraphicsManager_H__ */ -
code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
r2801 r2805 75 75 Core::setShowsGraphics(true); 76 76 77 // initialise graphics engine. Doesn't load the render window yet!77 // initialise graphics manager. Doesn't load the render window yet! 78 78 this->graphicsManager_ = new GraphicsManager(); 79 79 this->graphicsManager_->initialise(); -
code/branches/gui/src/orxonox/gamestates/GSRoot.cc
r2800 r2805 80 80 { 81 81 // add console commands 82 FunctorMember<GSRoot>* functor = createFunctor(&GSRoot::exitGame);83 functor->setObject(this);84 this->ccExit_ = createConsoleCommand(functor, "exit");85 CommandExecutor::addConsoleCommandShortcut(this->ccExit_);86 }87 88 {89 // add console commands90 82 FunctorMember01<GameStateBase, const std::string&>* functor = createFunctor(&GameStateBase::requestState); 91 83 functor->setObject(this); … … 114 106 { 115 107 // destroy console commands 116 delete this->ccExit_;117 108 delete this->ccSelectGameState_; 118 109 -
code/branches/gui/src/orxonox/gamestates/GSRoot.h
r2799 r2805 53 53 ~GSRoot(); 54 54 55 void exitGame()56 { requestState("root"); }57 58 55 // this has to be public because proteced triggers a bug in msvc 59 56 // when taking the function address. … … 93 90 94 91 // console commands 95 ConsoleCommand* ccExit_;96 92 ConsoleCommand* ccSelectGameState_; 97 93 ConsoleCommand* ccSetTimeFactor_;
Note: See TracChangeset
for help on using the changeset viewer.