Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2008, 6:26:15 PM (17 years ago)
Author:
rgrieder
Message:
  • added scroll wheel support
  • improved mouse input handling
  • added support for mouse input derivation (allows to use the track stick like a joy stick)

About the new key binder in general:
You can assign any button/key/axis any combination of command strings the way you want.
When using simple commands (shortcuts) without parameters depending on the input, there are 3 keybind modes: OnPress, OnRelease and OnHold. For the case you assign such a command to a mouse/joystick axis, the input is translated to switch-like behavior (can be configured by feeding ButtonThreshold argument as ONE key binding).
With parameter controlled commands, keys are simply 1 or 0, axis are of course continuous. There are two ways a command can expect a value: relative or absolute input. For instance the joystick axis state (-1 to 1) is an absolute value, mouse movement is relative. Once again, everything is translated in the right way.
There's a lot more to explain, but I guess I'm gonna write a wiki page for that…

one last note: I haven't yet changed the way input is handled in the space ship. I shall do that after the merge tomorrow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/core/InputHandler.h

    r1340 r1344  
    6060    BufferedParamCommand() : value_(0.0f), nValuesAdded_(0), paramIndex_(-1) { }
    6161    bool execute();
     62
    6263    float value_;
    6364    unsigned int nValuesAdded_;
     
    9394    virtual bool addParamCommand(ParamCommand* command) { return false; }
    9495    void parse(std::vector<BufferedParamCommand*>& paramCommandBuffer);
    95     bool execute(KeybindMode::Enum mode);
     96    bool execute(KeybindMode::Enum mode, float abs = 1.0f, float rel = 1.0f);
    9697
    9798    //! The configured string value
     
    114115    HalfAxis() : relVal_(0.0f), absVal_(0.0f), paramCommands_(0), nParamCommands_(0),
    115116                 wasDown_(false), hasChanged_(false) { }
     117    using Button::execute;
    116118    bool execute();
    117     bool execute(KeybindMode::Enum mode) { return Button::execute(mode); }
     119    //bool execute(KeybindMode::Enum mode) { return Button::execute(mode); }
    118120    bool addParamCommand(ParamCommand* command);
    119121    void clear();
     
    176178
    177179    //! denotes the number of different mouse buttons there are in OIS.
    178     static const unsigned int nMouseButtons_s = 8;
     180    static const unsigned int nMouseButtons_s = 8 + 2*2; // 8 buttons and 2 scroll wheels
    179181    //! Actual key bindings as bundle for Press, Hold and Release
    180182    Button mouseButtons_ [nMouseButtons_s];
     
    193195    * Sequence is as follows:
    194196    *  0 -  3: Mouse x and y
    195     *  4 -  7: Mouse scroll wheels 1 and 2 (2 not yet supported)
     197    *  4 -  7: empty
    196198    *  8 - 23: joy stick (slider) axes 1 to 8
    197199    * 24 - 55: joy stick axes 1 - 16
     
    205207    std::vector<BufferedParamCommand*> paramCommandBuffer_;
    206208
     209    //! Keeps track of the absolute mouse value (incl. scroll wheel)
     210    int mousePosition_[3];
     211    //! Used to derive mouse input if requested
     212    int mouseRelative_[2];
     213    float deriveTime_;
     214
     215    //**** ConfigValues *****\\
    207216    //! Threshold for analog triggers until which the state is 0.
    208217    float analogThreshold_;
    209218    //! Threshold for analog triggers until which the button is not pressed.
    210219    float buttonThreshold_;
     220    //! Derive mouse input for absolute values?
     221    bool bDeriveMouseInput_;
     222    //! Accuracy of the mouse input deriver. The higher the more precise, but laggier.
     223    float derivePeriod_;
     224    //! mouse sensitivity
     225    float mouseSensitivity_;
    211226  };
    212227
Note: See TracChangeset for help on using the changeset viewer.