aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Lorente2016-06-03 20:50:40 +0200
committerBorja Lorente2016-07-31 14:45:37 +0200
commit638e8e99c885722b0ab2d7ee62a7f840ddea1c1a (patch)
tree682d6407dfc0a2242d38c75a076bd46036ba3fe7
parentf642ad1caec00295094fe89ded56a3302bafad2d (diff)
downloadscummvm-rg350-638e8e99c885722b0ab2d7ee62a7f840ddea1c1a.tar.gz
scummvm-rg350-638e8e99c885722b0ab2d7ee62a7f840ddea1c1a.tar.bz2
scummvm-rg350-638e8e99c885722b0ab2d7ee62a7f840ddea1c1a.zip
WAGE: Change GUI Scene to load BMP borders
-rw-r--r--engines/wage/gui.cpp46
-rw-r--r--engines/wage/gui.h4
2 files changed, 20 insertions, 30 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 35a8f28e5f..0f4733364a 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -170,8 +170,7 @@ Gui::Gui(WageEngine *engine) {
_consoleWindow->setCallback(consoleWindowCallback, this);
loadBorders();
- _sceneWindow->setBorder(_activeBorder, true);
- _sceneWindow->setBorder(_inactiveBorder, false);
+
}
Gui::~Gui() {
@@ -367,9 +366,15 @@ void Gui::executeMenuCommand(int action, Common::String &text) {
}
}
-void Gui::loadBorders() {
+void Gui::loadBorders() {
+ loadBorder(_sceneWindow, "border_inac.bmp", false);
+ loadBorder(_sceneWindow, "border_act.bmp", true);
+}
+
+void Gui::loadBorder(Graphics::MacWindow *target, Common::String filename, bool active) {
Common::File borderfile;
- if (!borderfile.open("border_act.bmp")) {
+
+ if (!borderfile.open(filename)) {
debug(1, "Cannot open border file");
return;
}
@@ -377,36 +382,21 @@ void Gui::loadBorders() {
Image::BitmapDecoder bmpDecoder;
Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size());
Graphics::Surface source;
+ Graphics::TransparentSurface *surface = new Graphics::TransparentSurface();
if (stream) {
- bmpDecoder.loadStream(*stream);
+ debug(4, "Loading %s border from %s", (active ? "active" : "inactive"), filename);
+ bmpDecoder.loadStream(*stream);
source = *(bmpDecoder.getSurface());
- _activeBorder = new Graphics::TransparentSurface();
- source.convertToInPlace(_activeBorder->getSupportedPixelFormat(), bmpDecoder.getPalette());
- _activeBorder->create(source.w, source.h, source.format);
- _activeBorder->copyFrom(source);
- _activeBorder->applyColorKey(255, 0, 255, false);
-
- delete stream;
- }
-
- if (!borderfile.open("border_inac.bmp")) {
- debug(1, "Cannot open border file");
- return;
- }
-
- stream = borderfile.readStream(borderfile.size());
+ source.convertToInPlace(surface->getSupportedPixelFormat(), bmpDecoder.getPalette());
+ surface->create(source.w, source.h, source.format);
+ surface->copyFrom(source);
+ surface->applyColorKey(255, 0, 255, false);
- if (stream) {
- bmpDecoder.loadStream(*stream);
- source = *(bmpDecoder.getSurface());
+ target->setBorder(*surface, active);
- _inactiveBorder = new Graphics::TransparentSurface();
- source.convertToInPlace(_inactiveBorder->getSupportedPixelFormat(), bmpDecoder.getPalette());
- _inactiveBorder->create(source.w, source.h, source.format);
- _inactiveBorder->copyFrom(source);
- _inactiveBorder->applyColorKey(255, 0, 255, false);
+ borderfile.close();
delete stream;
}
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index a6a25266b1..898c7c3162 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -54,6 +54,7 @@
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/macgui/macwindow.h"
#include "graphics/macgui/macmenu.h"
+#include "graphics/macgui/macwindowborder.h"
#include "common/events.h"
#include "common/rect.h"
@@ -156,6 +157,7 @@ private:
void updateTextSelection(int x, int y);
void loadBorders();
+ void loadBorder(Graphics::MacWindow *target, Common::String filename, bool active);
public:
Graphics::ManagedSurface _screen;
@@ -175,8 +177,6 @@ public:
Graphics::MacWindow *_consoleWindow;
private:
- Graphics::TransparentSurface *_activeBorder;
- Graphics::TransparentSurface *_inactiveBorder;
Graphics::ManagedSurface _console;
Graphics::Menu *_menu;