From 42a09f00b336ce3405ff7558719f07e6f15326aa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 9 Sep 2012 00:12:27 +1000 Subject: [PATCH] HOPKINS: Implemented screen lock, unlock, and clear screen --- engines/hopkins/graphics.cpp | 26 ++++++++++++++++++++++++-- engines/hopkins/graphics.h | 6 ++++++ engines/hopkins/hopkins.cpp | 8 ++++---- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 7b04e1f1ba2..21c5d6c478e 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -21,6 +21,7 @@ */ #include "common/system.h" +#include "common/rect.h" #include "engines/util.h" #include "hopkins/files.h" #include "hopkins/globals.h" @@ -161,10 +162,16 @@ int ObjectManager::AJOUTE_OBJET(int objIndex) { return arrIndex; } +/*------------------------------------------------------------------------*/ + GraphicsManager::GraphicsManager() { SDL_MODEYES = false; } +GraphicsManager::~GraphicsManager() { +} + + void GraphicsManager::SET_MODE(int width, int height) { if (!SDL_MODEYES) { SDL_ECHELLE = 0; @@ -192,13 +199,14 @@ void GraphicsManager::SET_MODE(int width, int height) { //height = Reel_Zoom(a2, SDL_ECHELLE); } - if (bpp == 8) + if (bpp == 8) { initGraphics(width, height, true); - else { + } else { Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); initGraphics(width, height, true, &pixelFormat); } + VideoPtr = NULL; XSCREEN = width; YSCREEN = height; @@ -219,4 +227,18 @@ void GraphicsManager::SET_MODE(int width, int height) { } } +void GraphicsManager::DD_Lock() { + VideoPtr = g_system->lockScreen(); +} + +void GraphicsManager::DD_Unlock() { + g_system->unlockScreen(); +} + +void GraphicsManager::Cls_Video() { + assert(VideoPtr); + + VideoPtr->fillRect(Common::Rect(0, 0, XSCREEN, YSCREEN), 0); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index de80160dda6..18cb44254e5 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/endian.h" #include "common/str.h" +#include "graphics/surface.h" namespace Hopkins { @@ -63,10 +64,15 @@ public: int nbrligne; RGB8 cmap[256]; bool Linear; + Graphics::Surface *VideoPtr; public: GraphicsManager(); + ~GraphicsManager(); void SET_MODE(int width, int height); + void DD_Lock(); + void DD_Unlock(); + void Cls_Video(); }; } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 342d7d2361f..af8cd668ef3 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -66,10 +66,10 @@ Common::Error HopkinsEngine::run() { GLOBALS.HELICO = 0; _mouse.hideCursor(); - /* - DD_Lock(); - Cls_Video(); - DD_Unlock(); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + /* LOAD_IMAGE("LINUX"); FADE_INW(); SDL_Delay(1500);