From 4a16f5fc3987be23dd67d6ed42c9f8f0453eba6d Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Fri, 29 Jul 2016 12:10:30 +0200 Subject: WAGE: Begin adding borders to the windows --- engines/wage/gui.cpp | 24 ++++++++++++------------ engines/wage/gui.h | 3 +-- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'engines/wage') diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 49a457d5ac..0e0c034c5b 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -170,7 +170,7 @@ Gui::Gui(WageEngine *engine) { _consoleWindow->setCallback(consoleWindowCallback, this); loadBorders(); - //_sceneWindow->setBorders(&_borders); + _sceneWindow->setBorders(&_borders); } Gui::~Gui() { @@ -223,8 +223,6 @@ void Gui::draw() { _sceneDirty = false; _consoleDirty = false; _consoleFullRedraw = false; - - loadBorders(); } void Gui::drawScene() { @@ -370,27 +368,29 @@ void Gui::executeMenuCommand(int action, Common::String &text) { void Gui::loadBorders() { Common::File borderfile; - if (!borderfile.open("borders.bmp")) { + if (!borderfile.open("logo.bmp")) { debug(1, "Cannot open border file"); return; } Image::BitmapDecoder bmpDecoder; Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size()); - const Graphics::Surface * source; + Graphics::Surface source; if (stream) { - bmpDecoder.loadStream(*stream); - source = bmpDecoder.getSurface(); + bmpDecoder.loadStream(*stream); + source = *bmpDecoder.getSurface(); + source.convertToInPlace(_borders.getSupportedPixelFormat(), bmpDecoder.getPalette()); - _borders.create(source->w, source->h, source->format); - _borders.copyRectToSurface(*source, 0, 0, Common::Rect(0, 0, source->w, source->h)); + _borders.create(source.w, source.h, source.format); + _borders.copyFrom(source); + _borders.applyColorKey(255, 0, 255, false); 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(); + //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"); diff --git a/engines/wage/gui.h b/engines/wage/gui.h index 23ee9f0660..a72f469ccd 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -61,9 +61,8 @@ #include "common/file.h" #include "graphics/pixelformat.h" #include "image/bmp.h" -#include "image/png.h" -#include "graphics/primitives.h" +#include "graphics/palette.h" namespace Wage { -- cgit v1.2.3