Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 973


Ignore:
Timestamp:
Apr 3, 2008, 10:23:37 AM (16 years ago)
Author:
rgrieder
Message:
  • not really done a lot, but svn create patch doesn't work with renamed files
Location:
code/branches/input
Files:
13 edited
2 copied
2 moved

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/orxonox/Orxonox.cc

    r969 r973  
    7070#include "objects/weapon/BulletManager.h"
    7171
    72 #include "InputHandler.h"
     72#include "core/InputManager.h"
    7373
    7474#include "Orxonox.h"
     
    108108      delete this->orxonoxHUD_;
    109109    Loader::close();
    110     InputHandler::destroySingleton();
     110    InputManager::destroySingleton();
    111111    if (this->auMan_)
    112112      delete this->auMan_;
     
    327327  void Orxonox::setupInputSystem()
    328328  {
    329     inputHandler_ = InputHandler::getSingleton();
     329    inputHandler_ = InputManager::getSingleton();
    330330    if (!inputHandler_->initialise(ogre_->getWindowHandle(),
    331331          ogre_->getWindowWidth(), ogre_->getWindowHeight()))
  • code/branches/input/src/orxonox/Orxonox.h

    r969 r973  
    1717
    1818#include "GraphicsEngine.h"
    19 #include "InputEventListener.h"
     19#include "core/InputEventListener.h"
    2020
    2121
     
    7575      audio::AudioManager*  auMan_;         //!< audio manager
    7676      BulletManager*        bulletMgr_;     //!< Keeps track of the thrown bullets
    77       InputHandler*         inputHandler_;  //!< Handles input with key bindings
     77      InputManager*         inputHandler_;  //!< Handles input with key bindings
    7878      Ogre::Root*           root_;          //!< Holy grail of Ogre
    7979      Ogre::Timer*          timer_;         //!< Main loop timer
  • code/branches/input/src/orxonox/OrxonoxPrereqs.h

    r945 r973  
    6161namespace orxonox {
    6262  class GraphicsEngine;
    63   struct InputEvent;
    64   class InputEventListener;
    65   class InputHandler;
    6663  class Orxonox;
    6764
  • code/branches/input/src/orxonox/core/CorePrereqs.h

    r945 r973  
    3636#include <string>
    3737
    38 #include "orxonox/OrxonoxPlatform.h"
     38#include "OrxonoxPlatform.h"
    3939
    4040//-----------------------------------------------------------------------
     
    8686  class Identifier;
    8787  class IdentifierDistributor;
     88  class InputHandlerGame;
     89  class InputHandlerGUI;
     90  class InputManager;
    8891  template <class T>
    8992  class Iterator;
  • code/branches/input/src/orxonox/core/InputEventListener.h

    r971 r973  
    4646  class _CoreExport InputEventListener : virtual public OrxonoxClass
    4747  {
    48     friend class InputHandler;
     48    friend class InputManager;
    4949  public:
    5050    InputEventListener();
  • code/branches/input/src/orxonox/core/InputHandler.cc

    r971 r973  
    2828/**
    2929 @file
    30  @brief Core relevant parts of InputEventListener
     30 @brief Implementation of the different input handlers.
    3131 */
    3232
    33 #include "InputHandlerBase.h"
     33#include "InputHandler.h"
    3434
    3535namespace orxonox
    3636{
     37  // ###############################
     38  // ###    InputHandlerGame     ###
     39  // ###############################
     40
    3741  /**
    3842    @brief standard constructor
    3943  */
     44  InputHandlerGame::InputHandlerGame()
     45  {
     46  }
     47
     48  /**
     49    @brief Destructor
     50  */
     51  InputHandlerGame::~InputHandlerGame()
     52  {
     53  }
     54
     55  /**
     56    @brief Event handler for the keyPressed Event.
     57    @param e Event information
     58  */
     59  bool InputHandlerGame::keyPressed(const OIS::KeyEvent &e)
     60  {
     61    return true;
     62  }
     63
     64  /**
     65    @brief Event handler for the keyReleased Event.
     66    @param e Event information
     67  */
     68  bool InputHandlerGame::keyReleased(const OIS::KeyEvent &e)
     69  {
     70    return true;
     71  }
     72
     73  /**
     74    @brief Event handler for the mouseMoved Event.
     75    @param e Event information
     76  */
     77  bool InputHandlerGame::mouseMoved(const OIS::MouseEvent &e)
     78  {
     79    return true;
     80  }
     81
     82  /**
     83    @brief Event handler for the mousePressed Event.
     84    @param e Event information
     85    @param id The ID of the mouse button
     86  */
     87  bool InputHandlerGame::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
     88  {
     89    return true;
     90  }
     91
     92  /**
     93    @brief Event handler for the mouseReleased Event.
     94    @param e Event information
     95    @param id The ID of the mouse button
     96  */
     97  bool InputHandlerGame::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
     98  {
     99    return true;
     100  }
     101
     102  // ###############################
     103  // ###     InputHandlerGUI     ###
     104  // ###############################
     105
     106  /**
     107    @brief standard constructor
     108  */
     109  InputHandlerGUI::InputHandlerGUI()
     110  {
     111  }
     112
     113  /**
     114    @brief Destructor
     115  */
     116  InputHandlerGUI::~InputHandlerGUI()
     117  {
     118  }
     119
     120  /**
     121    @brief Event handler for the keyPressed Event.
     122    @param e Event information
     123  */
     124  bool InputHandlerGUI::keyPressed(const OIS::KeyEvent &e)
     125  {
     126    return true;
     127  }
     128
     129  /**
     130    @brief Event handler for the keyReleased Event.
     131    @param e Event information
     132  */
     133  bool InputHandlerGUI::keyReleased(const OIS::KeyEvent &e)
     134  {
     135    return true;
     136  }
     137
     138  /**
     139    @brief Event handler for the mouseMoved Event.
     140    @param e Event information
     141  */
     142  bool InputHandlerGUI::mouseMoved(const OIS::MouseEvent &e)
     143  {
     144    return true;
     145  }
     146
     147  /**
     148    @brief Event handler for the mousePressed Event.
     149    @param e Event information
     150    @param id The ID of the mouse button
     151  */
     152  bool InputHandlerGUI::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
     153  {
     154    return true;
     155  }
     156
     157  /**
     158    @brief Event handler for the mouseReleased Event.
     159    @param e Event information
     160    @param id The ID of the mouse button
     161  */
     162  bool InputHandlerGUI::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
     163  {
     164    return true;
     165  }
    40166
    41167}
  • code/branches/input/src/orxonox/core/InputHandler.h

    r971 r973  
    2828/**
    2929 @file
    30  @brief InputHandlerBuffer class declaration
     30 @brief Different implementations of input processing.
    3131 */
    3232
    33 #ifndef _InputHandlerBase_H__
    34 #define _InputHandlerBase_H__
     33#ifndef _InputHandler_H__
     34#define _InputHandler_H__
     35
     36#include <OIS/OIS.h>
    3537
    3638#include "CorePrereqs.h"
     
    3941{
    4042  /**
    41     @brief
     43    @brief Captures mouse and keyboard input and distributes it to the
     44    GUI.
    4245  */
    43   class InputHandlerBase
     46  class _CoreExport InputHandlerGUI
     47        : public OIS::KeyListener, public OIS::MouseListener
    4448  {
     49  public:
     50    InputHandlerGUI ();
     51    ~InputHandlerGUI();
     52
     53  private:
     54    // input events
     55                bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
     56                bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
     57    bool mouseMoved   (const OIS::MouseEvent &arg);
     58                bool keyPressed   (const OIS::KeyEvent   &arg);
     59                bool keyReleased  (const OIS::KeyEvent   &arg);
    4560  };
     61
     62
     63  /**
     64    @brief Captures mouse and keyboard input while in the actual game mode.
     65    Manages the key bindings.
     66  */
     67  class _CoreExport InputHandlerGame
     68        : public OIS::KeyListener, public OIS::MouseListener
     69  {
     70  public:
     71    InputHandlerGame ();
     72    ~InputHandlerGame();
     73
     74  private:
     75    // input events
     76                bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
     77                bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
     78    bool mouseMoved   (const OIS::MouseEvent &arg);
     79                bool keyPressed   (const OIS::KeyEvent   &arg);
     80                bool keyReleased  (const OIS::KeyEvent   &arg);
     81  };
     82
    4683}
    4784
    48 #endif /* _InputHandlerBase_H__ */
     85#endif /* _InputHandler_H__ */
  • code/branches/input/src/orxonox/core/InputManager.cc

    r971 r973  
    3535#include "core/Debug.h"
    3636#include "InputEventListener.h"
    37 #include "InputHandler.h"
     37#include "InputManager.h"
    3838
    3939namespace orxonox
     
    4242    @brief The reference to the singleton
    4343  */
    44   InputHandler* InputHandler::singletonRef_s = 0;
     44  InputManager* InputManager::singletonRef_s = 0;
    4545
    4646  /**
    4747    @brief Constructor only resets the pointer values to 0.
    4848  */
    49   InputHandler::InputHandler() :
     49  InputManager::InputManager() :
    5050      mouse_(0), keyboard_(0), inputSystem_(0)
    5151  {
     
    5555    @brief Destructor only called at the end of the program
    5656  */
    57   InputHandler::~InputHandler()
     57  InputManager::~InputManager()
    5858  {
    5959    this->destroyDevices();
     
    6161
    6262  /**
    63     @brief The one instance of the InputHandler is stored in this function.
    64     @return The pointer to the only instance of the InputHandler
    65   */
    66   InputHandler *InputHandler::getSingleton()
     63    @brief The one instance of the InputManager is stored in this function.
     64    @return The pointer to the only instance of the InputManager
     65  */
     66  InputManager *InputManager::getSingleton()
    6767  {
    6868    if (!singletonRef_s)
    69       singletonRef_s = new InputHandler();
     69      singletonRef_s = new InputManager();
    7070    return singletonRef_s;
    7171  }
     
    7878    @param windowHeight The height of the render window
    7979  */
    80   bool InputHandler::initialise(size_t windowHnd, int windowWidth, int windowHeight)
     80  bool InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight)
    8181  {
    8282    if (!this->inputSystem_)
     
    9898        // Create inputsystem
    9999        inputSystem_ = OIS::InputManager::createInputSystem(paramList);
    100         COUT(ORX_DEBUG) << "*** InputHandler: Created OIS input system" << std::endl;
     100        COUT(ORX_DEBUG) << "*** InputManager: Created OIS input system" << std::endl;
    101101
    102102        // create a keyboard. If none are available the exception is caught.
    103103        keyboard_ = static_cast<OIS::Keyboard*>(inputSystem_->createInputObject(OIS::OISKeyboard, true));
    104104        keyboard_->setEventCallback(this);
    105         COUT(ORX_DEBUG) << "*** InputHandler: Created OIS mouse" << std::endl;
     105        COUT(ORX_DEBUG) << "*** InputManager: Created OIS mouse" << std::endl;
    106106
    107107        // create a mouse. If none are available the exception is caught.
    108108        mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true));
    109109        mouse_->setEventCallback(this);
    110         COUT(ORX_DEBUG) << "*** InputHandler: Created OIS keyboard" << std::endl;
     110        COUT(ORX_DEBUG) << "*** InputManager: Created OIS keyboard" << std::endl;
    111111
    112112        // Set mouse region
     
    122122    }
    123123
    124     COUT(ORX_DEBUG) << "*** InputHandler: Loading key bindings..." << std::endl;
     124    COUT(ORX_DEBUG) << "*** InputManager: Loading key bindings..." << std::endl;
    125125    // load the key bindings
    126126    InputEvent empty = {0, false, 0, 0, 0};
     
    130130    //assign 'abort' to the escape key
    131131    this->bindingsKeyPressed_[(int)OIS::KC_ESCAPE].id = 1;
    132     COUT(ORX_DEBUG) << "*** InputHandler: Loading done." << std::endl;
     132    COUT(ORX_DEBUG) << "*** InputManager: Loading done." << std::endl;
    133133
    134134    return true;
     
    138138    @brief Destroys all the created input devices.
    139139  */
    140   void InputHandler::destroyDevices()
    141   {
    142     COUT(ORX_DEBUG) << "*** InputHandler: Destroying InputHandler..." << std::endl;
     140  void InputManager::destroyDevices()
     141  {
     142    COUT(ORX_DEBUG) << "*** InputManager: Destroying InputManager..." << std::endl;
    143143    if (this->mouse_)
    144144      this->inputSystem_->destroyInputObject(mouse_);
     
    151151    this->keyboard_      = 0;
    152152    this->inputSystem_   = 0;
    153     COUT(ORX_DEBUG) << "*** InputHandler: Destroying done." << std::endl;
     153    COUT(ORX_DEBUG) << "*** InputManager: Destroying done." << std::endl;
    154154  }
    155155
     
    157157    @brief Destroys the singleton.
    158158  */
    159   void InputHandler::destroySingleton()
     159  void InputManager::destroySingleton()
    160160  {
    161161    if (singletonRef_s)
     
    165165
    166166  /**
    167     @brief Updates the InputHandler
     167    @brief Updates the InputManager
    168168    @param dt Delta time
    169169  */
    170   void InputHandler::tick(float dt)
     170  void InputManager::tick(float dt)
    171171  {
    172172    //this->mouse_->setEventCallback(this);
     
    185185    @param height the new height of the render window
    186186  */
    187   void InputHandler::setWindowExtents(int width, int height)
     187  void InputManager::setWindowExtents(int width, int height)
    188188  {
    189189    // Set mouse region (if window resizes, we should alter this to reflect as well)
     
    197197    @param evt The input event that occured.
    198198  */
    199   inline void InputHandler::callListeners(orxonox::InputEvent &evt)
     199  inline void InputManager::callListeners(orxonox::InputEvent &evt)
    200200  {
    201201    for (Iterator<InputEventListener> it = ObjectList<InputEventListener>::start(); it; )
     
    212212    @param e Event information
    213213  */
    214   bool InputHandler::keyPressed(const OIS::KeyEvent &e)
     214  bool InputManager::keyPressed(const OIS::KeyEvent &e)
    215215  {
    216216    callListeners(this->bindingsKeyPressed_[(int)e.key]);
     
    222222    @param e Event information
    223223  */
    224   bool InputHandler::keyReleased(const OIS::KeyEvent &e)
     224  bool InputManager::keyReleased(const OIS::KeyEvent &e)
    225225  {
    226226    return true;
     
    231231    @param e Event information
    232232  */
    233   bool InputHandler::mouseMoved(const OIS::MouseEvent &e)
     233  bool InputManager::mouseMoved(const OIS::MouseEvent &e)
    234234  {
    235235    return true;
     
    241241    @param id The ID of the mouse button
    242242  */
    243   bool InputHandler::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
     243  bool InputManager::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
    244244  {
    245245    COUT(1) << "asdf" << std::endl;
     
    252252    @param id The ID of the mouse button
    253253  */
    254   bool InputHandler::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
     254  bool InputManager::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
    255255  {
    256256    return true;
  • code/branches/input/src/orxonox/core/InputManager.h

    r971 r973  
    3232 */
    3333
    34 #ifndef _InputHandler_H__
    35 #define _InputHandler_H__
     34#ifndef _InputManager_H__
     35#define _InputManager_H__
    3636
    3737#include <OIS/OIS.h>
     
    5151  enum InputMode
    5252  {
    53     IM_GUI      = 0;
    54     IM_KEYBOARD = 1;
    55     IM_INGAME   = 2;
     53    IM_GUI      = 0,
     54    IM_KEYBOARD = 1,
     55    IM_INGAME   = 2,
    5656  };
    5757
     
    6161    implementing the InputEventListener interface.
    6262  */
    63   class _CoreExport InputHandler
     63  class _CoreExport InputManager
    6464        : public Tickable, public OIS::KeyListener, public OIS::MouseListener
    6565  {
     
    7474    OIS::Keyboard *getKeyboard() { return this->keyboard_; }
    7575
    76     static InputHandler* getSingleton();
     76    static InputManager* getSingleton();
    7777    static void destroySingleton();
    7878
    7979  private:
    8080    // don't mess with a Singleton
    81     InputHandler ();
    82     InputHandler (const InputHandler&);
    83     InputHandler& operator=(const InputHandler& instance);
    84     ~InputHandler();
     81    InputManager ();
     82    InputManager (const InputManager&);
     83    InputManager& operator=(const InputManager& instance);
     84    ~InputManager();
    8585
    8686    void callListeners(InputEvent &evt);
     
    114114
    115115    //! Pointer to the instance of the singleton
    116     static InputHandler *singletonRef_s;
     116    static InputManager *singletonRef_s;
    117117  };
    118118}
    119119
    120 #endif /* _InputHandler_H__ */
     120#endif /* _InputManager_H__ */
  • code/branches/input/src/orxonox/objects/Fighter.cc

    r929 r973  
    3939#include "core/CoreIncludes.h"
    4040#include "Orxonox.h"
    41 #include "InputHandler.h"
     41#include "core/InputManager.h"
    4242#include "particle/ParticleInterface.h"
    4343#include "weapon/AmmunitionDump.h"
     
    255255        if (!this->setMouseEventCallback_)
    256256        {
    257             if (InputHandler::getSingleton()->getMouse())
     257            if (InputManager::getSingleton()->getMouse())
    258258            {
    259                 InputHandler::getSingleton()->getMouse()->setEventCallback(this);
     259                InputManager::getSingleton()->getMouse()->setEventCallback(this);
    260260                this->setMouseEventCallback_ = true;
    261261            }
     
    264264        WorldEntity::tick(dt);
    265265
    266         OIS::Keyboard* mKeyboard = InputHandler::getSingleton()->getKeyboard();
    267         OIS::Mouse* mMouse = InputHandler::getSingleton()->getMouse();
     266        OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard();
     267        OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse();
    268268
    269269        mKeyboard->capture();
  • code/branches/input/src/orxonox/objects/SpaceShip.cc

    r929 r973  
    4242#include "core/Debug.h"
    4343#include "Orxonox.h"
    44 #include "InputHandler.h"
     44#include "core/InputManager.h"
    4545#include "particle/ParticleInterface.h"
    4646#include "Projectile.h"
     
    419419        if (!this->setMouseEventCallback_)
    420420        {
    421             if (InputHandler::getSingleton()->getMouse())
     421            if (InputManager::getSingleton()->getMouse())
    422422            {
    423                 InputHandler::getSingleton()->getMouse()->setEventCallback(this);
     423                InputManager::getSingleton()->getMouse()->setEventCallback(this);
    424424                this->setMouseEventCallback_ = true;
    425425            }
     
    446446        }
    447447
    448         OIS::Keyboard* mKeyboard = InputHandler::getSingleton()->getKeyboard();
    449         OIS::Mouse* mMouse = InputHandler::getSingleton()->getMouse();
     448        OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard();
     449        OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse();
    450450
    451451        mKeyboard->capture();
  • code/branches/input/visual_studio/base_properties.vsprops

    r944 r973  
    99                Name="VCCLCompilerTool"
    1010                AdditionalIncludeDirectories="&quot;$(RootDir)src&quot;;&quot;$(RootDir)src\orxonox&quot;;&quot;$(DependencyDir)include&quot;"
    11                 PreprocessorDefinitions="WIN32;__WIN32__;_WIN32;BOOST_ALL_DYN_LINK"
     11                PreprocessorDefinitions="WIN32;__WIN32__;_WIN32;BOOST_ALL_DYN_LINK;OIS_DYNAMIC_LIB; ZLIB_WINAPI"
    1212                WarningLevel="3"
    1313                DisableSpecificWarnings="4244;4251"
  • code/branches/input/visual_studio/core_properties.vsprops

    r790 r973  
    1212        <Tool
    1313                Name="VCLinkerTool"
    14                 AdditionalDependencies="OgreMain$(CS).lib"
     14                AdditionalDependencies="OgreMain$(CS).lib OIS$(CSS).lib"
    1515        />
    1616</VisualStudioPropertySheet>
  • code/branches/input/visual_studio/network_properties.vsprops

    r918 r973  
    88        <Tool
    99                Name="VCCLCompilerTool"
    10                 PreprocessorDefinitions="NETWORK_SHARED_BUILD; ZLIB_WINAPI;WIN32_LEAN_AND_MEAN"
     10                PreprocessorDefinitions="NETWORK_SHARED_BUILD;WIN32_LEAN_AND_MEAN"
    1111        />
    1212        <Tool
  • code/branches/input/visual_studio/orxonox_properties.vsprops

    r790 r973  
    88        <Tool
    99                Name="VCCLCompilerTool"
    10                 PreprocessorDefinitions="ORXONOX_SHARED_BUILD; LOADER_STATIC_BUILD"
     10                PreprocessorDefinitions="ORXONOX_SHARED_BUILD"
    1111                UsePrecompiledHeader="2"
    1212                PrecompiledHeaderThrough="OrxonoxStableHeaders.h"
  • code/branches/input/visual_studio/vc8/core.vcproj

    r971 r973  
    317317                        </File>
    318318                        <File
    319                                 RelativePath="..\..\src\orxonox\core\InputHandlerBuffer.cc"
    320                                 >
    321                         </File>
    322                         <File
    323                                 RelativePath="..\..\src\orxonox\core\InputHandlerGame.cc"
    324                                 >
    325                         </File>
    326                         <File
    327                                 RelativePath="..\..\src\orxonox\core\InputHandlerGUI.cc"
     319                                RelativePath="..\..\src\orxonox\core\InputManager.cc"
    328320                                >
    329321                        </File>
     
    439431                        </File>
    440432                        <File
    441                                 RelativePath="..\..\src\orxonox\core\InputHandlerBuffer.h"
    442                                 >
    443                         </File>
    444                         <File
    445                                 RelativePath="..\..\src\orxonox\core\InputHandlerGame.h"
    446                                 >
    447                         </File>
    448                         <File
    449                                 RelativePath="..\..\src\orxonox\core\InputHandlerGUI.h"
     433                                RelativePath="..\..\src\orxonox\core\InputManager.h"
    450434                                >
    451435                        </File>
  • code/branches/input/visual_studio/vc8/orxonox.vcproj

    r945 r973  
    285285                        </File>
    286286                        <File
    287                                 RelativePath="..\..\src\orxonox\InputEventListener.cc"
    288                                 >
    289                         </File>
    290                         <File
    291                                 RelativePath="..\..\src\orxonox\InputHandler.cc"
    292                                 >
    293                         </File>
    294                         <File
    295287                                RelativePath="..\..\src\orxonox\Main.cc"
    296288                                >
     
    455447                        </File>
    456448                        <File
    457                                 RelativePath="..\..\src\orxonox\InputEvent.h"
    458                                 >
    459                         </File>
    460                         <File
    461                                 RelativePath="..\..\src\orxonox\InputEventListener.h"
    462                                 >
    463                         </File>
    464                         <File
    465                                 RelativePath="..\..\src\orxonox\InputHandler.h"
    466                                 >
    467                         </File>
    468                         <File
    469449                                RelativePath="..\..\src\orxonox\Orxonox.h"
    470450                                >
Note: See TracChangeset for help on using the changeset viewer.