aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/graphics
diff options
context:
space:
mode:
authorFilippos Karapetis2014-12-26 12:41:36 +0200
committerFilippos Karapetis2014-12-26 12:41:36 +0200
commit5a72eea2bb102bafb6da112ea90ad1f4af11e1f2 (patch)
tree5bf667f3b56fb751f1a9d9bd3ea6ce752cc41c61 /engines/zvision/graphics
parent4258750f5025e471ba682945e3091fdaa50c7bc9 (diff)
downloadscummvm-rg350-5a72eea2bb102bafb6da112ea90ad1f4af11e1f2.tar.gz
scummvm-rg350-5a72eea2bb102bafb6da112ea90ad1f4af11e1f2.tar.bz2
scummvm-rg350-5a72eea2bb102bafb6da112ea90ad1f4af11e1f2.zip
ZVISION: Move some event/rendering code out of the main engine code
Diffstat (limited to 'engines/zvision/graphics')
-rw-r--r--engines/zvision/graphics/render_manager.cpp82
-rw-r--r--engines/zvision/graphics/render_manager.h8
2 files changed, 87 insertions, 3 deletions
diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index 07ed6d2e2b..35e3b89b09 100644
--- a/engines/zvision/graphics/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -39,7 +39,7 @@
namespace ZVision {
-RenderManager::RenderManager(ZVision *engine, uint32 windowWidth, uint32 windowHeight, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat)
+RenderManager::RenderManager(ZVision *engine, uint32 windowWidth, uint32 windowHeight, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat, bool doubleFPS)
: _engine(engine),
_system(engine->_system),
_workingWidth(workingWindow.width()),
@@ -51,7 +51,8 @@ RenderManager::RenderManager(ZVision *engine, uint32 windowWidth, uint32 windowH
_backgroundWidth(0),
_backgroundHeight(0),
_backgroundOffset(0),
- _renderTable(_workingWidth, _workingHeight) {
+ _renderTable(_workingWidth, _workingHeight),
+ _doubleFPS(doubleFPS) {
_backgroundSurface.create(_workingWidth, _workingHeight, _pixelFormat);
_effectSurface.create(_workingWidth, _workingHeight, _pixelFormat);
@@ -1013,4 +1014,81 @@ void RenderManager::bkgFill(uint8 r, uint8 g, uint8 b) {
}
#endif
+void RenderManager::timedMessage(const Common::String &str, uint16 milsecs) {
+ uint16 msgid = createSubArea();
+ updateSubArea(msgid, str);
+ processSubs(0);
+ renderSceneToScreen();
+ deleteSubArea(msgid, milsecs);
+}
+
+bool RenderManager::askQuestion(const Common::String &str) {
+ uint16 msgid = createSubArea();
+ updateSubArea(msgid, str);
+ processSubs(0);
+ renderSceneToScreen();
+ _engine->stopClock();
+
+ int result = 0;
+
+ while (result == 0) {
+ Common::Event evnt;
+ while (_engine->getEventManager()->pollEvent(evnt)) {
+ if (evnt.type == Common::EVENT_KEYDOWN) {
+ switch (evnt.kbd.keycode) {
+ case Common::KEYCODE_y:
+ result = 2;
+ break;
+ case Common::KEYCODE_n:
+ result = 1;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ _system->updateScreen();
+ if (_doubleFPS)
+ _system->delayMillis(33);
+ else
+ _system->delayMillis(66);
+ }
+ deleteSubArea(msgid);
+ _engine->startClock();
+ return result == 2;
+}
+
+void RenderManager::delayedMessage(const Common::String &str, uint16 milsecs) {
+ uint16 msgid = createSubArea();
+ updateSubArea(msgid, str);
+ processSubs(0);
+ renderSceneToScreen();
+ _engine->stopClock();
+
+ uint32 stopTime = _system->getMillis() + milsecs;
+ while (_system->getMillis() < stopTime) {
+ Common::Event evnt;
+ while (_engine->getEventManager()->pollEvent(evnt)) {
+ if (evnt.type == Common::EVENT_KEYDOWN &&
+ (evnt.kbd.keycode == Common::KEYCODE_SPACE ||
+ evnt.kbd.keycode == Common::KEYCODE_RETURN ||
+ evnt.kbd.keycode == Common::KEYCODE_ESCAPE))
+ break;
+ }
+ _system->updateScreen();
+ if (_doubleFPS)
+ _system->delayMillis(33);
+ else
+ _system->delayMillis(66);
+ }
+ deleteSubArea(msgid);
+ _engine->startClock();
+}
+
+void RenderManager::showDebugMsg(const Common::String &msg, int16 delay) {
+ uint16 msgid = createSubArea();
+ updateSubArea(msgid, msg);
+ deleteSubArea(msgid, delay);
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/graphics/render_manager.h b/engines/zvision/graphics/render_manager.h
index d67ae29a3a..dbaa8fdc50 100644
--- a/engines/zvision/graphics/render_manager.h
+++ b/engines/zvision/graphics/render_manager.h
@@ -48,7 +48,7 @@ namespace ZVision {
class RenderManager {
public:
- RenderManager(ZVision *engine, uint32 windowWidth, uint32 windowHeight, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat);
+ RenderManager(ZVision *engine, uint32 windowWidth, uint32 windowHeight, const Common::Rect workingWindow, const Graphics::PixelFormat pixelFormat, bool doubleFPS);
~RenderManager();
private:
@@ -137,6 +137,7 @@ private:
// Visual effects list
EffectsList _effects;
+ bool _doubleFPS;
public:
void initialize();
@@ -334,6 +335,11 @@ public:
// Fill background surface by color
void bkgFill(uint8 r, uint8 g, uint8 b);
#endif
+
+ bool askQuestion(const Common::String &str);
+ void delayedMessage(const Common::String &str, uint16 milsecs);
+ void timedMessage(const Common::String &str, uint16 milsecs);
+ void showDebugMsg(const Common::String &msg, int16 delay = 3000);
};
} // End of namespace ZVision