aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-26 18:23:49 +0200
committerEugene Sandulenko2016-08-26 18:39:47 +0200
commitb7570373dd2d6c5a96fc8eed8302e4b5a0d80cdf (patch)
treea6aa8132c17dbfde7a89b198d06b93965719f606 /engines
parent8a372eaf7169a67af984380e0204808da4feeee4 (diff)
downloadscummvm-rg350-b7570373dd2d6c5a96fc8eed8302e4b5a0d80cdf.tar.gz
scummvm-rg350-b7570373dd2d6c5a96fc8eed8302e4b5a0d80cdf.tar.bz2
scummvm-rg350-b7570373dd2d6c5a96fc8eed8302e4b5a0d80cdf.zip
DIRECTOR: Reworked event loop, so the mouse is more responsive
Diffstat (limited to 'engines')
-rw-r--r--engines/director/score.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9dd8cd8ba2..8a252a26ed 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -738,9 +738,6 @@ void Score::startLoop() {
debugC(1, kDebugImages, "Current frame: %d", _currentFrame);
update();
processEvents();
-
- g_system->updateScreen();
- g_system->delayMillis(200);
}
}
@@ -797,13 +794,11 @@ void Score::update() {
//Wait for sound channel 1
while (_soundManager->isChannelActive(1)) {
processEvents();
- g_system->delayMillis(10);
}
} else if (tempo == 134) {
//Wait for sound channel 2
while (_soundManager->isChannelActive(2)) {
processEvents();
- g_system->delayMillis(10);
}
}
}
@@ -816,22 +811,29 @@ void Score::processEvents() {
Common::Event event;
- while (g_system->getEventManager()->pollEvent(event)) {
- if (event.type == Common::EVENT_QUIT)
- _stopPlay = true;
+ int endTime = g_system->getMillis() + 200;
- if (event.type == Common::EVENT_LBUTTONDOWN) {
- Common::Point pos = g_system->getEventManager()->getMousePos();
+ while (g_system->getMillis() < endTime) {
+ while (g_system->getEventManager()->pollEvent(event)) {
+ if (event.type == Common::EVENT_QUIT)
+ _stopPlay = true;
- //TODO there is dont send frame id
- _lingo->processEvent(kEventMouseDown, _frames[_currentFrame]->getSpriteIDFromPos(pos));
- }
+ if (event.type == Common::EVENT_LBUTTONDOWN) {
+ Common::Point pos = g_system->getEventManager()->getMousePos();
+
+ //TODO there is dont send frame id
+ _lingo->processEvent(kEventMouseDown, _frames[_currentFrame]->getSpriteIDFromPos(pos));
+ }
- if (event.type == Common::EVENT_LBUTTONUP) {
- Common::Point pos = g_system->getEventManager()->getMousePos();
+ if (event.type == Common::EVENT_LBUTTONUP) {
+ Common::Point pos = g_system->getEventManager()->getMousePos();
- _lingo->processEvent(kEventMouseUp, _frames[_currentFrame]->getSpriteIDFromPos(pos));
+ _lingo->processEvent(kEventMouseUp, _frames[_currentFrame]->getSpriteIDFromPos(pos));
+ }
}
+
+ g_system->updateScreen();
+ g_system->delayMillis(10);
}
}