Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 2, 2008, 10:44:57 PM (17 years ago)
Author:
rgrieder
Message:

merged input branch back to trunk. Not yet tested on tardis

Location:
code/trunk/src/orxonox
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/CMakeLists.txt

    r1214 r1219  
    5858  tinyxml
    5959  tolualib
     60  ois
    6061  util
    6162  core
  • code/trunk/src/orxonox/Orxonox.cc

    r1214 r1219  
    8585namespace orxonox
    8686{
    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);
    9191  class Testconsole : public InputBufferListener
    9292  {
     
    119119      void exit() const
    120120      {
    121         CommandExecutor::execute("setInputMode 2");
     121        InputManager::setInputState(InputManager::IS_NORMAL);
    122122      }
    123123
     
    185185      delete this->orxonoxHUD_;
    186186    Loader::close();
    187     InputManager::getSingleton().destroy();
     187    InputManager::destroy();
    188188    if (this->auMan_)
    189189      delete this->auMan_;
     
    400400  void Orxonox::setupInputSystem()
    401401  {
    402     inputHandler_ = &InputManager::getSingleton();
    403     if (!inputHandler_->initialise(ogre_->getWindowHandle(),
     402    if (!InputManager::initialise(ogre_->getWindowHandle(),
    404403          ogre_->getWindowWidth(), ogre_->getWindowHeight()))
    405404      abortImmediateForce();
    406     inputHandler_->setInputMode(IM_INGAME);
     405    InputManager::setInputState(InputManager::IS_NORMAL);
    407406  }
    408407
     
    423422  void Orxonox::startRenderLoop()
    424423  {
    425     InputBuffer* ib = new InputBuffer();
    426     InputManager::getSingleton().feedInputBuffer(ib);
     424    InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyHandler("buffer"));
    427425    /*
    428426    Testconsole* console = new Testconsole(ib);
     
    459457      eventTimes[i].clear();
    460458    // fill the fps time list with zeros
    461     for (int i = 0; i < 20; i++)
     459    for (int i = 0; i < 50; i++)
    462460      eventTimes[3].push_back(0);
    463461
     
    485483      // show the current time in the HUD
    486484      orxonoxHUD_->setTime((int)now, 0);
     485      orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber());
    487486      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())));
    489488
    490489      // Iterate through all Tickables and call their tick(dt) function
     
    551550  }
    552551
    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);
    561555  }
    562556}
  • code/trunk/src/orxonox/Orxonox.h

    r1214 r1219  
    4444
    4545#include "GraphicsEngine.h"
    46 #include "core/InputEventListener.h"
    47 
    4846
    4947namespace orxonox {
     
    5654
    5755  //! Orxonox singleton class
    58   class _OrxonoxExport Orxonox : public InputEventListener
     56  class _OrxonoxExport Orxonox
    5957  {
    6058    public:
     
    7270      static inline float getTimeFactor() { return Orxonox::getSingleton()->timefactor_; }
    7371      static inline void exit() { Orxonox::getSingleton()->abortRequest(); }
     72      static inline void activateConsole();
    7473
    7574   private:
     
    9594      float calculateEventTime(unsigned long, std::deque<unsigned long>&);
    9695
    97       void eventOccured(InputEvent &evt);
    98 
    9996    private:
    10097      GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
  • code/trunk/src/orxonox/OrxonoxStableHeaders.h

    r1209 r1219  
    7979#include <OgreWindowEventUtilities.h>
    8080
    81 #include <OIS/OIS.h>
    82 
    8381//-----------------------------------------------------------------------
    8482// ORXONOX HEADERS
    8583//-----------------------------------------------------------------------
     84
     85#include "ois/OIS.h"
    8686
    8787//#include "util/Convert.h"
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r1209 r1219  
    3232#include <string>
    3333
    34 #include <OIS/OIS.h>
    3534#include <OgreCamera.h>
    3635#include <OgreRenderWindow.h>
     
    3938
    4039#include "tinyxml/tinyxml.h"
     40#include "ois/OIS.h"
    4141#include "util/Convert.h"
    4242#include "util/Math.h"
     
    428428    void SpaceShip::tick(float dt)
    429429    {
    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;
    437434        }
    438435
     
    457454        }
    458455
    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();
    462457
    463458
  • code/trunk/src/orxonox/objects/SpaceShip.h

    r1056 r1219  
    3333
    3434#include <OgrePrerequisites.h>
    35 #include <OIS/OISMouse.h>
    3635
     36#include "core/InputHandler.h"
    3737#include "Model.h"
    3838#include "../tools/BillboardSet.h"
     
    4040namespace orxonox
    4141{
    42     class _OrxonoxExport SpaceShip : public Model, public OIS::MouseListener
     42    class _OrxonoxExport SpaceShip : public Model, public MouseHandler
    4343    {
    4444        public:
     
    6868            bool mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id);
    6969            bool mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id);
     70            bool mouseHeld(const OIS::MouseEvent &e, OIS::MouseButtonID id) { return true; }
    7071
    7172
Note: See TracChangeset for help on using the changeset viewer.