Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 6, 2008, 12:31:32 AM (16 years ago)
Author:
rgrieder
Message:

FIRST THINGS FIRST: Delete or rename your keybindings.ini (def_keybindings.ini already has the most important bindings) or else you won't be able to do anything!

Changes:

  • Multiple joy stick support should now fully work with KeyBinder too (only tested with 0/1 joystick)
  • Reloading the OIS Devices now works with KeyBinder too
  • Modified ConfigValueContainer to accept arbitrary section names
  • added tkeybind to temporary bind a command to a key
  • Fixed dlleport issue in ArgumentCompletionFunctions.h

Internal changes:

  • General cleanup in initialisation of KeyBinder
  • All names of keys/buttons/axes are now statically saved in InputInterfaces.h
  • Move a magic value in KeyBinder to a configValue (MouseWheelStepSize_)
  • Separated ConfigValues from Keybinding ConfigValueContainer in KeyBinder (looks much nicer now ;))
  • Moved some performance critical small function to the inline section
  • Removed the ugly keybind function construct from the InputManager
  • More 'harmonising' work in KeyBinder
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/input/SimpleInputState.cc

    r1881 r1887  
    3535#include "SimpleInputState.h"
    3636
    37 #include <assert.h>
    38 #include "util/Debug.h"
    39 #include "core/Executor.h"
    40 
    4137namespace orxonox
    4238{
    43     using namespace InputDevice;
    44 
    4539    SimpleInputState::SimpleInputState()
    4640        : keyHandler_(0)
     
    7064        if (keyHandler_)
    7165            keyHandler_->keyPressed(evt);
    72     }
    73 
    74     void SimpleInputState::keyReleased(const KeyEvent& evt)
    75     {
    76         if (keyHandler_)
    77             keyHandler_->keyReleased(evt);
    78     }
    79 
    80     void SimpleInputState::keyHeld(const KeyEvent& evt)
    81     {
    82         if (keyHandler_)
    83             keyHandler_->keyHeld(evt);
    84     }
    85 
    86 
    87     void SimpleInputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
    88     {
    89         if (mouseHandler_)
    90             mouseHandler_->mouseMoved(abs, rel, clippingSize);
    91     }
    92 
    93     void SimpleInputState::mouseScrolled(int abs, int rel)
    94     {
    95         if (mouseHandler_)
    96             mouseHandler_->mouseScrolled(abs, rel);
    97     }
    98 
    99     void SimpleInputState::mouseButtonPressed(MouseButton::Enum id)
    100     {
    101         if (mouseHandler_)
    102             mouseHandler_->mouseButtonPressed(id);
    103     }
    104 
    105     void SimpleInputState::mouseButtonReleased(MouseButton::Enum id)
    106     {
    107         if (mouseHandler_)
    108             mouseHandler_->mouseButtonReleased(id);
    109     }
    110 
    111     void SimpleInputState::mouseButtonHeld(MouseButton::Enum id)
    112     {
    113         if (mouseHandler_)
    114             mouseHandler_->mouseButtonHeld(id);
    115     }
    116 
    117 
    118     void SimpleInputState::joyStickAxisMoved(unsigned int joyStickID, unsigned int axis, float value)
    119     {
    120         assert(joyStickID < joyStickHandler_.size());
    121         if (joyStickHandler_[joyStickID])
    122             joyStickHandler_[joyStickID]->joyStickAxisMoved(joyStickID, axis, value);
    123     }
    124 
    125     void SimpleInputState::joyStickButtonPressed(unsigned int joyStickID, JoyStickButton::Enum id)
    126     {
    127         assert(joyStickID < joyStickHandler_.size());
    128         if (joyStickHandler_[joyStickID])
    129             joyStickHandler_[joyStickID]->joyStickButtonPressed(joyStickID, id);
    130     }
    131 
    132     void SimpleInputState::joyStickButtonReleased(unsigned int joyStickID, JoyStickButton::Enum id)
    133     {
    134         assert(joyStickID < joyStickHandler_.size());
    135         if (joyStickHandler_[joyStickID])
    136             joyStickHandler_[joyStickID]->joyStickButtonReleased(joyStickID, id);
    137     }
    138 
    139     void SimpleInputState::joyStickButtonHeld(unsigned int joyStickID, JoyStickButton::Enum id)
    140     {
    141         assert(joyStickID < joyStickHandler_.size());
    142         if (joyStickHandler_[joyStickID])
    143             joyStickHandler_[joyStickID]->joyStickButtonHeld(joyStickID, id);
    14466    }
    14567
     
    199121    }
    200122
    201     void SimpleInputState::tickInput(float dt)
    202     {
    203         for (unsigned int i = 0; i < allHandlers_.size(); ++i)
    204         {
    205             allHandlers_[i]->tickInput(dt);
    206         }
    207     }
    208 
    209     void SimpleInputState::tickInput(float dt, unsigned int device)
    210     {
    211         switch (device)
    212         {
    213         case Keyboard:
    214             if (keyHandler_)
    215                 keyHandler_->tickKey(dt);
    216             break;
    217 
    218         case Mouse:
    219             if (mouseHandler_)
    220                 mouseHandler_->tickMouse(dt);
    221             break;
    222 
    223         default: // joy sticks
    224             if (joyStickHandler_[device - 2])
    225                 joyStickHandler_[device - 2]->tickJoyStick(dt, device - 2);
    226             break;
    227         }
    228     }
    229 
    230123    void SimpleInputState::update()
    231124    {
     
    247140
    248141        // update the deviceEnabled options
    249         setInputDeviceEnabled(Keyboard, (keyHandler_ != 0));
    250         setInputDeviceEnabled(Mouse, (mouseHandler_ != 0));
     142        setInputDeviceEnabled(InputDevice::Keyboard, (keyHandler_ != 0));
     143        setInputDeviceEnabled(InputDevice::Mouse, (mouseHandler_ != 0));
    251144        for (unsigned int i = 0; i < joyStickHandler_.size(); ++i)
    252145            setInputDeviceEnabled(2 + i, (joyStickHandler_[i] != 0));
Note: See TracChangeset for help on using the changeset viewer.