aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/macventure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/macventure/macventure.cpp')
-rw-r--r--engines/macventure/macventure.cpp58
1 files changed, 5 insertions, 53 deletions
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index be949ec00a..ef47d93f1a 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -25,10 +25,6 @@
#include "common/debug.h"
#include "common/error.h"
-// For border loading, should be gone later
-#include "common/file.h"
-#include "image/bmp.h"
-
#include "engines/util.h"
#include "macventure/macventure.h"
@@ -50,22 +46,21 @@ MacVentureEngine::~MacVentureEngine() {
DebugMan.clearAllDebugChannels();
delete _rnd;
delete _debugger;
+ delete _gui;
}
Common::Error MacVentureEngine::run() {
debug("MacVenture::MacVentureEngine::init()");
- initGraphics(kScreenWidth, kScreenHeight, true);
+ initGraphics(kScreenWidth, kScreenHeight, true);
_debugger = new Console(this);
// Additional setup.
debug("MacVentureEngine::init");
- _screen.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
+ _gui = new Gui();
- initGUI();
-
// Your main even loop should be (invoked from) here.
debug("MacVentureEngine::go: Hello, World!");
@@ -73,7 +68,7 @@ Common::Error MacVentureEngine::run() {
while (!_shouldQuit) {
processEvents();
- _wm->draw();
+ _gui->draw();
g_system->updateScreen();
g_system->delayMillis(50);
@@ -90,52 +85,9 @@ void MacVentureEngine::processEvents() {
case Common::EVENT_QUIT:
_shouldQuit = true;
break;
- default:
+ default:
break;
}
}
}
-
-void MacVentureEngine::initGUI() {
- _wm = new Graphics::MacWindowManager();
- _wm->setScreen(&_screen);
- Graphics::MacWindow *w = _wm->addWindow(false, true, true);
- w->setDimensions(Common::Rect(100, 100));
- w->setActive(false);
-
- loadBorder(w, "border_inac.bmp", false);
-
-}
-
-void MacVentureEngine::loadBorder(Graphics::MacWindow *target, Common::String filename, bool active) {
- Common::File borderfile;
-
- if (!borderfile.open(filename)) {
- debug(1, "Cannot open border file");
- return;
- }
-
- Image::BitmapDecoder bmpDecoder;
- Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size());
- Graphics::Surface source;
- Graphics::TransparentSurface *surface = new Graphics::TransparentSurface();
-
- if (stream) {
- debug(4, "Loading %s border from %s", (active ? "active" : "inactive"), filename);
- bmpDecoder.loadStream(*stream);
- source = *(bmpDecoder.getSurface());
-
- source.convertToInPlace(surface->getSupportedPixelFormat(), bmpDecoder.getPalette());
- surface->create(source.w, source.h, source.format);
- surface->copyFrom(source);
- surface->applyColorKey(255, 0, 255, false);
-
- target->setBorder(*surface, active);
-
- borderfile.close();
-
- delete stream;
- }
-}
-
} // End of namespace MacVenture