Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00038 #ifndef _CE_MOUSE_H_
00039 #define _CE_MOUSE_H_ 0x1
00041 #ifndef CE_WITHOUT_MOUSE
00042
00043 #ifndef __cplusplus
00044 #error ceMouse.h requires C++ compilation (use a .cpp suffix)
00045 #endif
00046
00047 #if __GNUC__ >= 0x3
00048 #pragma GCC system_header
00049 #endif
00050
00051 #if _MSC_VER > 1000
00052 #pragma once
00053 #pragma warning(disable: 4100)
00054 #endif
00055
00056 #include "ceInputDevice.h"
00057 #include "begin_code.h"
00058
00059 namespace ce {
00060
00061
00062
00064 struct DECLSPEC SMouseState
00065 {
00066 unsigned int x;
00067 unsigned int y;
00068 int buffer[0x4];
00069
00073 inline SMouseState(void) : x(0x0), y(0x0)
00074 {
00075 *(this -> buffer + 0x0) = FALSE;
00076 *(this -> buffer + 0x1) = FALSE;
00077 *(this -> buffer + 0x2) = FALSE;
00078 *(this -> buffer + 0x3) = FALSE;
00079 };
00080
00085 inline SMouseState(const SMouseState &State) :
00086 x(State.x), y(State.y)
00087 {
00088 *(this -> buffer + 0x1) = *(State.buffer + 0x1);
00089 *(this -> buffer + 0x2) = *(State.buffer + 0x2);
00090 *(this -> buffer + 0x3) = *(State.buffer + 0x3);
00091 };
00092
00093 const SMouseState& APICALL
00094 operator = (const SMouseState &State)
00095 {
00096 if (this == &State) return *(this);
00097
00098 this -> x = State.x;
00099 this -> y = State.y;
00100
00101 *(this -> buffer + 0x1) = *(State.buffer + 0x1);
00102 *(this -> buffer + 0x2) = *(State.buffer + 0x2);
00103 *(this -> buffer + 0x3) = *(State.buffer + 0x3);
00104
00105 return *(this);
00106 };
00107
00108 const SMouseState* APICALL
00109 operator -> (void) const
00110 { return this; };
00111
00112 };
00113
00114 inline const int APICALL
00115 operator == (const SMouseState &StateA, const SMouseState &StateB)
00116 {
00117 if ((StateA.x != StateB.x) || (StateA.y != StateB.y)) return FALSE;
00118 return ((*(StateA.buffer + 0x1) == *(StateB.buffer + 0x1)) &&
00119 (*(StateA.buffer + 0x2) == *(StateB.buffer + 0x2)) &&
00120 (*(StateA.buffer + 0x3) == *(StateB.buffer + 0x3)));
00121 }
00122
00123 inline const int APICALL
00124 operator != (const SMouseState &StateA, const SMouseState &StateB)
00125 {
00126 if ((StateA.x != StateB.x) || (StateA.y != StateB.y)) return TRUE;
00127 return ((*(StateA.buffer + 0x1) != *(StateB.buffer + 0x1)) ||
00128 (*(StateA.buffer + 0x2) != *(StateB.buffer + 0x2)) ||
00129 (*(StateA.buffer + 0x3) != *(StateB.buffer + 0x3)));
00130 }
00131
00132
00133
00134
00135
00136 class IMouseDevice;
00137
00144 class DECLSPEC IMouseEvent
00145 {
00146 public:
00147
00148 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00149 virtual ~IMouseEvent(void) { };
00150 #endif
00151
00158 virtual void APICALL
00159 OnButtonPressed(const IMouseDevice *Owner,
00160 const int button, const SMouseState &State) = 0;
00161
00168 virtual void APICALL
00169 OnButtonReleased(const IMouseDevice *Owner,
00170 const int button, const SMouseState &State) = 0;
00171
00178 virtual void APICALL
00179 OnMouseEvent(const IMouseDevice *Owner, const SMouseState &State) = 0;
00180
00181 };
00182
00183
00184
00185
00186
00194 class DECLSPEC IMouseDevice : public IInputDevice
00195 {
00196 public:
00197
00198 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00199 virtual ~IMouseDevice(void) { };
00200 #endif
00201
00208 virtual int APICALL
00209 IsButtonPressed(const int button = 0x0) const = 0;
00210
00215 virtual int APICALL
00216 IsLButtonPressed(void) const = 0;
00217
00222 virtual int APICALL
00223 IsRButtonPressed(void) const = 0;
00224
00229 virtual int APICALL
00230 IsMButtonPressed(void) const = 0;
00231
00238 virtual int APICALL
00239 IsButtonReleased(const int button = 0x0) const = 0;
00240
00245 virtual int APICALL
00246 IsLButtonReleased(void) const = 0;
00247
00252 virtual int APICALL
00253 IsRButtonReleased(void) const = 0;
00254
00259 virtual int APICALL
00260 IsMButtonReleased(void) const = 0;
00261
00268 virtual int APICALL
00269 GetPosition(unsigned int *get_x, unsigned int *get_y) const = 0;
00270
00274 virtual unsigned int APICALL
00275 GetXPosition(void) const = 0;
00276
00280 virtual unsigned int APICALL
00281 GetYPosition(void) const = 0;
00282
00286 virtual void APICALL
00287 SetMouseEvent(IMouseEvent *Event) const = 0;
00288
00292 virtual IMouseEvent* APICALL
00293 GetMouseEvent(void) const = 0;
00294
00295 };
00296
00297
00298
00299 }
00300
00301 #include "close_code.h"
00302
00303 #if _MSC_VER > 1000
00304 #pragma warning(default:4100)
00305 #endif
00306
00307 #endif // CE_WITHOUT_MOUSE
00308 #endif // _CE_MOUSE_H_