aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreriktorbjorn2011-06-12 20:41:30 +0200
committerAlyssa Milburn2011-06-15 17:34:36 +0200
commitde65cf35c10e7b3dcd5eba64c5a922428518f626 (patch)
treeb6c194ee615d4caef965b3568993d6734e1c4098
parentd65083ecaed475f88fac11ff99c72ad8c956ced3 (diff)
downloadscummvm-rg350-de65cf35c10e7b3dcd5eba64c5a922428518f626.tar.gz
scummvm-rg350-de65cf35c10e7b3dcd5eba64c5a922428518f626.tar.bz2
scummvm-rg350-de65cf35c10e7b3dcd5eba64c5a922428518f626.zip
DREAMWEB: Simplify the tracking of the mouse position and buttons
The event manager keeps track of the mouse position and button state, so using that should be both simpler and more reliable than tracking it ourselves. This loses the support for middle-clicking, but it's not clear that this is needed anyway. (If necessary, it could be added to the event manager.)
-rw-r--r--engines/dreamweb/dreamweb.cpp28
-rw-r--r--engines/dreamweb/dreamweb.h2
2 files changed, 3 insertions, 27 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index c72215292b..4fe9b41d97 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -62,7 +62,6 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_vSyncInterrupt = false;
_console = 0;
- _mouseState = 0;
DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Animation Debug Flag");
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
_outSaveFile = 0;
@@ -117,27 +116,6 @@ void DreamWebEngine::processEvents() {
Common::Event event;
while (event_manager->pollEvent(event)) {
switch(event.type) {
- case Common::EVENT_LBUTTONDOWN:
- _mouseState |= 1;
- break;
- case Common::EVENT_LBUTTONUP:
- _mouseState &= ~1;
- break;
- case Common::EVENT_RBUTTONDOWN:
- _mouseState |= 2;
- break;
- case Common::EVENT_RBUTTONUP:
- _mouseState &= ~2;
- break;
- case Common::EVENT_MBUTTONDOWN:
- _mouseState |= 4;
- break;
- case Common::EVENT_MBUTTONUP:
- _mouseState &= ~4;
- break;
- case Common::EVENT_MOUSEMOVE:
- _mouse = event.mouse;
- break;
case Common::EVENT_KEYDOWN:
switch (event.kbd.keycode) {
case Common::KEYCODE_d:
@@ -170,7 +148,6 @@ void DreamWebEngine::processEvents() {
Common::Error DreamWebEngine::run() {
- _mouseState = 0;
_console = new DreamWebConsole(this);
getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this);
@@ -262,7 +239,8 @@ void DreamWebEngine::keyPressed(uint16 ascii) {
void DreamWebEngine::mouseCall() {
processEvents();
- Common::Point pos = _mouse;
+ Common::EventManager *eventMan = _system->getEventManager();
+ Common::Point pos = eventMan->getMousePos();
if (pos.x > 298)
pos.x = 298;
if (pos.x < 15)
@@ -273,7 +251,7 @@ void DreamWebEngine::mouseCall() {
pos.y = 184;
_context.cx = pos.x;
_context.dx = pos.y;
- _context.bx = _mouseState;
+ _context.bx = eventMan->getButtonState();
}
void DreamWebEngine::setGraphicsMode() {
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 455791d2c3..f459d8bcf9 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -105,8 +105,6 @@ private:
const DreamWebGameDescription *_gameDescription;
Common::RandomSource _rnd;
- Common::Point _mouse;
- unsigned _mouseState;
Common::File _file;
Common::OutSaveFile *_outSaveFile;