Changeset 1641 for code/branches/gui/src/orxonox/overlays/console
- Timestamp:
- Jul 22, 2008, 9:16:35 PM (16 years ago)
- Location:
- code/branches/gui/src/orxonox/overlays/console
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/overlays/console/InGameConsole.cc
r1638 r1641 46 46 #include "core/ConsoleCommand.h" 47 47 #include "core/input/InputManager.h" 48 #include "core/input/SimpleInputState.h" 49 #include "core/input/InputBuffer.h" 48 50 #include "GraphicsEngine.h" 49 51 … … 66 68 , consoleOverlayBorder_(0) 67 69 , consoleOverlayTextAreas_(0) 68 , emptySceneManager_(0)69 , emptyCamera_(0)70 , viewport_(0)71 70 { 72 71 RegisterObject(InGameConsole); … … 118 117 void InGameConsole::initialise() 119 118 { 119 // create the corresponding input state 120 InputManager::createSimpleInputState("console", 40)->setKeyHandler(Shell::getInstance().getInputBuffer()); 121 120 122 // create overlay and elements 121 123 Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr(); … … 195 197 Shell::getInstance().addOutputLevel(true); 196 198 197 // create a sceneManager in order to render in our own viewport198 this->emptySceneManager_ = Ogre::Root::getSingleton()199 .createSceneManager(Ogre::ST_GENERIC, "Console/EmptySceneManager");200 this->emptyCamera_ = this->emptySceneManager_->createCamera("Console/EmptyCamera");201 this->viewport_ = GraphicsEngine::getSingleton().getRenderWindow()->addViewport(emptyCamera_, 10);202 this->viewport_->setOverlaysEnabled(true);203 this->viewport_->setClearEveryFrame(false);204 205 199 COUT(4) << "Info: InGameConsole initialized" << std::endl; 206 200 } … … 211 205 void InGameConsole::destroy() 212 206 { 207 this->deactivate(); 208 209 // destroy the input state previously created 210 SimpleInputState * inputState = dynamic_cast<SimpleInputState*>(InputManager::getState("console")); 211 if (inputState) 212 InputManager::destroyState("console"); 213 213 214 Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr(); 214 215 if (ovMan) … … 467 468 if (output.size() > this->maxCharsPerLine_) 468 469 { 469 if (Shell::getInstance().getInputBuffer() .getCursorPosition() < this->inputWindowStart_)470 this->inputWindowStart_ = Shell::getInstance().getInputBuffer() .getCursorPosition();471 else if (Shell::getInstance().getInputBuffer() .getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1))472 this->inputWindowStart_ = Shell::getInstance().getInputBuffer() .getCursorPosition() - this->maxCharsPerLine_ + 1;470 if (Shell::getInstance().getInputBuffer()->getCursorPosition() < this->inputWindowStart_) 471 this->inputWindowStart_ = Shell::getInstance().getInputBuffer()->getCursorPosition(); 472 else if (Shell::getInstance().getInputBuffer()->getCursorPosition() >= (this->inputWindowStart_ + this->maxCharsPerLine_ - 1)) 473 this->inputWindowStart_ = Shell::getInstance().getInputBuffer()->getCursorPosition() - this->maxCharsPerLine_ + 1; 473 474 474 475 output = output.substr(this->inputWindowStart_, this->maxCharsPerLine_); -
code/branches/gui/src/orxonox/overlays/console/InGameConsole.h
r1638 r1641 100 100 Ogre::TextAreaOverlayElement** consoleOverlayTextAreas_; 101 101 102 Ogre::SceneManager* emptySceneManager_; //!< dummy SceneManager to render overlays in empty windows103 Ogre::Camera* emptyCamera_; //!< dummy camera to render overlays in empty windows104 Ogre::Viewport* viewport_;105 106 102 // config values 107 103 float relativeWidth;
Note: See TracChangeset
for help on using the changeset viewer.