diff options
author | Borja Lorente | 2016-07-29 12:10:30 +0200 |
---|---|---|
committer | Borja Lorente | 2016-07-31 14:05:15 +0200 |
commit | 4a16f5fc3987be23dd67d6ed42c9f8f0453eba6d (patch) | |
tree | a2ab33ecc29def5c4fa782b4c963b7ffc3935b61 | |
parent | 3d950ad125dee02b45931c2a7943e4ee4d6a93d9 (diff) | |
download | scummvm-rg350-4a16f5fc3987be23dd67d6ed42c9f8f0453eba6d.tar.gz scummvm-rg350-4a16f5fc3987be23dd67d6ed42c9f8f0453eba6d.tar.bz2 scummvm-rg350-4a16f5fc3987be23dd67d6ed42c9f8f0453eba6d.zip |
WAGE: Begin adding borders to the windows
-rw-r--r-- | engines/wage/gui.cpp | 24 | ||||
-rw-r--r-- | engines/wage/gui.h | 3 | ||||
-rw-r--r-- | graphics/macgui/macwindow.cpp | 17 | ||||
-rw-r--r-- | graphics/macgui/macwindow.h | 4 |
4 files changed, 23 insertions, 25 deletions
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 { diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp index 4dacf23e11..0ca0a89acb 100644 --- a/graphics/macgui/macwindow.cpp +++ b/graphics/macgui/macwindow.cpp @@ -64,7 +64,7 @@ BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) : } MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) : - BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable), _bmp(new TransparentSurface(), false) { + BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) { _active = false; _borderIsDirty = true; @@ -79,8 +79,6 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Mac _type = kWindowWindow; - TransparentSurface *srf = new TransparentSurface; - _bmp = NinePatchBitmap(srf, false); } MacWindow::~MacWindow() { @@ -150,17 +148,17 @@ bool MacWindow::draw(ManagedSurface *g, bool forceRedraw) { _composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2)); _composeSurface.transBlitFrom(_borderSurface, kColorGreen); + TransparentSurface tr(_borders); + //tr.create(_composeSurface.w, _composeSurface.h, tr.getSupportedPixelFormat()); + + //_bmp->blit(tr, 0, 0, tr.w, tr.h) + _composeSurface.transBlitFrom(tr); + g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2); return true; } -bool MacWindow::drawTR(Surface &g, int x, int y, int w, int h, bool forceRedraw) { - - _bmp.blit(g, x, y, w, h); - - return false; -} #define ARROW_W 12 #define ARROW_H 6 @@ -289,6 +287,7 @@ void MacWindow::setHighlight(WindowClick highlightedPart) { void MacWindow::setBorders(TransparentSurface *source) { _bmp = NinePatchBitmap(source, true); + _borders = TransparentSurface(*source); } diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h index dbbaff2d1e..335722b6e2 100644 --- a/graphics/macgui/macwindow.h +++ b/graphics/macgui/macwindow.h @@ -127,8 +127,7 @@ public: const Common::Rect &getInnerDimensions() { return _innerDims; } bool draw(ManagedSurface *g, bool forceRedraw = false); - bool drawTR(Surface &g, int x, int y, int w, int h, bool forceRedraw); - + void setActive(bool active); void setTitle(Common::String &title) { _title = title; } void setHighlight(WindowClick highlightedPart); @@ -151,6 +150,7 @@ private: ManagedSurface _composeSurface; NinePatchBitmap _bmp; + TransparentSurface _borders; bool _scrollable; bool _resizable; |