aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/screen.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-25 12:41:39 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit3a543a1e6d35a5bcab61a8fb4257b7d567d9e278 (patch)
tree154d7a7b6c7a76c35490a3b092f0957a3d0d7397 /engines/glk/screen.cpp
parentfb7dbffd59b797ed00785a2d3762355f9dbb9f7d (diff)
downloadscummvm-rg350-3a543a1e6d35a5bcab61a8fb4257b7d567d9e278.tar.gz
scummvm-rg350-3a543a1e6d35a5bcab61a8fb4257b7d567d9e278.tar.bz2
scummvm-rg350-3a543a1e6d35a5bcab61a8fb4257b7d567d9e278.zip
GLK: FROTZ: Add derived Screen class to add Infocom character graphics font
Diffstat (limited to 'engines/glk/screen.cpp')
-rw-r--r--engines/glk/screen.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/engines/glk/screen.cpp b/engines/glk/screen.cpp
index cfe8cde84f..6768360df1 100644
--- a/engines/glk/screen.cpp
+++ b/engines/glk/screen.cpp
@@ -33,7 +33,12 @@ namespace Glk {
#define FONTS_VERSION 1.0
#define FONTS_FILENAME "fonts.dat"
-Screen::Screen() {
+Screen::~Screen() {
+ for (int idx = 0; idx < FONTS_TOTAL; ++idx)
+ delete _fonts[idx];
+}
+
+void Screen::initialize() {
if (!loadFonts())
error("Could not load data file");
@@ -49,11 +54,6 @@ Screen::Screen() {
g_conf->_cellH = g_conf->_leading;
}
-Screen::~Screen() {
- for (int idx = 0; idx < FONTS_TOTAL; ++idx)
- delete _fonts[idx];
-}
-
void Screen::fill(const byte *rgb) {
uint color = format.RGBToColor(rgb[0], rgb[1], rgb[2]);
clear(color);
@@ -100,7 +100,6 @@ void Screen::drawCaret(const Point &pos) {
bool Screen::loadFonts() {
Common::Archive *archive = nullptr;
- _fonts.resize(FONTS_TOTAL);
if (!Common::File::exists(FONTS_FILENAME) || (archive = Common::makeZipArchive(FONTS_FILENAME)) == nullptr)
return false;
@@ -122,12 +121,20 @@ bool Screen::loadFonts() {
return false;
}
+ loadFonts(archive);
+
+ delete archive;
+ return true;
+}
+
+void Screen::loadFonts(Common::Archive *archive) {
// R ead in the fonts
double monoAspect = g_conf->_monoAspect;
double propAspect = g_conf->_propAspect;
double monoSize = g_conf->_monoSize;
double propSize = g_conf->_propSize;
+ _fonts.resize(FONTS_TOTAL);
_fonts[0] = loadFont(MONOR, archive, monoSize, monoAspect, FONTR);
_fonts[1] = loadFont(MONOB, archive, monoSize, monoAspect, FONTB);
_fonts[2] = loadFont(MONOI, archive, monoSize, monoAspect, FONTI);
@@ -137,9 +144,6 @@ bool Screen::loadFonts() {
_fonts[5] = loadFont(PROPB, archive, propSize, propAspect, FONTB);
_fonts[6] = loadFont(PROPI, archive, propSize, propAspect, FONTI);
_fonts[7] = loadFont(PROPZ, archive, propSize, propAspect, FONTZ);
-
- delete archive;
- return true;
}
const Graphics::Font *Screen::loadFont(FACES face, Common::Archive *archive, double size, double aspect, int