Added access property for middle mouse button

svn-id: r30069
This commit is contained in:
Paul Gilbert 2007-12-29 09:50:20 +00:00
parent 806ac51e45
commit 59b5655266
2 changed files with 13 additions and 2 deletions

View file

@ -44,6 +44,7 @@ Mouse::Mouse() {
_lButton = false;
_rButton = false;
_mButton = false;
_cursorNum = CURSOR_ARROW;
_x = 0;
_y = 0;
@ -70,6 +71,12 @@ void Mouse::handleEvent(Common::Event event) {
case Common::EVENT_RBUTTONUP:
_rButton = false;
break;
case Common::EVENT_MBUTTONDOWN:
_mButton = true;
break;
case Common::EVENT_MBUTTONUP:
_mButton = false;
break;
default:
break;
}
@ -134,7 +141,7 @@ void Mouse::waitForRelease() {
do {
while (e.pollEvent() && !e.quitFlag) ;
g_system->delayMillis(20);
} while (!e.quitFlag && (lButton() || rButton()));
} while (!e.quitFlag && (lButton() || rButton() || mButton()));
}
/*--------------------------------------------------------------------------*/
@ -164,6 +171,8 @@ bool Events::pollEvent() {
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONDOWN:
case Common::EVENT_RBUTTONUP:
case Common::EVENT_MBUTTONDOWN:
case Common::EVENT_MBUTTONUP:
case Common::EVENT_MOUSEMOVE:
case Common::EVENT_WHEELUP:
case Common::EVENT_WHEELDOWN:
@ -184,6 +193,7 @@ void Events::waitForPress() {
if (_event.type == Common::EVENT_QUIT) return;
else if (_event.type == Common::EVENT_KEYDOWN) keyButton = true;
else if ((_event.type == Common::EVENT_LBUTTONDOWN) ||
(_event.type == Common::EVENT_MBUTTONDOWN) ||
(_event.type == Common::EVENT_RBUTTONDOWN)) {
keyButton = true;
Mouse::getReference().waitForRelease();

View file

@ -38,7 +38,7 @@ class Mouse {
private:
CursorType _cursorNum;
int16 _x, _y;
bool _lButton, _rButton;
bool _lButton, _rButton, _mButton;
public:
Mouse();
~Mouse();
@ -55,6 +55,7 @@ public:
int16 y() { return _y; }
bool lButton() { return _lButton; }
bool rButton() { return _rButton; }
bool mButton() { return _mButton; }
void waitForRelease();
void pushCursorNum(CursorType cursorNum);
void pushCursorNum(CursorType cursorNum, int hotspotX, int hotspotY);