- Timestamp:
- Apr 8, 2009, 12:36:08 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/gamestates/GSLevel.cc
r2788 r2907 24 24 * Co-authors: 25 25 * Fabian 'x3n' Landau 26 * Benjamin Knecht 26 27 * 27 28 */ … … 39 40 #include "core/CommandLine.h" 40 41 #include "core/ConfigValueIncludes.h" 42 #include "core/Core.h" 41 43 #include "core/CoreIncludes.h" 42 #include "core/Core.h" 44 #include "core/Game.h" 45 #include "core/GameMode.h" 43 46 #include "objects/Tickable.h" 44 47 #include "objects/Radar.h" 45 48 #include "CameraManager.h" 49 #include "GraphicsManager.h" 46 50 #include "LevelManager.h" 47 51 #include "PlayerManager.h" 48 #include "objects/quest/QuestManager.h" 49 #include "overlays/notifications/NotificationManager.h" 52 #include "orxonox/objects/quest/QuestManager.h" 53 #include "orxonox/overlays/notifications/NotificationManager.h" 54 #include "gui/GUIManager.h" 50 55 51 56 namespace orxonox 52 57 { 53 SetCommandLineArgument(level, "presentation.oxw").shortcut("l"); 54 55 GSLevel::GSLevel() 56 // : GameState<GSGraphics>(name) 57 : keyBinder_(0) 58 , inputState_(0) 58 AddGameState(GSLevel, "level"); 59 60 SetCommandLineArgument(level, "presentation_dm.oxw").shortcut("l"); 61 SetConsoleCommand(GSLevel, showIngameGUI, true); 62 63 GSLevel::GSLevel(const std::string& name) 64 : GameState(name) 65 , keyBinder_(0) 66 , gameInputState_(0) 67 , guiMouseOnlyInputState_(0) 68 , guiKeysOnlyInputState_(0) 59 69 , radar_(0) 60 70 , startFile_(0) … … 66 76 this->ccKeybind_ = 0; 67 77 this->ccTkeybind_ = 0; 68 78 } 79 80 GSLevel::~GSLevel() 81 { 82 } 83 84 void GSLevel::setConfigValues() 85 { 86 SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName="); 87 } 88 89 void GSLevel::activate() 90 { 69 91 setConfigValues(); 70 } 71 72 GSLevel::~GSLevel() 73 { 74 } 75 76 void GSLevel::setConfigValues() 77 { 78 SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName="); 79 } 80 81 void GSLevel::enter(Ogre::Viewport* viewport) 82 { 83 if (Core::showsGraphics()) 84 { 85 inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game", 20); 92 93 if (GameMode::showsGraphics()) 94 { 95 gameInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game"); 86 96 keyBinder_ = new KeyBinder(); 87 97 keyBinder_->loadBindings("keybindings.ini"); 88 inputState_->setHandler(keyBinder_); 98 gameInputState_->setHandler(keyBinder_); 99 100 guiMouseOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiMouseOnly"); 101 guiMouseOnlyInputState_->setMouseHandler(GUIManager::getInstancePtr()); 102 103 guiKeysOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiKeysOnly"); 104 guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr()); 89 105 90 106 // create the global CameraManager 91 assert(viewport); 92 this->cameraManager_ = new CameraManager(viewport); 107 this->cameraManager_ = new CameraManager(GraphicsManager::getInstance().getViewport()); 93 108 94 109 // Start the Radar … … 102 117 this->notificationManager_ = new NotificationManager(); 103 118 104 if ( Core::isMaster())119 if (GameMode::isMaster()) 105 120 { 106 121 // create the global LevelManager … … 110 125 } 111 126 112 if (Core::showsGraphics()) 113 { 114 // TODO: insert slomo console command with 115 // .accessLevel(AccessLevel::Offline).defaultValue(0, 1.0).axisParamIndex(0).isAxisRelative(false); 116 127 if (GameMode::showsGraphics()) 128 { 117 129 // keybind console command 118 130 FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind); … … 132 144 } 133 145 134 void GSLevel::leave() 146 void GSLevel::showIngameGUI(bool show) 147 { 148 if (show) 149 { 150 GUIManager::getInstancePtr()->showGUI("inGameTest"); 151 GUIManager::getInstancePtr()->executeCode("showCursor()"); 152 InputManager::getInstance().requestEnterState("guiMouseOnly"); 153 } 154 else 155 { 156 GUIManager::getInstancePtr()->executeCode("hideGUI(\"inGameTest\")"); 157 GUIManager::getInstancePtr()->executeCode("hideCursor()"); 158 InputManager::getInstance().requestLeaveState("guiMouseOnly"); 159 } 160 } 161 162 void GSLevel::deactivate() 135 163 { 136 164 // destroy console commands … … 145 173 this->ccTkeybind_ = 0; 146 174 } 175 147 176 148 177 // this call will delete every BaseObject! … … 152 181 //Loader::close(); 153 182 154 if ( Core::showsGraphics())183 if (GameMode::showsGraphics()) 155 184 InputManager::getInstance().requestLeaveState("game"); 156 185 157 if ( Core::isMaster())186 if (GameMode::isMaster()) 158 187 this->unloadLevel(); 159 188 … … 194 223 } 195 224 196 if (Core::showsGraphics()) 197 { 198 inputState_->setHandler(0); 225 if (GameMode::showsGraphics()) 226 { 227 gameInputState_->setHandler(0); 228 guiMouseOnlyInputState_->setHandler(0); 229 guiKeysOnlyInputState_->setHandler(0); 199 230 InputManager::getInstance().requestDestroyState("game"); 200 231 if (this->keyBinder_) … … 206 237 } 207 238 208 void GSLevel:: ticked(const Clock& time)209 { 210 // Commented by 1337: Temporarily moved to GSGraphics.239 void GSLevel::update(const Clock& time) 240 { 241 // Note: Temporarily moved to GSGraphics. 211 242 //// Call the scene objects 212 243 //for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it) … … 251 282 Command string that can be executed by the CommandExecutor 252 283 OR: Internal string "KeybindBindingStringKeyName=" used for the second call to identify 253 the key/button/axis that has been activated. This is configured above in enter().284 the key/button/axis that has been activated. This is configured above in activate(). 254 285 */ 255 286 void GSLevel::keybindInternal(const std::string& command, bool bTemporary) 256 287 { 257 if ( Core::showsGraphics())288 if (GameMode::showsGraphics()) 258 289 { 259 290 static std::string bindingString = "";
Note: See TracChangeset
for help on using the changeset viewer.