diff options
author | Borja Lorente | 2016-07-29 12:08:12 +0200 |
---|---|---|
committer | Borja Lorente | 2016-07-31 14:05:15 +0200 |
commit | 98d0838df3ee3697268b846d9d114e2a9788cb40 (patch) | |
tree | 0f162118c452c3d1193aa0b15aec9877e663a341 /engines/wage | |
parent | b8d36443f36a6302f95ee7cc28f063b378810dcc (diff) | |
download | scummvm-rg350-98d0838df3ee3697268b846d9d114e2a9788cb40.tar.gz scummvm-rg350-98d0838df3ee3697268b846d9d114e2a9788cb40.tar.bz2 scummvm-rg350-98d0838df3ee3697268b846d9d114e2a9788cb40.zip |
WAGE: Add basic border loading code
Diffstat (limited to 'engines/wage')
-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; |