Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 4, 2014, 9:48:04 PM (10 years ago)
Author:
landauf
Message:

added new keybind mode 'OnPressAndRelease' which triggers both when a button is pressed and when it's released.
pressed buttons send the value '1' to the bound console command, while released buttons send the value '0'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/input/KeyBinder.h

    r7861 r9978  
    195195
    196196    inline void KeyBinder::buttonPressed (const KeyEvent& evt)
    197     { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnPress); }
     197    { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnPress, 1); }
    198198
    199199    inline void KeyBinder::buttonReleased(const KeyEvent& evt)
    200     { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnRelease); }
     200    { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnRelease, 0); }
    201201
    202202    inline void KeyBinder::buttonHeld    (const KeyEvent& evt)
     
    205205
    206206    inline void KeyBinder::buttonPressed (MouseButtonCode::ByEnum button)
    207     { mouseButtons_[button].execute(KeybindMode::OnPress); }
     207    { mouseButtons_[button].execute(KeybindMode::OnPress, 1); }
    208208
    209209    inline void KeyBinder::buttonReleased(MouseButtonCode::ByEnum button)
    210     { mouseButtons_[button].execute(KeybindMode::OnRelease); }
     210    { mouseButtons_[button].execute(KeybindMode::OnRelease, 0); }
    211211
    212212    inline void KeyBinder::buttonHeld    (MouseButtonCode::ByEnum button)
     
    215215
    216216    inline void KeyBinder::buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button)
    217     { (*joyStickButtons_[device])[button].execute(KeybindMode::OnPress); }
     217    { (*joyStickButtons_[device])[button].execute(KeybindMode::OnPress, 1); }
    218218
    219219    inline void KeyBinder::buttonReleased(unsigned int device, JoyStickButtonCode::ByEnum button)
    220     { (*joyStickButtons_[device])[button].execute(KeybindMode::OnRelease); }
     220    { (*joyStickButtons_[device])[button].execute(KeybindMode::OnRelease, 0); }
    221221
    222222    inline void KeyBinder::buttonHeld    (unsigned int device, JoyStickButtonCode::ByEnum button)
Note: See TracChangeset for help on using the changeset viewer.