Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 12, 2009, 4:12:04 PM (15 years ago)
Author:
rgrieder
Message:

Added a few more generic parts to the input library:

  • Created Mouse and Keyboard to join JoyStick and provided them with a templated base class (InputDeviceTemplated) that does most of the work (reduces quite some redundancy)
  • Created InputPrereqs.h from InputInterfaces.h and destroyed the latter
  • Exported InputHandler to its own file and replaced KeyHandler, MouseHandler and JoyStickHandler with the single InputHandler.
  • Deleted the SimpleInputState: There is only one class now which fulfills all our needs.

In general there is now less code and the code itself has more 'pluses'. However I haven't really thrown away any feature at all.

Location:
code/branches/core4/src/orxonox/gamestates
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/orxonox/gamestates/GSGraphics.cc

    r3270 r3274  
    3838#include <OgreRenderWindow.h>
    3939
     40#include "util/Convert.h"
    4041#include "core/ConfigValueIncludes.h"
    4142#include "core/Clock.h"
     43#include "core/CommandExecutor.h"
    4244#include "core/ConsoleCommand.h"
    4345#include "core/Core.h"
     
    4749#include "core/input/InputManager.h"
    4850#include "core/input/KeyBinder.h"
    49 #include "core/input/SimpleInputState.h"
     51#include "core/input/InputState.h"
    5052#include "core/Loader.h"
    5153#include "core/XMLFile.h"
     
    125127
    126128        // load master key bindings
    127         masterInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("master", true);
     129        masterInputState_ = InputManager::getInstance().createInputState("master", true);
    128130        masterKeyBinder_ = new KeyBinder();
    129131        masterKeyBinder_->loadBindings("masterKeybindings.ini");
     
    244246    {
    245247        // OIS needs this under linux even if we only use relative input measurement.
    246         if (this->inputManager_)
    247             this->inputManager_->setWindowExtents(newWidth, newHeight);
     248        // HACK:
     249        CommandExecutor::execute("setWindowExtents_s " + multi_cast<std::string>(newWidth) + " " + multi_cast<std::string>(newHeight));
    248250    }
    249251
  • code/branches/core4/src/orxonox/gamestates/GSGraphics.h

    r3243 r3274  
    7575
    7676        KeyBinder*            masterKeyBinder_;     //!< Key binder for master key bindings
    77         SimpleInputState*     masterInputState_;    //!< Special input state for master input
     77        InputState*           masterInputState_;    //!< Special input state for master input
    7878        XMLFile*              debugOverlay_;
    7979        ConsoleCommand*       ccToggleGUI_;         //!< Console command to toggle GUI
  • code/branches/core4/src/orxonox/gamestates/GSLevel.cc

    r3249 r3274  
    3131
    3232#include "core/input/InputManager.h"
    33 #include "core/input/SimpleInputState.h"
     33#include "core/input/InputState.h"
    3434#include "core/input/KeyBinder.h"
    3535#include "core/Clock.h"
     
    9090        if (GameMode::showsGraphics())
    9191        {
    92             gameInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game");
     92            gameInputState_ = InputManager::getInstance().createInputState("game");
    9393            keyBinder_ = new KeyBinder();
    9494            keyBinder_->loadBindings("keybindings.ini");
    9595            gameInputState_->setHandler(keyBinder_);
    9696
    97             guiMouseOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiMouseOnly");
     97            guiMouseOnlyInputState_ = InputManager::getInstance().createInputState("guiMouseOnly");
    9898            guiMouseOnlyInputState_->setMouseHandler(GUIManager::getInstancePtr());
    9999
    100             guiKeysOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiKeysOnly");
     100            guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly");
    101101            guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr());
    102102
  • code/branches/core4/src/orxonox/gamestates/GSLevel.h

    r3245 r3274  
    6363
    6464        KeyBinder*            keyBinder_;               //!< tool that loads and manages the input bindings
    65         SimpleInputState*     gameInputState_;          //!< input state for normal ingame playing
    66         SimpleInputState*     guiMouseOnlyInputState_;  //!< input state if we only need the mouse to use the GUI
    67         SimpleInputState*     guiKeysOnlyInputState_;   //!< input state if we only need the keys to use the GUI
     65        InputState*           gameInputState_;          //!< input state for normal ingame playing
     66        InputState*           guiMouseOnlyInputState_;  //!< input state if we only need the mouse to use the GUI
     67        InputState*           guiKeysOnlyInputState_;   //!< input state if we only need the keys to use the GUI
    6868        Radar*                radar_;                   //!< represents the Radar (not the HUD part)
    6969        CameraManager*        cameraManager_;           //!< camera manager for this level
  • code/branches/core4/src/orxonox/gamestates/GSMainMenu.cc

    r3245 r3274  
    3232
    3333#include "core/input/InputManager.h"
    34 #include "core/input/SimpleInputState.h"
     34#include "core/input/InputState.h"
    3535#include "core/Game.h"
    3636#include "core/Clock.h"
     
    5757    void GSMainMenu::activate()
    5858    {
    59         inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("mainMenu");
     59        inputState_ = InputManager::getInstance().createInputState("mainMenu");
    6060        inputState_->setHandler(GUIManager::getInstancePtr());
    61         inputState_->setJoyStickHandler(&InputManager::EMPTY_HANDLER);
     61        inputState_->setJoyStickHandler(&InputHandler::EMPTY);
    6262
    6363        // create an empty Scene
  • code/branches/core4/src/orxonox/gamestates/GSMainMenu.h

    r3243 r3274  
    5353
    5454    private:
    55         SimpleInputState* inputState_;
     55        InputState*      inputState_;
    5656        Scene*            scene_;
    5757        Ogre::Camera*     camera_;
Note: See TracChangeset for help on using the changeset viewer.