aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/macventure/detection.cpp4
-rw-r--r--engines/macventure/gui.cpp62
-rw-r--r--engines/macventure/gui.h56
-rw-r--r--engines/macventure/macventure.cpp58
-rw-r--r--engines/macventure/macventure.h10
-rw-r--r--engines/macventure/module.mk1
6 files changed, 131 insertions, 60 deletions
diff --git a/engines/macventure/detection.cpp b/engines/macventure/detection.cpp
index feaf60d7c2..ade07a0853 100644
--- a/engines/macventure/detection.cpp
+++ b/engines/macventure/detection.cpp
@@ -27,6 +27,8 @@
#include "macventure/macventure.h"
+#include "macventure.h"
+
namespace MacVenture {
#include "macventure/detection_tables.h"
@@ -37,7 +39,7 @@ static const PlainGameDescriptor macventureGames[] = {
};
class MacVentureMetaEngine : public AdvancedMetaEngine {
-public:
+public:
MacVentureMetaEngine() : AdvancedMetaEngine(MacVenture::gameDescriptions, sizeof(ADGameDescription), macventureGames) {
_guiOptions = GUIO0();
_md5Bytes = 5000000; // TODO: Upper limit, adjust it once all games are added
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
new file mode 100644
index 0000000000..22e0faa515
--- /dev/null
+++ b/engines/macventure/gui.cpp
@@ -0,0 +1,62 @@
+
+#include "macventure/macventure.h"
+
+#include "common/file.h"
+#include "image/bmp.h"
+
+namespace MacVenture {
+
+Gui::Gui() {
+ initGUI();
+}
+
+Gui::~Gui() {
+
+}
+
+void Gui::draw() {
+ _wm.draw();
+}
+
+void Gui::initGUI() {
+ _screen.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
+ _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 Gui::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
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
new file mode 100644
index 0000000000..0cfb835d38
--- /dev/null
+++ b/engines/macventure/gui.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+#ifndef MACVENTURE_GUI_H
+#define MACVENTURE_GUI_H
+
+#include "graphics/macgui/macwindowmanager.h"
+
+#include "macventure/macventure.h"
+
+namespace MacVenture {
+
+using namespace Graphics::MacGUIConstants;
+
+class Gui {
+
+public:
+ Gui();
+ ~Gui();
+
+ void draw();
+
+private: // Attributes
+
+ Graphics::ManagedSurface _screen;
+ Graphics::MacWindowManager _wm;
+
+private: // Methods
+
+ void initGUI();
+ void loadBorder(Graphics::MacWindow * target, Common::String filename, bool active);
+
+};
+
+} // End of namespace MacVenture
+
+#endif
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
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index cdf50b7e91..5f655b9e59 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -33,6 +33,8 @@
#include "gui/debugger.h"
+#include "macventure/gui.h"
+
struct ADGameDescription;
namespace MacVenture {
@@ -61,18 +63,14 @@ public:
private:
void processEvents();
-
- void initGUI();
- void loadBorder(Graphics::MacWindow * target, Common::String filename, bool active);
-
+
private:
const ADGameDescription *_gameDescription;
Common::RandomSource *_rnd;
Console *_debugger;
- Graphics::MacWindowManager *_wm;
- Graphics::ManagedSurface _screen;
+ Gui *_gui;
bool _shouldQuit;
};
diff --git a/engines/macventure/module.mk b/engines/macventure/module.mk
index 839cbb4587..3f11d15856 100644
--- a/engines/macventure/module.mk
+++ b/engines/macventure/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/macventure
MODULE_OBJS := \
detection.o \
+ gui.o \
macventure.o
MODULE_DIRS += \