Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 13, 2009, 8:54:43 PM (16 years ago)
Author:
rgrieder
Message:

Added and adjusted documentation for the devices.
Also removed one last ugliness where the InputManager was called from within a device (which should not even know about the InputManager).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core4/src/core/input/JoyStick.cc

    r3274 r3286  
    3030
    3131#include <ois/OISJoyStick.h>
    32 #include <ois/OISInputManager.h>
    3332#include <boost/foreach.hpp>
    3433
     
    3837#include "util/Convert.h"
    3938#include "InputState.h"
    40 #include "InputManager.h"
    4139
    4240namespace orxonox
    4341{
    44     /**
    45     @brief
    46         Helper function that loads the config value vector of one coefficient
    47     */
     42    //! Helper function that loads the config value vector of one coefficient
    4843    void loadCalibration(std::vector<int>& list, const std::string& sectionName, const std::string& valueName, size_t size, int defaultValue);
    4944
    50     JoyStick::JoyStick(unsigned int id)
    51         : super(id)
     45    std::vector<std::string> JoyStick::idStrings_s;
     46
     47    JoyStick::JoyStick(unsigned int id, OIS::InputManager* oisInputManager)
     48        : super(id, oisInputManager)
    5249    {
    5350        RegisterRootObject(JoyStick);
     
    6663        //idString_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Vector3));
    6764
    68         if (InputManager::getInstance().checkJoyStickID(idString_) == false)
    69         {
    70             // Make the ID unique for this execution time.
    71             idString_ += "_" + multi_cast<std::string>(this->getDeviceID());
     65
     66        BOOST_FOREACH(std::string& idString, idStrings_s)
     67        {
     68            if (idString_ == idString)
     69            {
     70                // Make the ID unique for this execution time.
     71                idString_ += "_" + multi_cast<std::string>(this->getDeviceID());
     72                break;
     73            }
    7274        }
    7375
     
    8284    }
    8385
    84     //!< Callback for the joy stick calibration config file.
     86    //! Callback for the joy stick calibration config file.
    8587    void JoyStick::calibrationFileCallback()
    8688    {
     
    173175    }
    174176
    175     // TODO: What do we really need to reset here?
     177    //! Resets the pov states
    176178    void JoyStick::clearBuffersImpl()
    177179    {
    178180        for (int j = 0; j < 4; ++j)
    179         {
    180181            povStates_[j] = 0;
    181             sliderStates_[j][0] = 0;
    182             sliderStates_[j][1] = 0;
    183         }
    184182    }
    185183
Note: See TracChangeset for help on using the changeset viewer.