Changeset 6105 for code/trunk/src/orxonox
- Timestamp:
- Nov 20, 2009, 4:55:40 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 4 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/console (added) merged: 5941,5945,5968-5975,5983,5985-5986,5991-5992,5994-5996,5998,6000,6004-6007,6010-6017,6034,6037,6041,6043-6044,6089,6103-6104
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/Main.cc
r6021 r6105 68 68 " standalone,server,client" 69 69 " level" 70 " dedicated,dedicatedClient"70 " server,client" 71 71 " level" 72 " ioConsole"73 72 ); 74 73 … … 83 82 Game::getInstance().requestStates("graphics, client, level"); 84 83 else if (CommandLineParser::getValue("dedicated").getBool()) 85 Game::getInstance().requestStates(" dedicated, level");84 Game::getInstance().requestStates("server, level"); 86 85 else if (CommandLineParser::getValue("dedicatedClient").getBool()) 87 Game::getInstance().requestStates("dedicatedClient, level"); 88 else if (CommandLineParser::getValue("console").getBool()) 89 Game::getInstance().requestStates("ioConsole"); 86 Game::getInstance().requestStates("client, level"); 90 87 else 91 Game::getInstance().requestStates("graphics, mainMenu"); 88 { 89 if (!CommandLineParser::getValue("console").getBool()) 90 Game::getInstance().requestStates("graphics, mainMenu"); 91 } 92 92 93 93 game->run(); -
code/trunk/src/orxonox/gamestates/CMakeLists.txt
r5929 r6105 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 GSClient.cc 3 GSDedicated.cc4 GSDedicatedClient.cc5 3 GSGraphics.cc 6 GSIOConsole.cc7 4 GSLevel.cc 8 5 GSMainMenu.cc -
code/trunk/src/orxonox/gamestates/GSClient.cc
r6021 r6105 29 29 #include "GSClient.h" 30 30 31 #include "util/ Clock.h"31 #include "util/Debug.h" 32 32 #include "util/Exception.h" 33 33 #include "core/CommandLineParser.h" … … 38 38 namespace orxonox 39 39 { 40 DeclareGameState(GSClient, "client", false, true);40 DeclareGameState(GSClient, "client", false, false); 41 41 42 42 SetCommandLineArgument(ip, "127.0.0.1").information("Sever IP as string in the form #.#.#.#"); -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r5929 r6105 91 91 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startDedicated), "startDedicated")); 92 92 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu")); 93 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startIOConsole), "startIOConsole"));94 93 95 94 KeyBinderManager::getInstance().setToDefault(); … … 146 145 Game::getInstance().popState(); 147 146 Game::getInstance().popState(); 148 Game::getInstance().requestStates(" dedicated, level");147 Game::getInstance().requestStates("server, level"); 149 148 } 150 149 void GSMainMenu::startMainMenu() … … 155 154 Game::getInstance().requestStates("mainmenu"); 156 155 } 157 void GSMainMenu::startIOConsole()158 {159 // HACK - HACK160 Game::getInstance().popState();161 Game::getInstance().popState();162 Game::getInstance().requestStates("ioConsole");163 }164 156 } -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r5929 r6105 90 90 void GSRoot::update(const Clock& time) 91 91 { 92 if (this->getActivity().topState)93 {94 // This state can not 'survive' on its own.95 // Load a user interface therefore96 Game::getInstance().requestState("ioConsole");97 }98 99 92 for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; ) 100 93 (it++)->tick(time); -
code/trunk/src/orxonox/gamestates/GSServer.cc
r6021 r6105 37 37 namespace orxonox 38 38 { 39 DeclareGameState(GSServer, "server", false, true);39 DeclareGameState(GSServer, "server", false, false); 40 40 41 41 SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)"); -
code/trunk/src/orxonox/overlays/InGameConsole.cc
r5960 r6105 68 68 */ 69 69 InGameConsole::InGameConsole() 70 : consoleOverlay_(0) 70 : shell_(new Shell("InGameConsole", true, true)) 71 , consoleOverlay_(0) 71 72 , consoleOverlayContainer_(0) 72 73 , consoleOverlayNoise_(0) … … 99 100 // destroy the input state previously created (InputBuffer gets destroyed by the Shell) 100 101 InputManager::getInstance().destroyState("console"); 102 103 // destroy the underlaying shell 104 this->shell_->destroy(); 101 105 102 106 Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr(); … … 174 178 // create the corresponding input state 175 179 inputState_ = InputManager::getInstance().createInputState("console", false, false, InputStatePriority::Console); 176 inputState_->setKeyHandler( Shell::getInstance().getInputBuffer());180 inputState_->setKeyHandler(this->shell_->getInputBuffer()); 177 181 bHidesAllInputChanged(); 178 182 … … 252 256 this->consoleOverlayContainer_->setTop(-1.3 * this->relativeHeight); 253 257 254 Shell::getInstance().addOutputLevel(true);255 256 258 COUT(4) << "Info: InGameConsole initialized" << std::endl; 257 259 } … … 266 268 void InGameConsole::linesChanged() 267 269 { 268 std::list<std::string>::const_iterator it = Shell::getInstance().getNewestLineIterator();270 std::list<std::string>::const_iterator it = this->shell_->getNewestLineIterator(); 269 271 int max = 0; 270 272 for (int i = 1; i < LINES; ++i) 271 273 { 272 if (it != Shell::getInstance().getEndIterator())274 if (it != this->shell_->getEndIterator()) 273 275 { 274 276 ++it; … … 295 297 { 296 298 if (LINES > 1) 297 this->print(* Shell::getInstance().getNewestLineIterator(), 1);299 this->print(*this->shell_->getNewestLineIterator(), 1); 298 300 } 299 301 … … 314 316 { 315 317 if (LINES > 0) 316 this->print( Shell::getInstance().getInput(), 0);317 318 if ( Shell::getInstance().getInput() == "" || Shell::getInstance().getInput().size() == 0)318 this->print(this->shell_->getInput(), 0); 319 320 if (this->shell_->getInput() == "" || this->shell_->getInput().size() == 0) 319 321 this->inputWindowStart_ = 0; 320 322 } … … 325 327 void InGameConsole::cursorChanged() 326 328 { 327 unsigned int pos = Shell::getInstance().getCursorPosition() - inputWindowStart_;329 unsigned int pos = this->shell_->getCursorPosition() - inputWindowStart_; 328 330 if (pos > maxCharsPerLine_) 329 331 pos = maxCharsPerLine_; … … 331 333 this->consoleOverlayCursor_->setCaption(std::string(pos,' ') + cursorSymbol_); 332 334 this->consoleOverlayCursor_->setTop(static_cast<int>(this->windowH_ * this->relativeHeight) - 24); 335 } 336 337 /** 338 @brief Called if a command is about to be executed 339 */ 340 void InGameConsole::executed() 341 { 342 this->shell_->addOutputLine(this->shell_->getInput()); 333 343 } 334 344 … … 482 492 if (output.size() > this->maxCharsPerLine_) 483 493 { 484 if ( Shell::getInstance().getInputBuffer()->getCursorPosition() < this->inputWindowStart_)485 this->inputWindowStart_ = Shell::getInstance().getInputBuffer()->getCursorPosition();486 else if ( Shell::getInstance().getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1))487 this->inputWindowStart_ = Shell::getInstance().getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1;494 if (this->shell_->getInputBuffer()->getCursorPosition() < this->inputWindowStart_) 495 this->inputWindowStart_ = this->shell_->getInputBuffer()->getCursorPosition(); 496 else if (this->shell_->getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1)) 497 this->inputWindowStart_ = this->shell_->getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1; 488 498 489 499 output = output.substr(this->inputWindowStart_, this->maxCharsPerLine_); … … 506 516 this->bActive_ = true; 507 517 InputManager::getInstance().enterState("console"); 508 Shell::getInstance().registerListener(this);518 this->shell_->registerListener(this); 509 519 510 520 this->windowResized(this->windowW_, this->windowH_); … … 528 538 this->bActive_ = false; 529 539 InputManager::getInstance().leaveState("console"); 530 Shell::getInstance().unregisterListener(this);540 this->shell_->unregisterListener(this); 531 541 532 542 // scroll up … … 588 598 } 589 599 590 // ############################### 591 // ### s atic methods ###592 // ############################### 600 // ################################ 601 // ### static methods ### 602 // ################################ 593 603 594 604 /** -
code/trunk/src/orxonox/overlays/InGameConsole.h
r5929 r6105 68 68 void inputChanged(); 69 69 void cursorChanged(); 70 void executed(); 70 71 void exit(); 71 72 … … 81 82 82 83 private: // variables 84 Shell* shell_; 83 85 bool bActive_; 84 86 int windowW_;
Note: See TracChangeset
for help on using the changeset viewer.