Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 12, 2011, 11:54:07 AM (14 years ago)
Author:
landauf
Message:

added function to KeyBinder which allows to change the keybind mode (OnPress, OnRelease, OnHold) of a command which is bound to a key.
enhanced ConsoleCommand (+Manipulator) to use this feature.

input system experts, please review :D

Location:
code/trunk/src/libraries/core/command
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/command/ConsoleCommand.cc

    r7401 r7861  
    3838#include "core/Language.h"
    3939#include "core/GameMode.h"
     40#include "core/input/KeyBinder.h"
     41#include "core/input/KeyBinderManager.h"
    4042
    4143namespace orxonox
     
    575577
    576578    /**
     579        @brief Changes the keybind mode.
     580    */
     581    ConsoleCommand& ConsoleCommand::changeKeybindMode(KeybindMode::Value mode)
     582    {
     583        KeyBinderManager::getInstance().getCurrent()->changeMode(this, mode);
     584
     585        this->keybindMode(mode);
     586        return *this;
     587    }
     588
     589    /**
    577590        @brief Returns the command with given group an name.
    578591        @param group The group of the requested command
  • code/trunk/src/libraries/core/command/ConsoleCommand.h

    r7401 r7861  
    510510                    /// Changes the keybind mode of the command.
    511511                    inline ConsoleCommandManipulator& keybindMode(KeybindMode::Value mode)
    512                         { if (this->command_) { this->command_->keybindMode(mode); } return *this; }
     512                        { if (this->command_) { this->command_->changeKeybindMode(mode); } return *this; }
    513513                    /// Sets the input configured param to the given index.
    514514                    inline ConsoleCommandManipulator& inputConfiguredParam(int index)
     
    598598            }
    599599
    600             /// Changes the keybind mode.
     600            /// Sets the keybind mode. Note: use changeKeybindMode if you intend to change the mode.
    601601            inline ConsoleCommand& keybindMode(KeybindMode::Value mode)
    602602                { this->keybindMode_ = mode; return *this; }
     
    604604            inline KeybindMode::Value getKeybindMode() const
    605605                { return this->keybindMode_; }
     606
     607            ConsoleCommand& changeKeybindMode(KeybindMode::Value mode);
    606608
    607609            /// Changes the input configured param to the given index.
Note: See TracChangeset for help on using the changeset viewer.