aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-10-15 12:24:43 +0200
committerEugene Sandulenko2016-10-15 12:25:20 +0200
commit23544e6866aa9da9fde1a834eba7c8d4ddfdbed5 (patch)
tree27f44266f1670dfdaa1404f679dd386b8e0ab4d8 /engines
parent290ac2cc0445e24373ce06f05ebc4cb5e1f35378 (diff)
downloadscummvm-rg350-23544e6866aa9da9fde1a834eba7c8d4ddfdbed5.tar.gz
scummvm-rg350-23544e6866aa9da9fde1a834eba7c8d4ddfdbed5.tar.bz2
scummvm-rg350-23544e6866aa9da9fde1a834eba7c8d4ddfdbed5.zip
DIRECTOR: Added Mac font rendering test
Diffstat (limited to 'engines')
-rw-r--r--engines/director/director.cpp2
-rw-r--r--engines/director/director.h3
-rw-r--r--engines/director/score.cpp47
3 files changed, 52 insertions, 0 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a0a96d6b27..848eaa9b2b 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -117,6 +117,8 @@ Common::Error DirectorEngine::run() {
//_mainArchive = new RIFFArchive();
//_mainArchive->openFile("bookshelf_example.mmm");
+ //testFont();
+
scanMovies(ConfMan.get("path"));
loadSharedCastsFrom(_sharedCastFile);
diff --git a/engines/director/director.h b/engines/director/director.h
index 484e7f6360..7c65897bbf 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -133,6 +133,9 @@ private:
Lingo *_lingo;
Common::String _sharedCastFile;
+
+private:
+ void testFont();
};
} // End of namespace Director
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index ccba78e84e..c95aae1121 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -27,6 +27,8 @@
#include "engines/util.h"
#include "graphics/font.h"
#include "graphics/palette.h"
+#include "graphics/macgui/macfontmanager.h"
+#include "graphics/macgui/macwindowmanager.h"
#include "director/score.h"
#include "director/frame.h"
@@ -87,6 +89,51 @@ static byte defaultPalette[768] = {
204, 51, 255, 204, 102, 255, 204, 153, 255, 204, 204, 255, 204, 255, 255, 255,
0, 255, 255, 51, 255, 255, 102, 255, 255, 153, 255, 255, 204, 255, 255, 255 };
+void DirectorEngine::testFont() {
+ int x = 10;
+ int y = 10;
+ int w = 640;
+ int h = 480;
+
+ initGraphics(w, h, true);
+ g_system->getPaletteManager()->setPalette(defaultPalette, 0, 256);
+
+ Graphics::ManagedSurface surface;
+
+ surface.create(w, h);
+ surface.clear(255);
+
+ const char *text = "d";
+
+ for (int i = 9; i <= 40; i++) {
+ Graphics::MacFont macFont(Graphics::kMacFontNewYork, i);
+
+ const Graphics::Font *font = _wm->_fontMan->getFont(macFont);
+
+ int width = font->getStringWidth(text);
+
+ Common::Rect bbox = font->getBoundingBox(text, x, y, w);
+ surface.frameRect(bbox, 15);
+
+ font->drawString(&surface, text, x, y, width, 0);
+
+ x += width + 1;
+ }
+
+ g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, w, h);
+
+ Common::Event event;
+
+ while (true) {
+ if (g_system->getEventManager()->pollEvent(event))
+ if (event.type == Common::EVENT_QUIT)
+ break;
+
+ g_system->updateScreen();
+ g_system->delayMillis(10);
+ }
+}
+
Score::Score(DirectorEngine *vm, Archive *archive) {
_vm = vm;
_surface = new Graphics::ManagedSurface;