aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-09-30 01:14:11 -0400
committerMatthew Hoops2011-09-30 01:14:11 -0400
commit23c7b9f0dc93181a388fb577e26fb9505c8f852f (patch)
tree5d63f145dd63e791ce52336068459726686e715b
parent035cf8a7b34762a7dc59fb7763e600c2718fee00 (diff)
downloadscummvm-rg350-23c7b9f0dc93181a388fb577e26fb9505c8f852f.tar.gz
scummvm-rg350-23c7b9f0dc93181a388fb577e26fb9505c8f852f.tar.bz2
scummvm-rg350-23c7b9f0dc93181a388fb577e26fb9505c8f852f.zip
PEGASUS: Introduce better cursor update code
-rwxr-xr-xengines/pegasus/cursor.cpp4
-rw-r--r--engines/pegasus/graphics.cpp12
-rw-r--r--engines/pegasus/graphics.h6
3 files changed, 13 insertions, 9 deletions
diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp
index 9fa921a48e..ee3ab87268 100755
--- a/engines/pegasus/cursor.cpp
+++ b/engines/pegasus/cursor.cpp
@@ -31,6 +31,7 @@
#include "graphics/surface.h"
#include "pegasus/cursor.h"
+#include "pegasus/graphics.h"
#include "pegasus/pegasus.h"
namespace Pegasus {
@@ -83,6 +84,7 @@ void Cursor::setCurrentFrameIndex(int32 index) {
loadCursorImage(_info[index]);
CursorMan.replaceCursorPalette(_info[index].palette, 0, _info[index].colorCount);
CursorMan.replaceCursor((byte *)_info[index].surface->pixels, _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, 0);
+ ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
}
}
@@ -96,6 +98,7 @@ void Cursor::show() {
CursorMan.showMouse(true);
_cursorObscured = false;
+ ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
void Cursor::hide() {
@@ -115,6 +118,7 @@ void Cursor::useIdleTime() {
_cursorLocation = g_system->getEventManager()->getMousePos();
if (_index != -1 && _cursorObscured)
show();
+ ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
}
diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp
index e0bf6fde5a..8e5c86d7b5 100644
--- a/engines/pegasus/graphics.cpp
+++ b/engines/pegasus/graphics.cpp
@@ -43,7 +43,6 @@ GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) {
_frontLayer = kMaxAvailableOrder;
_firstDisplayElement = _lastDisplayElement = 0;
_workArea.create(640, 480, _vm->_system->getScreenFormat());
- _lastMousePosition = Common::Point(-1, -1);
_modifiedScreen = false;
}
@@ -149,13 +148,6 @@ void GraphicsManager::removeDisplayElement(DisplayElement *oldElement) {
void GraphicsManager::updateDisplay() {
bool screenDirty = false;
- // TODO: Check for cursor change
- Common::Point mousePos = g_system->getEventManager()->getMousePos();
- if (_lastMousePosition != mousePos) {
- screenDirty = true;
- _lastMousePosition = mousePos;
- }
-
if (!_dirtyRect.isEmpty()) {
for (DisplayElement *runner = _firstDisplayElement; runner != 0; runner = runner->_nextElement) {
Common::Rect bounds;
@@ -209,5 +201,9 @@ void GraphicsManager::doFadeOutSync() {
void GraphicsManager::doFadeInSync() {
// TODO
}
+
+void GraphicsManager::markCursorAsDirty() {
+ _modifiedScreen = true;
+}
} // End of namespace Pegasus
diff --git a/engines/pegasus/graphics.h b/engines/pegasus/graphics.h
index 874524304e..7aeb3c9b38 100644
--- a/engines/pegasus/graphics.h
+++ b/engines/pegasus/graphics.h
@@ -37,10 +37,12 @@
namespace Pegasus {
+class Cursor;
class DisplayElement;
class PegasusEngine;
class GraphicsManager {
+friend class Cursor;
public:
GraphicsManager(PegasusEngine *vm);
~GraphicsManager();
@@ -57,6 +59,9 @@ public:
void doFadeOutSync();
void doFadeInSync();
+protected:
+ void markCursorAsDirty();
+
private:
PegasusEngine *_vm;
@@ -65,7 +70,6 @@ private:
tDisplayOrder _backLayer, _frontLayer;
DisplayElement *_firstDisplayElement, *_lastDisplayElement;
Graphics::Surface _workArea;
- Common::Point _lastMousePosition;
};
} // End of namespace Pegasus