diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wage/gui-console.cpp | 20 | ||||
-rw-r--r-- | engines/wage/gui.cpp | 27 | ||||
-rw-r--r-- | engines/wage/gui.h | 32 |
3 files changed, 77 insertions, 2 deletions
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp index 37031f0dd9..19b2c5224f 100644 --- a/engines/wage/gui-console.cpp +++ b/engines/wage/gui-console.cpp @@ -249,8 +249,18 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) { font->drawString(&_console, end, x1 + rectW2 - kConWPadding - kConWOverlap, y1, textW, kColorBlack); } } else { - if (*str) + if (*str) { font->drawString(&_console, _lines[line], x1, y1, textW, color); + + // TODO: Take into account color (and maybe position) +#ifdef USE_NEW_TEXT_RENDERER +#ifdef USE_MACTEXTWINDOW + _consoleWindow->appendText(_lines[line]); +#else + _mactext->appendText(_lines[line]); +#endif // USE_MACTEXTWINDOW +#endif // USE_OLD_TEXT_RENDERER + } } y1 += _consoleLineHeight; @@ -278,6 +288,14 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) { if (rr.bottom > _screen.h - 1) rr.bottom = _screen.h - 1; +#ifdef USE_NEW_TEXT_RENDERER +#ifdef USE_MACTEXTWINDOW + _consoleWindow->drawText(&_console, xcon, ycon, rr.width() - xcon, rr.height() - ycon, rr.left, rr.top); +#else + _mactext->draw(&_console, xcon, ycon, rr.width() - xcon, rr.height() - ycon, rr.left, rr.top); +#endif // USE_MACTEXTWINDOW +#endif // USE_NEW_TEXT_RENDERER + g->copyRectToSurface(_console, xcon, ycon, boundsR); } diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 130747c389..4c75550f41 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -49,6 +49,7 @@ #include "common/system.h" #include "graphics/cursorman.h" #include "graphics/primitives.h" +#include "graphics/macgui/macfontmanager.h" #include "graphics/macgui/macwindowmanager.h" #include "graphics/macgui/macwindow.h" #include "graphics/macgui/macmenu.h" @@ -172,11 +173,37 @@ Gui::Gui(WageEngine *engine) { _sceneWindow = _wm.addWindow(false, false, false); _sceneWindow->setCallback(sceneWindowCallback, this); + //TODO: Make the font we use here work + // (currently MacFontRun::getFont gets called with the fonts being uninitialized, + // so it initializes them by itself with default params, and not those here) +#ifdef USE_NEW_TEXT_RENDERER +#ifdef USE_MACTEXTWINDOW + const Graphics::Font *font = _wm._fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 8)); + + uint maxWidth = _screen.w; + + _consoleWindow = new Graphics::MacTextWindow(&_wm, font, kColorBlack, kColorWhite, + maxWidth, Graphics::kTextAlignCenter); +#else + _consoleWindow = _wm.addWindow(true, true, true); + const Graphics::Font *font = _wm._fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 8)); +#endif // USE_MACTEXTWINDOW +#else _consoleWindow = _wm.addWindow(true, true, true); +#endif // USE_NEW_TEXT_RENDERER + _consoleWindow->setCallback(consoleWindowCallback, this); loadBorders(); +#ifdef USE_NEW_TEXT_RENDERER +#ifndef USE_MACTEXTWINDOW + unsigned maxWidth = _screen.w; + + _mactext = new Graphics::MacText("", &_wm, font, + kColorBlack, kColorWhite, maxWidth, Graphics::kTextAlignCenter); +#endif // USE_MACTEXTWINDOW +#endif // USE_NEW_TEXT_RENDERER } Gui::~Gui() { diff --git a/engines/wage/gui.h b/engines/wage/gui.h index 10eb782f01..9bb4659233 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -48,11 +48,31 @@ #ifndef WAGE_GUI_H #define WAGE_GUI_H +// Whether to use the new text renderer +// Currently renders along with (on top of) the current one +#define USE_NEW_TEXT_RENDERER + +// Whether to use the new MacTextWindow class for rendering the console +// Currently it's just a simple wrapper that mostly only holds a MacText +#define USE_MACTEXTWINDOW + +// Make sure USE_MACTEXTWINDOW can't be defined without USE_NEW_TEXT_RENDERER being defined as well +#ifndef USE_NEW_TEXT_RENDERER +#ifdef USE_MACTEXTWINDOW +#define USE_NEW_TEXT_RENDERER +#endif // USE_MACTEXTWINDOW +#endif // USE_NEW_TEXT_RENDERER + #include "common/str-array.h" #include "graphics/font.h" #include "graphics/managed_surface.h" #include "graphics/macgui/macwindowmanager.h" +#ifdef USE_MACTEXTWINDOW +#include "graphics/macgui/mactextwindow.h" +#else #include "graphics/macgui/macwindow.h" +#endif +#include "graphics/macgui/mactext.h" #include "graphics/macgui/macmenu.h" #include "graphics/macgui/macwindowborder.h" @@ -65,7 +85,6 @@ #include "graphics/palette.h" - namespace Wage { using namespace Graphics::MacWindowConstants; @@ -174,10 +193,21 @@ public: Graphics::MacWindowManager _wm; Graphics::MacWindow *_sceneWindow; + +#ifdef USE_MACTEXTWINDOW + Graphics::MacTextWindow *_consoleWindow; +#else Graphics::MacWindow *_consoleWindow; +#endif private: +#ifdef USE_NEW_TEXT_RENDERER +#ifndef USE_MACTEXTWINDOW + Graphics::MacText *_mactext; +#endif // USE_MACTEXTWINDOW +#endif // USE_NEW_TEXT_RENDERER + Graphics::ManagedSurface _console; Graphics::MacMenu *_menu; bool _sceneDirty; |