[Scummvm-git-logs] scummvm master -> 3a2ce122888cad6656f6b67aa4dc637a8e262d5e
sev-
sev at scummvm.org
Mon Jul 17 23:45:30 CEST 2017
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b28a4a8c3d GRAPHICS: Fix MacText::appendText by resizing _textLines
f2f420e15f GRAPHICS: Skeleton of MacTextWindow
b127beb03c GRAPHICS: Fix bug in MacText::draw() on calculating bounding rect size
fe63eb7644 GRAPHICS: Introduce drawText, appendText and font in MacTextWindow
0f65852d2f WAGE: Experimental MacText(Window) console rendering
2b06c02d7d GRAPHICS: Add MacText::appendText() variants that accept text format args
a169c7efb3 GRAPHICS: Use MacText::appendText to render formatted text
3a2ce12288 WAGE: Fix resizing and text selection bug
Commit: b28a4a8c3d4175d90b444cbc0a51508f6f8cc753
https://github.com/scummvm/scummvm/commit/b28a4a8c3d4175d90b444cbc0a51508f6f8cc753
Author: VelocityRa (makren67 at gmail.com)
Date: 2017-07-17T23:45:22+02:00
Commit Message:
GRAPHICS: Fix MacText::appendText by resizing _textLines
Also fix an off-by-one error
Changed paths:
graphics/macgui/mactext.cpp
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 0f9c120..672d1f5 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -307,8 +307,8 @@ int MacText::getLineHeight(int line) {
return _textLines[line].height;
}
-void MacText::setInterLinear(int interLinear) {
- _interLinear = interLinear;
+void MacText::setInterLinear(int interLinear) {
+ _interLinear = interLinear;
recalcDims();
}
@@ -339,14 +339,27 @@ void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int
}
void MacText::appendText(Common::String str) {
- int oldLen = _textLines.size();
+ uint oldLen = _textLines.size();
+ uint newLines = 1;
+
+ // Calc newline characters in str
+ Common::String::iterator p = str.begin();
+ while (*p) {
+ if (*p == '\n')
+ newLines++;
+ p++;
+ }
- // TODO: Recalc length
+ // Resize _textLines appropriately
+ for (int curLine = 0; curLine < newLines; ++curLine) {
+ _textLines.resize(oldLen + newLines);
+ _textLines[oldLen + curLine].chunks.push_back(_currentFormatting);
+ }
splitString(str);
recalcDims();
- render(oldLen + 1, _textLines.size());
+ render(oldLen, _textLines.size());
}
void MacText::replaceLastLine(Common::String str) {
Commit: f2f420e15fb1b7f1e8e9897550bbc0abbca438c8
https://github.com/scummvm/scummvm/commit/f2f420e15fb1b7f1e8e9897550bbc0abbca438c8
Author: VelocityRa (makren67 at gmail.com)
Date: 2017-07-17T23:45:22+02:00
Commit Message:
GRAPHICS: Skeleton of MacTextWindow
Needed to add 2 helper methods to MacWindowManager to make it cleaner
Changed paths:
A graphics/macgui/mactextwindow.cpp
A graphics/macgui/mactextwindow.h
graphics/macgui/macwindowmanager.cpp
graphics/macgui/macwindowmanager.h
graphics/module.mk
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
new file mode 100644
index 0000000..fc41be4
--- /dev/null
+++ b/graphics/macgui/mactextwindow.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/macgui/mactextwindow.h"
+
+namespace Graphics {
+
+MacTextWindow::MacTextWindow(MacWindowManager *wm) :
+ MacWindow(wm->getNextId(), true, true, true, wm) {
+ wm->addWindowInitialized(this);
+}
+
+MacTextWindow::~MacTextWindow() {
+}
+
+} // End of namespace Graphics
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
new file mode 100644
index 0000000..2e1cf4f
--- /dev/null
+++ b/graphics/macgui/mactextwindow.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GRAPHICS_MACGUI_MACTEXTWINDOW_H
+#define GRAPHICS_MACGUI_MACTEXTWINDOW_H
+
+namespace Graphics {
+
+class MacTextWindow : public MacWindow {
+public:
+ MacTextWindow(MacWindowManager *wm);
+ ~MacTextWindow();
+};
+
+} // End of namespace Graphics
+
+#endif
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 5329959..b64ff10 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -178,20 +178,25 @@ MacWindow *MacWindowManager::addWindow(bool scrollable, bool resizable, bool edi
_windows.push_back(w);
_windowStack.push_back(w);
- setActive(_lastId);
-
- _lastId++;
+ setActive(getNextId());
return w;
}
+void MacWindowManager::addWindowInitialized(MacWindow *macwindow) {
+ _windows.push_back(macwindow);
+ _windowStack.push_back(macwindow);
+}
+
+int MacWindowManager::getNextId() {
+ return _lastId++;
+}
+
MacMenu *MacWindowManager::addMenu() {
- _menu = new MacMenu(_lastId, _screen->getBounds(), this);
+ _menu = new MacMenu(getNextId(), _screen->getBounds(), this);
_windows.push_back(_menu);
- _lastId++;
-
return _menu;
}
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index bd597f6..ec7f4f1 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -104,6 +104,17 @@ public:
*/
MacWindow *addWindow(bool scrollable, bool resizable, bool editable);
/**
+ * Adds a window that has already been initialized to the registry.
+ * Like addWindow, but this doesn't create/allocate the Window.
+ * @param macWindow the window to be added to the registry
+ */
+ void addWindowInitialized(MacWindow *macwindow);
+ /**
+ * Returns the next available id and the increments the internal counter.
+ * @return next (new) window id that can be used
+ */
+ int getNextId();
+ /**
* Add the menu to the desktop.
* Note that the returned menu is empty, and therefore must be filled
* afterwards.
diff --git a/graphics/module.mk b/graphics/module.mk
index d862ee8..dbe5a3b 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -16,6 +16,7 @@ MODULE_OBJS := \
macgui/macfontmanager.o \
macgui/macmenu.o \
macgui/mactext.o \
+ macgui/mactextwindow.o \
macgui/macwindow.o \
macgui/macwindowborder.o \
macgui/macwindowmanager.o \
Commit: b127beb03c68a2b8161bb20930093c29b951b091
https://github.com/scummvm/scummvm/commit/b127beb03c68a2b8161bb20930093c29b951b091
Author: VelocityRa (makren67 at gmail.com)
Date: 2017-07-17T23:45:22+02:00
Commit Message:
GRAPHICS: Fix bug in MacText::draw() on calculating bounding rect size
Change is _surface->w to _surface->h in the fourth arg to Common::Rect
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 672d1f5..a3154ca 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -333,8 +333,8 @@ void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int
g->fillRect(Common::Rect(x, y, x + w, y + w), _bgcolor);
}
- g->blitFrom(*_surface, Common::Rect(MIN<int>(_surface->w, x), MIN<int>(_surface->h, y),
- MIN<int>(_surface->w, x + w), MIN<int>(_surface->w, y + w)),
+ g->blitFrom(*_surface, Common::Rect(MIN<int>(_surface->w, x), MIN<int>(_surface->h, y),
+ MIN<int>(_surface->w, x + w), MIN<int>(_surface->h, y + w)),
Common::Point(xoff, yoff));
}
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index fc41be4..a96aa5a 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -20,7 +20,9 @@
*
*/
+
#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/mactextwindow.h"
namespace Graphics {
@@ -33,4 +35,9 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm) :
MacTextWindow::~MacTextWindow() {
}
+const Font *MacTextWindow::getTextWindowFont() {
+ // TODO: make this have an actual effect
+ return _wm->_fontMan->getFont(Graphics::MacFont(kMacFontChicago, 8));
+}
+
} // End of namespace Graphics
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 2e1cf4f..b63f135 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -29,6 +29,8 @@ class MacTextWindow : public MacWindow {
public:
MacTextWindow(MacWindowManager *wm);
~MacTextWindow();
+
+ const Font *getTextWindowFont();
};
} // End of namespace Graphics
Commit: fe63eb764452affbc2a1f5884b1bb5d95ede7ee7
https://github.com/scummvm/scummvm/commit/fe63eb764452affbc2a1f5884b1bb5d95ede7ee7
Author: VelocityRa (makren67 at gmail.com)
Date: 2017-07-17T23:45:22+02:00
Commit Message:
GRAPHICS: Introduce drawText, appendText and font in MacTextWindow
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index a96aa5a..ba2b9fa 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -27,17 +27,29 @@
namespace Graphics {
-MacTextWindow::MacTextWindow(MacWindowManager *wm) :
+MacTextWindow::MacTextWindow(MacWindowManager *wm, const Font *font, int fgcolor,
+ int bgcolor, int maxWidth, TextAlign textAlignment) :
MacWindow(wm->getNextId(), true, true, true, wm) {
+
wm->addWindowInitialized(this);
+
+ _font = font;
+ _mactext = new MacText("", _wm, font, fgcolor, bgcolor, maxWidth, textAlignment);
+}
+
+void MacTextWindow::drawText(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) {
+ _mactext->draw(g, x, y, w, h, xoff, yoff);
+}
+
+void MacTextWindow::appendText(Common::String str) {
+ _mactext->appendText(str);
}
MacTextWindow::~MacTextWindow() {
}
const Font *MacTextWindow::getTextWindowFont() {
- // TODO: make this have an actual effect
- return _wm->_fontMan->getFont(Graphics::MacFont(kMacFontChicago, 8));
+ return _font;
}
} // End of namespace Graphics
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index b63f135..6ca6e9a 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -23,14 +23,24 @@
#ifndef GRAPHICS_MACGUI_MACTEXTWINDOW_H
#define GRAPHICS_MACGUI_MACTEXTWINDOW_H
+#include "graphics/macgui/mactext.h"
+
namespace Graphics {
class MacTextWindow : public MacWindow {
public:
- MacTextWindow(MacWindowManager *wm);
+ MacTextWindow(MacWindowManager *wm, const Font *font, int fgcolor,
+ int bgcolor, int maxWidth, TextAlign textAlignment);
~MacTextWindow();
const Font *getTextWindowFont();
+
+ void drawText(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
+ void appendText(Common::String str);
+
+private:
+ MacText *_mactext;
+ const Font *_font;
};
} // End of namespace Graphics
Commit: 0f65852d2f8f4ea2814cb7f626617e6b7c27f49f
https://github.com/scummvm/scummvm/commit/0f65852d2f8f4ea2814cb7f626617e6b7c27f49f
Author: VelocityRa (makren67 at gmail.com)
Date: 2017-07-17T23:45:22+02:00
Commit Message:
WAGE: Experimental MacText(Window) console rendering
Currently the font specified in the constructor is not
being used, I explain why in gui.cpp, line 182.
Use the 2 defines in gui.h to specify whether:
1) The new text rendering in general is used
(USE_NEW_TEXT_RENDERER)
2) The MacTextWindow class is used
for rendering (USE_MACTEXTWINDOW)
Changed paths:
engines/wage/gui-console.cpp
engines/wage/gui.cpp
engines/wage/gui.h
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 37031f0..19b2c52 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 130747c..4c75550 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 10eb782..9bb4659 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;
Commit: 2b06c02d7deb866138ff6fa8f469d48313d9afbd
https://github.com/scummvm/scummvm/commit/2b06c02d7deb866138ff6fa8f469d48313d9afbd
Author: VelocityRa (makren67 at gmail.com)
Date: 2017-07-17T23:45:22+02:00
Commit Message:
GRAPHICS: Add MacText::appendText() variants that accept text format args
Made 1 helper method and 1 function to reduce duplication size as much
as possible and still keep them useful for other purposes.
Changed paths:
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index a3154ca..44dddad 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -338,23 +338,48 @@ void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int
Common::Point(xoff, yoff));
}
-void MacText::appendText(Common::String str) {
- uint oldLen = _textLines.size();
- uint newLines = 1;
-
- // Calc newline characters in str
- Common::String::iterator p = str.begin();
+// Count newline characters in String
+uint getNewlinesInString(const Common::String &str) {
+ Common::String::const_iterator p = str.begin();
+ uint newLines = 0;
while (*p) {
if (*p == '\n')
newLines++;
p++;
}
+ return newLines;
+}
+
+// Appends numNewLines new lines in _textLines, formatted with the MacFontRun specified
+void MacText::resizeAndFormatLines(uint numNewLines, MacFontRun *fontRun) {
+ uint oldLen = _textLines.size();
// Resize _textLines appropriately
- for (int curLine = 0; curLine < newLines; ++curLine) {
- _textLines.resize(oldLen + newLines);
- _textLines[oldLen + curLine].chunks.push_back(_currentFormatting);
+ for (uint curLine = 0; curLine < numNewLines; ++curLine) {
+ _textLines.resize(oldLen + numNewLines);
+ _textLines[oldLen + curLine].chunks.push_back(*fontRun);
}
+}
+
+void MacText::appendText(Common::String str, int fontId, int fontSize, int fontSlant) {
+ uint oldLen = _textLines.size();
+ uint newLines = 1 + getNewlinesInString(str);
+
+ MacFontRun fontRun = MacFontRun(_wm, fontId, fontSlant, 0, fontSize, 0, 0, 0);
+
+ resizeAndFormatLines(newLines, &fontRun);
+
+ splitString(str);
+ recalcDims();
+
+ render(oldLen, _textLines.size());
+}
+
+void MacText::appendTextDefault(Common::String str) {
+ uint oldLen = _textLines.size();
+ uint newLines = 1 + getNewlinesInString(str);
+
+ resizeAndFormatLines(newLines, &_defaultFormatting);
splitString(str);
recalcDims();
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index f0a3ed6..cd2adb3 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -95,7 +95,9 @@ public:
void setInterLinear(int interLinear);
void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
- void appendText(Common::String str);
+ void resizeAndFormatLines(uint numNewLines, MacFontRun * fontRun);
+ void appendText(Common::String str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular);
+ void appendTextDefault(Common::String str);
void replaceLastLine(Common::String str);
int getLineCount() { return _textLines.size(); }
Commit: a169c7efb3c80dafc9cfc2dccf2c31fcffe5be11
https://github.com/scummvm/scummvm/commit/a169c7efb3c80dafc9cfc2dccf2c31fcffe5be11
Author: VelocityRa (makren67 at gmail.com)
Date: 2017-07-17T23:45:22+02:00
Commit Message:
GRAPHICS: Use MacText::appendText to render formatted text
With this we can specify font, character size and slant that each
appended text will use.
Changed paths:
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index ba2b9fa..22bd240 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -41,8 +41,8 @@ void MacTextWindow::drawText(ManagedSurface *g, int x, int y, int w, int h, int
_mactext->draw(g, x, y, w, h, xoff, yoff);
}
-void MacTextWindow::appendText(Common::String str) {
- _mactext->appendText(str);
+void MacTextWindow::appendText(Common::String str, int id, int size, int slant) {
+ _mactext->appendText(str, id, size, slant);
}
MacTextWindow::~MacTextWindow() {
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 6ca6e9a..3ef928e 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -23,6 +23,7 @@
#ifndef GRAPHICS_MACGUI_MACTEXTWINDOW_H
#define GRAPHICS_MACGUI_MACTEXTWINDOW_H
+#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/mactext.h"
namespace Graphics {
@@ -36,7 +37,7 @@ public:
const Font *getTextWindowFont();
void drawText(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
- void appendText(Common::String str);
+ void appendText(Common::String str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular);
private:
MacText *_mactext;
Commit: 3a2ce122888cad6656f6b67aa4dc637a8e262d5e
https://github.com/scummvm/scummvm/commit/3a2ce122888cad6656f6b67aa4dc637a8e262d5e
Author: VelocityRa (makren67 at gmail.com)
Date: 2017-07-17T23:45:22+02:00
Commit Message:
WAGE: Fix resizing and text selection bug
Revise/Simplify old optional text rendering
Set things up a bit for selected text rendering
Add MacTextWindow::clearText and MacTextWindow::setSelection
Add MacTextWindow::appendText variant that accepts a MacFont
Changed paths:
engines/wage/gui-console.cpp
engines/wage/gui.cpp
engines/wage/gui.h
engines/wage/wage.cpp
graphics/macgui/macfontmanager.h
graphics/macgui/mactext.cpp
graphics/macgui/mactext.h
graphics/macgui/mactextwindow.cpp
graphics/macgui/mactextwindow.h
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 19b2c52..b97b76e 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -63,12 +63,17 @@
namespace Wage {
-const Graphics::Font *Gui::getConsoleFont() {
+const Graphics::MacFont *Gui::getConsoleMacFont() {
Scene *scene = _engine->_world->_player->_currentScene;
- return _wm._fontMan->getFont(*scene->getFont());
+ return scene->getFont();
}
+const Graphics::Font *Gui::getConsoleFont() {
+ return _wm._fontMan->getFont(*getConsoleMacFont());
+}
+
+
void Gui::clearOutput() {
_out.clear();
_lines.clear();
@@ -88,7 +93,6 @@ void Gui::appendText(const char *s) {
// Okay, we got new lines, need to split it
// and push substrings individually
Common::String tmp;
-
for (uint i = 0; i < str.size(); i++) {
if (str[i] == '\n') {
_out.push_back(tmp);
@@ -100,8 +104,16 @@ void Gui::appendText(const char *s) {
tmp += str[i];
}
+ // Process last/leftover line
_out.push_back(tmp);
flowText(tmp);
+
+#ifdef USE_MACTEXTWINDOW
+ // Append _lines content to MacTextWindow after it has
+ // been processed by flowText above
+ for (uint line = 0; line < _lines.size(); ++line)
+ _consoleWindow->appendText(_lines[line], getConsoleMacFont());
+#endif // USE_MACTEXTWINDOW
}
enum {
@@ -114,9 +126,16 @@ enum {
void Gui::flowText(Common::String &str) {
Common::StringArray wrappedLines;
- int textW = _consoleWindow->getInnerDimensions().width() - kConWPadding * 2;
- const Graphics::Font *font = getConsoleFont();
+ int16 conTextWidth = _consoleWindow->getInnerDimensions().width() - kConWPadding * 2;
+ if (conTextWidth <= 0) {
+ warning("Gui::flowText: Console text width is non-positive. Text will not be visible.");
+ return;
+ }
+
+ int textW = conTextWidth;
+
+ const Graphics::Font *font = getConsoleFont();
font->wordWrapText(str, textW, wrappedLines);
if (wrappedLines.empty()) // Sometimes we have empty lines
@@ -142,6 +161,21 @@ void Gui::flowText(Common::String &str) {
draw();
}
+void Gui::reflowText() {
+ _lines.clear();
+
+ for (uint i = 0; i < _out.size(); i++)
+ flowText(_out[i]);
+
+#ifdef USE_MACTEXTWINDOW
+ // Append _lines content to MacTextWindow after it has
+ // been processed by flowText above
+ _consoleWindow->clearText();
+ for (uint line = 0; line < _lines.size(); ++line)
+ _consoleWindow->appendText(_lines[line], getConsoleMacFont());
+#endif // USE_MACTEXTWINDOW
+}
+
void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
bool fullRedraw = _consoleFullRedraw;
bool textReflow = false;
@@ -161,21 +195,22 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
fullRedraw = true;
}
- if (fullRedraw)
- _console.clear(kColorWhite);
+#ifdef USE_MACTEXTWINDOW
+ // TODO: Call this at an appropriate place (only when the selection can change)
+ _consoleWindow->setSelection(_selectionStartX, _selectionStartY, _selectionEndX, _selectionEndY);
+#endif // USE_MACTEXTWINDOW
+ if (fullRedraw) {
+ _console.clear(kColorWhite);
+ }
const Graphics::Font *font = getConsoleFont();
_consoleLineHeight = font->getFontHeight();
int textW = r.width() - kConWPadding * 2;
int textH = r.height() - kConHPadding * 2;
- if (textReflow) {
- _lines.clear();
-
- for (uint i = 0; i < _out.size(); i++)
- flowText(_out[i]);
- }
+ if (textReflow)
+ reflowText();
const int firstLine = _scrollPos / _consoleLineHeight;
const int lastLine = MIN((_scrollPos + textH) / _consoleLineHeight + 1, _lines.size());
@@ -187,10 +222,13 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
if (fullRedraw)
_consoleNumLines = (r.height() - 2 * kConWPadding) / _consoleLineHeight - 2;
- for (int line = firstLine; line < lastLine; line++) {
+#ifndef USE_MACTEXTWINDOW
+
+ for (int line = firstLine; line < lastLine; line++) {
const char *str = _lines[line].c_str();
int color = kColorBlack;
+ // Draw selexted text box except first and last line
if ((line > _selectionStartY && line < _selectionEndY) ||
(line > _selectionEndY && line < _selectionStartY)) {
color = kColorWhite;
@@ -199,7 +237,9 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
Design::drawFilledRect(&_console, trect, kColorBlack, _wm.getPatterns(), kPatternSolid);
}
+ // Draw selexted text box on first and last line
if (line == _selectionStartY || line == _selectionEndY) {
+ // Draw selected text if multiple lines are selected
if (_selectionStartY != _selectionEndY) {
int color1 = kColorBlack;
int color2 = kColorWhite;
@@ -223,11 +263,15 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
else
trect.left = rectW;
+ // Draw background rectangle on selected text
Design::drawFilledRect(&_console, trect, kColorBlack, _wm.getPatterns(), kPatternSolid);
+ // Draw left of the selected character (either start or end char)
font->drawString(&_console, beg, x1, y1, textW, color1);
+ // Draw right of the selected character (either star or end char)
font->drawString(&_console, end, x1 + rectW - kConWPadding - kConWOverlap, y1, textW, color2);
- } else {
+
+ } else { // Draw selected text if only 1 line is selected
int startPos = _selectionStartX;
int endPos = _selectionEndX;
@@ -242,30 +286,27 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
int rectW2 = rectW1 + font->getStringWidth(mid);
Common::Rect trect(rectW1, y1, rectW2, y1 + _consoleLineHeight);
+ // Draw background rectangle on selected text
Design::drawFilledRect(&_console, trect, kColorBlack, _wm.getPatterns(), kPatternSolid);
+ // Draw text left of the first selected character
font->drawString(&_console, beg, x1, y1, textW, kColorBlack);
+ // Draw selected text
font->drawString(&_console, mid, x1 + rectW1 - kConWPadding - kConWOverlap, y1, textW, kColorWhite);
+ // Draw text right of the last selected character
font->drawString(&_console, end, x1 + rectW2 - kConWPadding - kConWOverlap, y1, textW, kColorBlack);
}
- } else {
+ } else { // Neither first nor last line
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;
}
+#endif
+
// Now we need to clip it to the screen
int xcon = r.left - kConOverscan;
int ycon = r.top - kConOverscan;
@@ -288,13 +329,11 @@ 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);
+ _consoleWindow->drawText(&_console, 0, 0,
+ boundsR.width(), boundsR.height(),
+ boundsR.left + 7, boundsR.top + 7);
#endif // USE_MACTEXTWINDOW
-#endif // USE_NEW_TEXT_RENDERER
g->copyRectToSurface(_console, xcon, ycon, boundsR);
}
@@ -302,7 +341,6 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r) {
void Gui::drawInput() {
if (!_screen.getPixels())
return;
-
_wm.setActive(_consoleWindow->getId());
_out.pop_back();
@@ -310,6 +348,7 @@ void Gui::drawInput() {
appendText(_engine->_inputText.c_str());
_inputTextLineNum = _out.size() - 1;
+ #ifndef USE_MACTEXTWINDOW
const Graphics::Font *font = getConsoleFont();
if (_engine->_inputText.contains('\n')) {
@@ -342,6 +381,8 @@ void Gui::drawInput() {
}
_cursorX = font->getStringWidth(_out[_inputTextLineNum]) + kConHPadding;
+
+#endif // USE_MACTEXTWINDOW
}
void Gui::actionCopy() {
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 4c75550..54601cc 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -173,37 +173,23 @@ Gui::Gui(WageEngine *engine) {
_sceneWindow = _wm.addWindow(false, false, false);
_sceneWindow->setCallback(sceneWindowCallback, this);
+#ifdef USE_MACTEXTWINDOW
//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);
+ _consoleWindow = new Graphics::MacTextWindow(&_wm, const_cast<Graphics::Font *>(font), kColorBlack, kColorWhite,
+ maxWidth, Graphics::kTextAlignLeft);
#else
- _consoleWindow = _wm.addWindow(true, true, true);
- const Graphics::Font *font = _wm._fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 8));
+ _consoleWindow = _wm.addWindow(true, true, true);
#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() {
@@ -236,7 +222,6 @@ void Gui::draw() {
_sceneWindow->setDimensions(*_scene->_designBounds);
_sceneWindow->setTitle(_scene->_name);
- _consoleWindow->setDimensions(*_scene->_textBounds);
_wm.setFullRefresh(true);
}
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 9bb4659..5f8be34 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -48,20 +48,8 @@
#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
+// #define USE_MACTEXTWINDOW
#include "common/str-array.h"
#include "graphics/font.h"
@@ -72,6 +60,7 @@
#else
#include "graphics/macgui/macwindow.h"
#endif
+#include "graphics/macgui/macwindow.h"
#include "graphics/macgui/mactext.h"
#include "graphics/macgui/macmenu.h"
#include "graphics/macgui/macwindowborder.h"
@@ -141,6 +130,7 @@ public:
void draw();
void appendText(const char *str);
+ void reflowText();
void clearOutput();
bool processEvent(Common::Event &event);
@@ -168,6 +158,7 @@ private:
void undrawCursor();
void renderConsole(Graphics::ManagedSurface *g, const Common::Rect &r);
void flowText(Common::String &str);
+ const Graphics::MacFont *getConsoleMacFont();
const Graphics::Font *getConsoleFont();
const Graphics::Font *getTitleFont();
void startMarking(int x, int y);
@@ -195,19 +186,13 @@ public:
Graphics::MacWindow *_sceneWindow;
#ifdef USE_MACTEXTWINDOW
- Graphics::MacTextWindow *_consoleWindow;
+ Graphics::MacTextWindow *_consoleWindow;
#else
- Graphics::MacWindow *_consoleWindow;
+ 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;
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 3419a86..54d821f 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -133,6 +133,7 @@ Common::Error WageEngine::run() {
_gui->regenCommandsMenu();
_gui->regenWeaponsMenu();
}
+
Common::String input("look");
processTurn(&input, NULL);
_temporarilyHidden = false;
@@ -312,6 +313,10 @@ void WageEngine::performInitialSetup() {
if (!playerPlaced) {
_world->move(_world->_player, _world->getRandomScene());
}
+
+ // Set the console window's dimensions early here because
+ // flowText() that needs them gets called before they're set
+ _gui->_consoleWindow->setDimensions(*_world->_player->_currentScene->_textBounds);
}
void WageEngine::wearObjs(Chr* chr) {
diff --git a/graphics/macgui/macfontmanager.h b/graphics/macgui/macfontmanager.h
index c154b8b..20c645a 100644
--- a/graphics/macgui/macfontmanager.h
+++ b/graphics/macgui/macfontmanager.h
@@ -77,9 +77,9 @@ public:
_font = NULL;
}
- int getId() { return _id; };
- int getSize() { return _size; }
- int getSlant() { return _slant; }
+ const int getId() const { return _id; };
+ const int getSize() const { return _size; }
+ const int getSlant() const { return _slant; }
Common::String getName() { return _name; }
void setName(Common::String &name) { _name = name; }
void setName(const char *name) { _name = name; }
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 44dddad..fa0510b 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -327,6 +327,8 @@ void MacText::recalcDims() {
}
void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) {
+ if (_textLines.empty()) return;
+
render();
if (x + w < _surface->w || y + h < _surface->h) {
@@ -361,7 +363,7 @@ void MacText::resizeAndFormatLines(uint numNewLines, MacFontRun *fontRun) {
}
}
-void MacText::appendText(Common::String str, int fontId, int fontSize, int fontSlant) {
+void MacText::appendText(Common::String str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular) {
uint oldLen = _textLines.size();
uint newLines = 1 + getNewlinesInString(str);
@@ -387,6 +389,13 @@ void MacText::appendTextDefault(Common::String str) {
render(oldLen, _textLines.size());
}
+void MacText::clearText() {
+ _textLines.clear();
+ _str.clear();
+
+ recalcDims();
+}
+
void MacText::replaceLastLine(Common::String str) {
int oldLen = MAX<int>(0, _textLines.size() - 1);
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index cd2adb3..3870451 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -92,12 +92,14 @@ public:
int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft, int interlinear = 0);
// 0 pixels between the lines by default
~MacText();
+
void setInterLinear(int interLinear);
void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
void resizeAndFormatLines(uint numNewLines, MacFontRun * fontRun);
- void appendText(Common::String str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular);
+ void appendText(Common::String str, int fontId, int fontSize, int fontSlant);
void appendTextDefault(Common::String str);
+ void clearText();
void replaceLastLine(Common::String str);
int getLineCount() { return _textLines.size(); }
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 22bd240..19ed9a8 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -27,7 +27,7 @@
namespace Graphics {
-MacTextWindow::MacTextWindow(MacWindowManager *wm, const Font *font, int fgcolor,
+MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor,
int bgcolor, int maxWidth, TextAlign textAlignment) :
MacWindow(wm->getNextId(), true, true, true, wm) {
@@ -45,10 +45,25 @@ void MacTextWindow::appendText(Common::String str, int id, int size, int slant)
_mactext->appendText(str, id, size, slant);
}
+void MacTextWindow::appendText(Common::String str, const MacFont *macFont) {
+ _mactext->appendText(str, macFont->getId(), macFont->getSize(), macFont->getSlant());
+}
+
+void MacTextWindow::clearText() {
+ _mactext->clearText();
+}
+
+void MacTextWindow::setSelection(int selStartX, int selStartY, int selEndX, int selEndY) {
+ _selectedText.startX = selStartX;
+ _selectedText.startY = selStartY;
+ _selectedText.endX = selEndX;
+ _selectedText.endY = selEndY;
+}
+
MacTextWindow::~MacTextWindow() {
}
-const Font *MacTextWindow::getTextWindowFont() {
+const MacFont *MacTextWindow::getTextWindowFont() {
return _font;
}
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 3ef928e..f302f37 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -28,20 +28,35 @@
namespace Graphics {
+struct SelectedText {
+ int startX = 0, startY = 0;
+ int endX = 0, endY = 0;
+
+ bool needsRender() {
+ return startX != endX || startY != endY;
+ }
+};
+
class MacTextWindow : public MacWindow {
public:
- MacTextWindow(MacWindowManager *wm, const Font *font, int fgcolor,
+ MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgcolor,
int bgcolor, int maxWidth, TextAlign textAlignment);
~MacTextWindow();
- const Font *getTextWindowFont();
+ const MacFont *getTextWindowFont();
void drawText(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
void appendText(Common::String str, int fontId = kMacFontChicago, int fontSize = 12, int fontSlant = kMacFontRegular);
+ void appendText(Common::String str, const MacFont *macFont);
+ void clearText();
+
+ void setSelection(int selStartX, int selStartY, int selEndX, int selEndY);
private:
MacText *_mactext;
- const Font *_font;
+ const MacFont *_font;
+
+ SelectedText _selectedText;
};
} // End of namespace Graphics
More information about the Scummvm-git-logs
mailing list