diff options
-rw-r--r-- | engines/wage/gui.cpp | 36 | ||||
-rw-r--r-- | engines/wage/gui.h | 11 |
2 files changed, 46 insertions, 1 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 2626f3b447..09e2e1a5a5 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -168,6 +168,9 @@ Gui::Gui(WageEngine *engine) { _consoleWindow = _wm.addWindow(true, true, true); _consoleWindow->setCallback(consoleWindowCallback, this); + + loadBorders(); + //_sceneWindow->setBorders(&_borders); } Gui::~Gui() { @@ -220,6 +223,8 @@ void Gui::draw() { _sceneDirty = false; _consoleDirty = false; _consoleFullRedraw = false; + + loadBorders(); } void Gui::drawScene() { @@ -228,7 +233,7 @@ void Gui::drawScene() { _scene->paint(_sceneWindow->getSurface(), 0, 0); _sceneWindow->setDirty(true); - + _sceneDirty = true; _consoleDirty = true; _menu->setDirty(true); @@ -363,4 +368,33 @@ void Gui::executeMenuCommand(int action, Common::String &text) { } } +void Gui::loadBorders() { + Common::File borderfile; + if (!borderfile.open("borders.bmp")) { + debug(1, "Cannot open border file"); + return; + } + + Image::BitmapDecoder bmpDecoder; + Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size()); + const Graphics::Surface * source; + + if (stream) { + bmpDecoder.loadStream(*stream); + source = bmpDecoder.getSurface(); + + _borders.create(source->w, source->h, source->format); + _borders.copyRectToSurface(*source, 0, 0, Common::Rect(0, 0, source->w, source->h)); + //source = source->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 0, 0, 0)); + + delete stream; + + g_system->copyRectToScreen(source->getPixels(), source->pitch, 40, 0, source->w, source->h); + g_system->copyRectToScreen(_borders.getPixels(), _borders.pitch, 40, 100, _borders.w, _borders.h); + g_system->updateScreen(); + } + + debug(1, "Hello"); +} + } // End of namespace Wage diff --git a/engines/wage/gui.h b/engines/wage/gui.h index cf30c577c1..23ee9f0660 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -58,6 +58,14 @@ #include "common/events.h" #include "common/rect.h" +#include "common/file.h" +#include "graphics/pixelformat.h" +#include "image/bmp.h" +#include "image/png.h" + +#include "graphics/primitives.h" + + namespace Wage { using namespace Graphics::MacWindowConstants; @@ -147,6 +155,7 @@ private: int calcTextX(int x, int textLine); int calcTextY(int y); void updateTextSelection(int x, int y); + void loadBorders(); public: Graphics::ManagedSurface _screen; @@ -165,6 +174,8 @@ public: Graphics::MacWindow *_sceneWindow; Graphics::MacWindow *_consoleWindow; + Graphics::TransparentSurface _borders; + private: Graphics::ManagedSurface _console; Graphics::Menu *_menu; |