Changeset 1219 for code/trunk/src/orxonox
- Timestamp:
- May 2, 2008, 10:44:57 PM (17 years ago)
- Location:
- code/trunk/src/orxonox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/CMakeLists.txt
r1214 r1219 58 58 tinyxml 59 59 tolualib 60 ois 60 61 util 61 62 core -
code/trunk/src/orxonox/Orxonox.cc
r1214 r1219 85 85 namespace orxonox 86 86 { 87 ConsoleCommand (Orxonox, exit, AccessLevel::None, true);88 ConsoleCommand (Orxonox, slomo, AccessLevel::Offline, true).setDefaultValue(0, 1.0);89 ConsoleCommand (Orxonox, setTimeFactor, AccessLevel::Offline, false).setDefaultValue(0, 1.0);90 87 ConsoleCommandShortcut(Orxonox, exit, AccessLevel::None); 88 ConsoleCommandShortcut(Orxonox, slomo, AccessLevel::Offline).setDefaultValue(0, 1.0); 89 ConsoleCommandShortcut(Orxonox, setTimeFactor, AccessLevel::Offline).setDefaultValue(0, 1.0); 90 ConsoleCommandShortcut(Orxonox, activateConsole, AccessLevel::None); 91 91 class Testconsole : public InputBufferListener 92 92 { … … 119 119 void exit() const 120 120 { 121 CommandExecutor::execute("setInputMode 2");121 InputManager::setInputState(InputManager::IS_NORMAL); 122 122 } 123 123 … … 185 185 delete this->orxonoxHUD_; 186 186 Loader::close(); 187 InputManager:: getSingleton().destroy();187 InputManager::destroy(); 188 188 if (this->auMan_) 189 189 delete this->auMan_; … … 400 400 void Orxonox::setupInputSystem() 401 401 { 402 inputHandler_ = &InputManager::getSingleton(); 403 if (!inputHandler_->initialise(ogre_->getWindowHandle(), 402 if (!InputManager::initialise(ogre_->getWindowHandle(), 404 403 ogre_->getWindowWidth(), ogre_->getWindowHeight())) 405 404 abortImmediateForce(); 406 inputHandler_->setInputMode(IM_INGAME);405 InputManager::setInputState(InputManager::IS_NORMAL); 407 406 } 408 407 … … 423 422 void Orxonox::startRenderLoop() 424 423 { 425 InputBuffer* ib = new InputBuffer(); 426 InputManager::getSingleton().feedInputBuffer(ib); 424 InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyHandler("buffer")); 427 425 /* 428 426 Testconsole* console = new Testconsole(ib); … … 459 457 eventTimes[i].clear(); 460 458 // fill the fps time list with zeros 461 for (int i = 0; i < 20; i++)459 for (int i = 0; i < 50; i++) 462 460 eventTimes[3].push_back(0); 463 461 … … 485 483 // show the current time in the HUD 486 484 orxonoxHUD_->setTime((int)now, 0); 485 orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber()); 487 486 if (eventTimes[3].back() - eventTimes[3].front() != 0) 488 orxonoxHUD_->setRocket1((int)( 20000.0f/(eventTimes[3].back() - eventTimes[3].front())));487 orxonoxHUD_->setRocket1((int)(50000.0f/(eventTimes[3].back() - eventTimes[3].front()))); 489 488 490 489 // Iterate through all Tickables and call their tick(dt) function … … 551 550 } 552 551 553 /** 554 @brief Test method for the InputHandler. 555 But: Is actually responsible for catching an exit event.. 556 */ 557 void Orxonox::eventOccured(InputEvent &evt) 558 { 559 if (evt.id == 1) 560 this->abortRequest(); 552 void Orxonox::activateConsole() 553 { 554 InputManager::setInputState(InputManager::IS_CONSOLE); 561 555 } 562 556 } -
code/trunk/src/orxonox/Orxonox.h
r1214 r1219 44 44 45 45 #include "GraphicsEngine.h" 46 #include "core/InputEventListener.h"47 48 46 49 47 namespace orxonox { … … 56 54 57 55 //! Orxonox singleton class 58 class _OrxonoxExport Orxonox : public InputEventListener56 class _OrxonoxExport Orxonox 59 57 { 60 58 public: … … 72 70 static inline float getTimeFactor() { return Orxonox::getSingleton()->timefactor_; } 73 71 static inline void exit() { Orxonox::getSingleton()->abortRequest(); } 72 static inline void activateConsole(); 74 73 75 74 private: … … 95 94 float calculateEventTime(unsigned long, std::deque<unsigned long>&); 96 95 97 void eventOccured(InputEvent &evt);98 99 96 private: 100 97 GraphicsEngine* ogre_; //!< our dearest graphics engine <3 -
code/trunk/src/orxonox/OrxonoxStableHeaders.h
r1209 r1219 79 79 #include <OgreWindowEventUtilities.h> 80 80 81 #include <OIS/OIS.h>82 83 81 //----------------------------------------------------------------------- 84 82 // ORXONOX HEADERS 85 83 //----------------------------------------------------------------------- 84 85 #include "ois/OIS.h" 86 86 87 87 //#include "util/Convert.h" -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1209 r1219 32 32 #include <string> 33 33 34 #include <OIS/OIS.h>35 34 #include <OgreCamera.h> 36 35 #include <OgreRenderWindow.h> … … 39 38 40 39 #include "tinyxml/tinyxml.h" 40 #include "ois/OIS.h" 41 41 #include "util/Convert.h" 42 42 #include "util/Math.h" … … 428 428 void SpaceShip::tick(float dt) 429 429 { 430 if (InputManager::getSingleton().getMouse()->getEventCallback() != this) 431 { 432 if (InputManager::getSingleton().getMouse()) 433 { 434 InputManager::getSingleton().getMouse()->setEventCallback(this); 435 this->setMouseEventCallback_ = true; 436 } 430 if (!setMouseEventCallback_) 431 { 432 InputManager::addMouseHandler(this, "SpaceShip"); 433 setMouseEventCallback_ = true; 437 434 } 438 435 … … 457 454 } 458 455 459 OIS::Keyboard* mKeyboard = InputManager::getSingleton().getKeyboard(); 460 //FIXME: variable never used 461 //OIS::Mouse* mMouse = InputManager::getSingleton().getMouse(); 456 OIS::Keyboard* mKeyboard = InputManager::getKeyboard(); 462 457 463 458 -
code/trunk/src/orxonox/objects/SpaceShip.h
r1056 r1219 33 33 34 34 #include <OgrePrerequisites.h> 35 #include <OIS/OISMouse.h>36 35 36 #include "core/InputHandler.h" 37 37 #include "Model.h" 38 38 #include "../tools/BillboardSet.h" … … 40 40 namespace orxonox 41 41 { 42 class _OrxonoxExport SpaceShip : public Model, public OIS::MouseListener42 class _OrxonoxExport SpaceShip : public Model, public MouseHandler 43 43 { 44 44 public: … … 68 68 bool mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id); 69 69 bool mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id); 70 bool mouseHeld(const OIS::MouseEvent &e, OIS::MouseButtonID id) { return true; } 70 71 71 72
Note: See TracChangeset
for help on using the changeset viewer.