Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 19, 2009, 5:31:02 PM (15 years ago)
Author:
rgrieder
Message:

Merged all remaining revisions from core4 back to the trunk.

Location:
code/trunk
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/core/input/Mouse.h

    r3276 r3327  
    3131
    3232#include "InputPrereqs.h"
     33
    3334#include "InputDevice.h"
     35#include "core/WindowEventListener.h"
    3436
    3537namespace orxonox
    3638{
     39    //! Template parameter collection for the base class
     40    struct MouseTraits
     41    {
     42        typedef Mouse DeviceClass;
     43        typedef OIS::Mouse OISDeviceClass;
     44        typedef MouseButtonCode::ByEnum ButtonType;
     45        typedef MouseButtonCode::ByEnum ButtonTypeParam;
     46        static const OIS::Type OISDeviceValue = OIS::OISMouse;
     47    };
     48
    3749    /**
    3850    @brief
     
    4355        : public InputDeviceTemplated<MouseTraits>
    4456        , public OIS::MouseListener
     57        , public WindowEventListener
    4558    {
    4659        friend class InputDeviceTemplated<MouseTraits>;
     
    4962
    5063    public:
    51         Mouse(unsigned int id, unsigned int windowWidth, unsigned int windowHeight);
     64        //! Only sets the clipping size. Initialising is done in the base class.
     65        Mouse(unsigned int id, OIS::InputManager* oisInputManager);
    5266        ~Mouse() { }
    5367
    54         /**
    55         @brief
    56             Adjusts the mouse window metrics.
    57 
    58             This method has to be called every time the size of the window changes.
    59         */
    60         void setMouseClipping(unsigned int width, unsigned int height);
    61         unsigned int getClippingWidth() const;
    62         unsigned int getClippingHeight() const;
    63 
    64         // HACK!
    65         static void setMouseClipping_s(unsigned int width, unsigned int height)
    66             { instancePointer_s->setMouseClipping(width, height); }
    67         void setConfigValues() { }
    6868#ifdef ORXONOX_PLATFORM_LINUX
    69         // HACK!
    70         static void grabMouse();
    71         static void ungrabMouse();
     69        // TODO: Make this a feature rather than a hack
     70        void grab();
     71        void ungrab();
    7272#endif
    7373
    7474    private:
    75         // TODO: Do we need to reset the mouse position?
    76         void clearBuffersImpl() { }
    77 
    7875        //! OIS event handler
    7976        bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
     
    9289        bool mouseMoved(const OIS::MouseEvent &arg);
    9390
    94         // HACK:
    95         static Mouse* instancePointer_s;
     91        void windowResized(unsigned int newWidth, unsigned int newHeight);
     92
     93        // Returns the class name as string
     94        static std::string getClassNameImpl() { return "Mouse"; }
    9695    };
    9796}
Note: See TracChangeset for help on using the changeset viewer.