Changeset 1182 for code/branches/input/src/orxonox/Orxonox.cc
- Timestamp:
- Apr 24, 2008, 9:40:23 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/orxonox/Orxonox.cc
r1156 r1182 84 84 namespace orxonox 85 85 { 86 ConsoleCommand (Orxonox, exit, AccessLevel::None, true);87 ConsoleCommand (Orxonox, slomo, AccessLevel::Offline, true).setDefaultValue(0, 1.0);88 ConsoleCommand (Orxonox, setTimeFactor, AccessLevel::Offline, false).setDefaultValue(0, 1.0);89 86 ConsoleCommandShortcut(Orxonox, exit, AccessLevel::None); 87 ConsoleCommandShortcut(Orxonox, slomo, AccessLevel::Offline).setDefaultValue(0, 1.0); 88 ConsoleCommandShortcut(Orxonox, setTimeFactor, AccessLevel::Offline).setDefaultValue(0, 1.0); 89 ConsoleCommandShortcut(Orxonox, activateConsole, AccessLevel::None); 90 90 class Testconsole : public InputBufferListener 91 91 { … … 118 118 void exit() const 119 119 { 120 CommandExecutor::execute("setInputMode 2");120 InputManager::setInputState(InputManager::IS_NORMAL); 121 121 } 122 122 … … 177 177 delete this->orxonoxHUD_; 178 178 Loader::close(); 179 InputManager:: getSingleton().destroy();179 InputManager::destroy(); 180 180 if (this->auMan_) 181 181 delete this->auMan_; … … 392 392 void Orxonox::setupInputSystem() 393 393 { 394 inputHandler_ = &InputManager::getSingleton(); 395 if (!inputHandler_->initialise(ogre_->getWindowHandle(), 394 if (!InputManager::initialise(ogre_->getWindowHandle(), 396 395 ogre_->getWindowWidth(), ogre_->getWindowHeight())) 397 396 abortImmediateForce(); 398 inputHandler_->setInputMode(IM_INGAME);397 InputManager::setInputState(InputManager::IS_NORMAL); 399 398 } 400 399 … … 415 414 void Orxonox::startRenderLoop() 416 415 { 417 InputBuffer* ib = new InputBuffer(); 418 InputManager::getSingleton().feedInputBuffer(ib); 419 Testconsole* console = new Testconsole(ib); 420 ib->registerListener(console, &Testconsole::listen, true); 421 ib->registerListener(console, &Testconsole::execute, '\r', false); 422 ib->registerListener(console, &Testconsole::execute, '\n', false); 423 ib->registerListener(console, &Testconsole::hintandcomplete, '\t', true); 424 ib->registerListener(console, &Testconsole::clear, '§', true); 425 ib->registerListener(console, &Testconsole::removeLast, '\b', true); 426 ib->registerListener(console, &Testconsole::exit, (char)0x1B, true); 416 InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyListener("buffer")); 417 console_ = new Testconsole(ib); 418 ib->registerListener(console_, &Testconsole::listen, true); 419 ib->registerListener(console_, &Testconsole::execute, '\r', false); 420 ib->registerListener(console_, &Testconsole::execute, '\n', false); 421 ib->registerListener(console_, &Testconsole::hintandcomplete, '\t', true); 422 ib->registerListener(console_, &Testconsole::clear, '§', true); 423 ib->registerListener(console_, &Testconsole::removeLast, '\b', true); 424 ib->registerListener(console_, &Testconsole::exit, (char)0x1B, true); 427 425 428 426 // first check whether ogre root object has been created … … 442 440 eventTimes[i].clear(); 443 441 // fill the fps time list with zeros 444 for (int i = 0; i < 20; i++)442 for (int i = 0; i < 50; i++) 445 443 eventTimes[3].push_back(0); 446 444 … … 468 466 // show the current time in the HUD 469 467 orxonoxHUD_->setTime((int)now, 0); 468 orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber()); 470 469 if (eventTimes[3].back() - eventTimes[3].front() != 0) 471 orxonoxHUD_->setRocket1((int)( 20000.0f/(eventTimes[3].back() - eventTimes[3].front())));470 orxonoxHUD_->setRocket1((int)(50000.0f/(eventTimes[3].back() - eventTimes[3].front()))); 472 471 473 472 // Iterate through all Tickables and call their tick(dt) function … … 533 532 } 534 533 535 /** 536 @brief Test method for the InputHandler. 537 But: Is actually responsible for catching an exit event.. 538 */ 539 void Orxonox::eventOccured(InputEvent &evt) 540 { 541 if (evt.id == 1) 542 this->abortRequest(); 534 void Orxonox::activateConsole() 535 { 536 InputManager::setInputState(InputManager::IS_CONSOLE); 543 537 } 544 538 }
Note: See TracChangeset
for help on using the changeset viewer.