Mouse.h

Go to the documentation of this file.
00001 
00002 //Luke Lenhart, 2008
00003 //See /docs/License.txt for details on how this code may be used.
00004 
00005 #pragma once
00006 
00007 #include "../base/Setup.h"
00008 
00009 #ifdef MPMA_COMPILE_INPUT
00010 
00011 #include "../base/Types.h"
00012 #include "Unified.h"
00013 
00014 #include <vector>
00015 
00016 namespace INPUT
00017 {
00019     namespace MOUSE
00020     {
00021         const uint8 LEFT_BUTTON=1; 
00022         const uint8 RIGHT_BUTTON=2; 
00023         const uint8 MIDDLE_BUTTON=3; 
00024         const uint8 EXTENDED_BUTTON0=4; 
00025         const uint8 EXTENDED_BUTTON1=5; 
00026         const uint8 EXTENDED_BUTTON2=6; 
00027         const uint8 EXTENDED_BUTTON3=7; 
00028         const uint8 EXTENDED_BUTTON4=8; 
00029         const uint8 EXTENDED_BUTTON5=9; 
00030         const uint8 EXTENDED_BUTTON6=10; 
00031         const uint8 EXTENDED_BUTTON7=11; 
00032         const uint8 EXTENDED_BUTTON8=12; 
00033         const uint8 EXTENDED_BUTTON9=13; 
00034 
00036         inline UnifiedButton GetUnifiedButton(uint8 button)
00037         {
00038             return UnifiedButton(MOUSE_DEVICE, button);
00039         }
00040 
00042         const std::string& GetFriendlyName(uint8 button);
00043 
00045         bool IsButtonDown(uint8 button);
00046 
00048         const std::vector<uint8>& GetCurrentlyPressedButtons();
00049 
00051         const std::vector<uint8>& GetNewlyPressedButtons();
00052 
00054         int GetWheelDirection();
00055 
00057         struct MousePixelPosition
00058         {
00059             sint16 X;
00060             sint16 Y;
00061 
00062             inline bool operator==(const MousePixelPosition &o) const 
00063                 { return X==o.X && Y==o.Y; }
00064             inline bool operator!=(const MousePixelPosition &o) const 
00065                 { return !(*this==o); }
00066         };
00067 
00069         struct MouseScaledPosition
00070         {
00071             float X;
00072             float Y;
00073 
00074             inline bool operator==(const MouseScaledPosition &o) const 
00075                 { return X==o.X && Y==o.Y; }
00076             inline bool operator!=(const MouseScaledPosition &o) const 
00077                 { return !(*this==o); }
00078         };
00079 
00081         MouseScaledPosition GetScaledPosition();
00082 
00084         const std::vector<MouseScaledPosition>& GetScaledTrail();
00085 
00087         MousePixelPosition GetPixelPosition();
00088 
00090         const std::vector<MousePixelPosition>& GetPixelTrail();
00091 
00092         //TODO: Mouse mode (os control in absolute mode, or we capture and provide relative mode data) (we are always absolute for now)
00093         //TODO: Cursor image control
00094     }
00095 }
00096 
00097 #endif //#ifdef MPMA_COMPILE_INPUT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends