aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-05-14 19:58:58 -0400
committerPaul Gilbert2018-05-14 19:58:58 -0400
commit0aed2452c659225ff1910610bbcd5ec73cd65eb9 (patch)
treebe67aee2b6b06250187ef73a4f967bb9b8ab815e /engines
parentd5444f2dd751f8a1c74c9ef7687eb6cf1590db59 (diff)
downloadscummvm-rg350-0aed2452c659225ff1910610bbcd5ec73cd65eb9.tar.gz
scummvm-rg350-0aed2452c659225ff1910610bbcd5ec73cd65eb9.tar.bz2
scummvm-rg350-0aed2452c659225ff1910610bbcd5ec73cd65eb9.zip
XEEN: Refresh screen at a higher rate for more responsive mouse
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/events.cpp12
-rw-r--r--engines/xeen/events.h2
2 files changed, 12 insertions, 2 deletions
diff --git a/engines/xeen/events.cpp b/engines/xeen/events.cpp
index 414ba6a26e..17306a32fc 100644
--- a/engines/xeen/events.cpp
+++ b/engines/xeen/events.cpp
@@ -31,8 +31,8 @@
namespace Xeen {
-EventsManager::EventsManager(XeenEngine *vm) : _vm(vm), _playTime(0),
- _frameCounter(0), _priorFrameCounterTime(0), _gameCounter(0),
+EventsManager::EventsManager(XeenEngine *vm) : _vm(vm), _playTime(0), _gameCounter(0),
+ _frameCounter(0), _priorFrameCounterTime(0), _priorScreenRefreshTime(0),
_mousePressed(false), _sprites("mouse.icn") {
Common::fill(&_gameCounters[0], &_gameCounters[6], 0);
}
@@ -62,7 +62,15 @@ bool EventsManager::isCursorVisible() {
void EventsManager::pollEvents() {
uint32 timer = g_system->getMillis();
+
+ if (timer >= (_priorScreenRefreshTime + SCREEN_UPDATE_TIME)) {
+ // Refresh the screen at a higher frame rate than the game's own frame rate
+ // to allow for more responsive mouse movement
+ _priorScreenRefreshTime = timer;
+ g_vm->_screen->update();
+ }
if (timer >= (_priorFrameCounterTime + GAME_FRAME_TIME)) {
+ // Time to build up next game frame
_priorFrameCounterTime = timer;
nextFrame();
}
diff --git a/engines/xeen/events.h b/engines/xeen/events.h
index 6775b95ddf..9913b2fbf1 100644
--- a/engines/xeen/events.h
+++ b/engines/xeen/events.h
@@ -32,6 +32,7 @@ namespace Xeen {
#define GAME_FRAME_RATE (1000 / 50)
#define GAME_FRAME_TIME 50
+#define SCREEN_UPDATE_TIME 10
#define MAX_PENDING_EVENTS 5
class XeenEngine;
@@ -61,6 +62,7 @@ private:
XeenEngine *_vm;
uint32 _frameCounter;
uint32 _priorFrameCounterTime;
+ uint32 _priorScreenRefreshTime;
uint32 _gameCounter;
uint32 _gameCounters[6];
uint32 _playTime;