Changeset 1334 for code/branches/console/src/orxonox
- Timestamp:
- May 20, 2008, 1:48:40 AM (17 years ago)
- Location:
- code/branches/console/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/orxonox/Orxonox.cc
r1317 r1334 88 88 ConsoleCommand(Orxonox, slomo, AccessLevel::Offline, true).setDefaultValue(0, 1.0); 89 89 ConsoleCommand(Orxonox, setTimeFactor, AccessLevel::Offline, false).setDefaultValue(0, 1.0); 90 /* 91 class Testconsole : public InputBufferListener 92 { 93 public: 94 Testconsole(InputBuffer* ib) : ib_(ib) {} 95 void listen() const 96 { 97 std::cout << "> " << this->ib_->get() << std::endl; 98 } 99 void execute() const 100 { 101 std::cout << ">> " << this->ib_->get() << std::endl; 102 if (!CommandExecutor::execute(this->ib_->get())) 103 std::cout << "Error" << std::endl; 104 this->ib_->clear(); 105 } 106 void hintandcomplete() const 107 { 108 std::cout << CommandExecutor::hint(this->ib_->get()) << std::endl; 109 this->ib_->set(CommandExecutor::complete(this->ib_->get())); 110 } 111 void clear() const 112 { 113 this->ib_->clear(); 114 } 115 void removeLast() const 116 { 117 this->ib_->removeBehindCursor(); 118 } 119 void exit() const 120 { 121 CommandExecutor::execute("setInputMode 2"); 122 } 123 124 private: 125 InputBuffer* ib_; 126 }; 127 */ 90 128 91 class Calculator 129 92 { … … 421 384 void Orxonox::startRenderLoop() 422 385 { 423 424 // InputBuffer* ib = new InputBuffer();425 // InputManager::getSingleton().feedInputBuffer(ib);426 /*427 Testconsole* console = new Testconsole(ib);428 ib->registerListener(console, &Testconsole::listen, true);429 ib->registerListener(console, &Testconsole::execute, '\r', false);430 ib->registerListener(console, &Testconsole::hintandcomplete, '\t', true);431 ib->registerListener(console, &Testconsole::clear, '§', true);432 ib->registerListener(console, &Testconsole::removeLast, '\b', true);433 ib->registerListener(console, &Testconsole::exit, (char)0x1B, true);434 */435 /*436 orxonoxConsole_ = new InGameConsole(ib);437 ib->registerListener(orxonoxConsole_, &InGameConsole::listen, true);438 ib->registerListener(orxonoxConsole_, &InGameConsole::execute, '\r', false);439 ib->registerListener(orxonoxConsole_, &InGameConsole::hintandcomplete, '\t', true);440 ib->registerListener(orxonoxConsole_, &InGameConsole::clear, '§', true);441 ib->registerListener(orxonoxConsole_, &InGameConsole::removeLast, '\b', true);442 ib->registerListener(orxonoxConsole_, &InGameConsole::exit, (char)0x1B, true);443 */444 386 // first check whether ogre root object has been created 445 387 if (Ogre::Root::getSingletonPtr() == 0) … … 490 432 for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) 491 433 it->tick((float)evt.timeSinceLastFrame * this->timefactor_); 492 // orxonoxConsole_->tick((float)evt.timeSinceLastFrame * this->timefactor_);493 434 494 435 // don't forget to call _fireFrameStarted in ogre to make sure -
code/branches/console/src/orxonox/Orxonox.h
r1317 r1334 105 105 // TODO: make this a config-value by creating a config class for orxonox 106 106 float frameSmoothingTime_; 107 // InGameConsole* orxonoxConsole_;108 107 HUD* orxonoxHUD_; 109 108 bool bAbort_; //!< aborts the render loop if true -
code/branches/console/src/orxonox/console/InGameConsole.cc
r1327 r1334 45 45 #include "GraphicsEngine.h" 46 46 47 #define LINES 2047 #define LINES 30 48 48 49 49 namespace orxonox … … 72 72 this->setConfigValues(); 73 73 74 Shell::getInstance(). registerListener(this);74 Shell::getInstance().addOutputLevel(true); 75 75 } 76 76 … … 139 139 void InGameConsole::lineAdded() 140 140 { 141 this->linesChanged();142 141 for (unsigned int i = LINES - 1; i > 1; --i) 142 { 143 143 this->consoleOverlayTextAreas_[i]->setCaption(this->consoleOverlayTextAreas_[i - 1]->getCaption()); 144 this->consoleOverlayTextAreas_[i]->setColourTop(this->consoleOverlayTextAreas_[i - 1]->getColourTop()); 145 this->consoleOverlayTextAreas_[i]->setColourBottom(this->consoleOverlayTextAreas_[i - 1]->getColourBottom()); 146 } 144 147 145 148 this->onlyLastLineChanged(); … … 214 217 this->consoleOverlayTextAreas_[i]->setMetricsMode(Ogre::GMM_PIXELS); 215 218 this->consoleOverlayTextAreas_[i]->setFontName("Console"); 216 this->consoleOverlayTextAreas_[i]->setCharHeight( 20);219 this->consoleOverlayTextAreas_[i]->setCharHeight(18); 217 220 this->consoleOverlayTextAreas_[i]->setParameter("colour_top", "0.21 0.69 0.21"); 218 221 this->consoleOverlayTextAreas_[i]->setLeft(8); … … 267 270 this->consoleOverlay_->hide(); 268 271 this->active_ = false; 272 Shell::getInstance().unregisterListener(this); 269 273 } 270 274 if (top >= 0) … … 311 315 { 312 316 this->consoleOverlayTextAreas_[i]->setWidth((int) this->windowW_ * InGameConsole::REL_WIDTH); 313 this->consoleOverlayTextAreas_[i]->setTop((int) this->windowH_ * InGameConsole::REL_HEIGHT - 24 - 1 6*i);317 this->consoleOverlayTextAreas_[i]->setTop((int) this->windowH_ * InGameConsole::REL_HEIGHT - 24 - 14*i); 314 318 } 315 319 } … … 320 324 void InGameConsole::activate() 321 325 { 326 Shell::getInstance().registerListener(this); 322 327 this->linesChanged(); 323 328 … … 362 367 void InGameConsole::print(const std::string& text, int index) 363 368 { 369 char level = 0; 370 if (text.size() > 0) 371 level = text[0]; 372 373 std::string output = text; 374 375 if (level >= -1 && level <= 5) 376 output.erase(0, 1); 377 364 378 if (LINES > index) 365 this->consoleOverlayTextAreas_[index]->setCaption(convert2UTF(text)); 379 { 380 if (level == -1) 381 { 382 this->consoleOverlayTextAreas_[index]->setColourTop (ColourValue(0.90, 0.90, 0.90, 1.00)); 383 this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(1.00, 1.00, 1.00, 1.00)); 384 } 385 else if (level == 1) 386 { 387 this->consoleOverlayTextAreas_[index]->setColourTop (ColourValue(0.95, 0.25, 0.25, 1.00)); 388 this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(1.00, 0.50, 0.50, 1.00)); 389 } 390 else if (level == 2) 391 { 392 this->consoleOverlayTextAreas_[index]->setColourTop (ColourValue(0.95, 0.50, 0.20, 1.00)); 393 this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(1.00, 0.70, 0.50, 1.00)); 394 } 395 else if (level == 3) 396 { 397 this->consoleOverlayTextAreas_[index]->setColourTop (ColourValue(0.25, 0.25, 0.75, 1.00)); 398 this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(0.80, 0.80, 1.00, 1.00)); 399 } 400 else if (level == 4) 401 { 402 this->consoleOverlayTextAreas_[index]->setColourTop (ColourValue(0.65, 0.48, 0.44, 1.00)); 403 this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(1.00, 0.90, 0.90, 1.00)); 404 } 405 else if (level == 5) 406 { 407 this->consoleOverlayTextAreas_[index]->setColourTop (ColourValue(0.40, 0.20, 0.40, 1.00)); 408 this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(0.80, 0.60, 0.80, 1.00)); 409 } 410 else 411 { 412 this->consoleOverlayTextAreas_[index]->setColourTop (ColourValue(0.21, 0.69, 0.21, 1.00)); 413 this->consoleOverlayTextAreas_[index]->setColourBottom(ColourValue(0.80, 1.00, 0.80, 1.00)); 414 } 415 416 this->consoleOverlayTextAreas_[index]->setCaption(convert2UTF(output)); 417 } 366 418 } 367 419
Note: See TracChangeset
for help on using the changeset viewer.