Changeset 2344 for code/branches/objecthierarchy2/src/orxonox/gamestates
- Timestamp:
- Dec 4, 2008, 8:28:14 PM (16 years ago)
- Location:
- code/branches/objecthierarchy2/src/orxonox/gamestates
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/gamestates/GSGraphics.cc
r2171 r2344 164 164 FunctorMember<GSGraphics>* functor1 = createFunctor(&GSGraphics::printScreen); 165 165 functor1->setObject(this); 166 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "printScreen")); 166 ccPrintScreen_ = createConsoleCommand(functor1, "printScreen"); 167 CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_); 167 168 } 168 169 … … 170 171 { 171 172 using namespace Ogre; 173 174 delete this->ccPrintScreen_; 172 175 173 176 // remove our WindowEventListener first to avoid bad calls after the window has been destroyed -
code/branches/objecthierarchy2/src/orxonox/gamestates/GSGraphics.h
r2103 r2344 112 112 unsigned int detailLevelParticle_; //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high) 113 113 std::string defaultMasterKeybindings_; //!< Filename of default master keybindings. 114 115 // console commands 116 ConsoleCommand* ccPrintScreen_; 114 117 }; 115 118 } -
code/branches/objecthierarchy2/src/orxonox/gamestates/GSLevel.cc
r2173 r2344 47 47 #include "CameraManager.h" 48 48 #include "LevelManager.h" 49 #include "PlayerManager.h" 49 50 #include "Settings.h" 50 51 … … 99 100 // create the global LevelManager 100 101 this->levelManager_ = new LevelManager(); 102 this->playerManager_ = new PlayerManager(); 101 103 102 104 // reset game speed to normal … … 114 116 FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind); 115 117 functor1->setObject(this); 116 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "keybind")); 118 ccKeybind_ = createConsoleCommand(functor1, "keybind"); 119 CommandExecutor::addConsoleCommandShortcut(ccKeybind_); 117 120 FunctorMember<GSLevel>* functor2 = createFunctor(&GSLevel::tkeybind); 118 121 functor2->setObject(this); 119 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "tkeybind")); 122 ccTkeybind_ = createConsoleCommand(functor2, "tkeybind"); 123 CommandExecutor::addConsoleCommandShortcut(ccTkeybind_); 120 124 // set our console command as callback for the key detector 121 125 InputManager::getInstance().setKeyDetectorCallback(std::string("keybind ") + keyDetectorCallbackCode_); … … 130 134 FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::setTimeFactor); 131 135 functor->setObject(this); 132 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "setTimeFactor")).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);; 136 ccSetTimeFactor_ = createConsoleCommand(functor, "setTimeFactor"); 137 CommandExecutor::addConsoleCommandShortcut(ccSetTimeFactor_).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);; 133 138 } 134 139 } … … 136 141 void GSLevel::leave() 137 142 { 143 // destroy console commands 144 delete this->ccKeybind_; 145 delete this->ccSetTimeFactor_; 146 delete this->ccTkeybind_; 147 138 148 // this call will delete every BaseObject! 139 149 // But currently this will call methods of objects that exist no more … … 156 166 if (this->levelManager_) 157 167 delete this->levelManager_; 168 169 if (this->playerManager_) 170 delete this->playerManager_; 158 171 159 172 if (Core::showsGraphics()) -
code/branches/objecthierarchy2/src/orxonox/gamestates/GSLevel.h
r2103 r2344 70 70 CameraManager* cameraManager_; 71 71 LevelManager* levelManager_; 72 PlayerManager* playerManager_; 72 73 73 74 //##### ConfigValues ##### … … 75 76 //! Filename of default keybindings. 76 77 std::string defaultKeybindings_; 78 79 // console commands 80 ConsoleCommand* ccKeybind_; 81 ConsoleCommand* ccTkeybind_; 82 ConsoleCommand* ccSetTimeFactor_; 77 83 78 84 private: -
code/branches/objecthierarchy2/src/orxonox/gamestates/GSRoot.cc
r2171 r2344 40 40 #include "core/TclBind.h" 41 41 #include "core/TclThreadManager.h" 42 #include "core/LuaBind.h" 42 43 #include "tools/Timer.h" 43 44 #include "objects/Tickable.h" … … 87 88 // creates the class hierarchy for all classes with factories 88 89 Factory::createClassHierarchy(); 90 91 // Create the lua interface 92 this->luaBind_ = new LuaBind(); 89 93 90 94 // instantiate Settings class … … 117 121 FunctorMember<GSRoot>* functor1 = createFunctor(&GSRoot::exitGame); 118 122 functor1->setObject(this); 119 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "exit")); 123 ccExit_ = createConsoleCommand(functor1, "exit"); 124 CommandExecutor::addConsoleCommandShortcut(ccExit_); 120 125 121 126 // add console commands 122 127 FunctorMember01<GameStateBase, const std::string&>* functor2 = createFunctor(&GameStateBase::requestState); 123 128 functor2->setObject(this); 124 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "selectGameState")); 129 ccSelectGameState_ = createConsoleCommand(functor2, "selectGameState"); 130 CommandExecutor::addConsoleCommandShortcut(ccSelectGameState_); 125 131 } 126 132 127 133 void GSRoot::leave() 128 134 { 129 // TODO: remove and destroy console commands 135 // destroy console commands 136 delete this->ccExit_; 137 delete this->ccSelectGameState_; 130 138 131 139 delete this->shell_; … … 133 141 delete this->tclBind_; 134 142 135 delete settings_;136 143 delete this->settings_; 144 delete this->luaBind_; 137 145 } 138 146 -
code/branches/objecthierarchy2/src/orxonox/gamestates/GSRoot.h
r1891 r2344 59 59 TclThreadManager* tclThreadManager_; 60 60 Shell* shell_; 61 LuaBind* luaBind_; 62 63 // console commands 64 ConsoleCommand* ccExit_; 65 ConsoleCommand* ccSelectGameState_; 61 66 }; 62 67 }
Note: See TracChangeset
for help on using the changeset viewer.