aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorMax Horn2005-01-06 22:48:42 +0000
committerMax Horn2005-01-06 22:48:42 +0000
commit858c6c4d5bb40a29550009b07f8d4b583d3f03cb (patch)
tree34d59d4b04392c72a73bae02d35681abcf2a4901 /graphics
parenta9d0472758f4fb43edc0ea6602f59ef7f8075ec5 (diff)
downloadscummvm-rg350-858c6c4d5bb40a29550009b07f8d4b583d3f03cb.tar.gz
scummvm-rg350-858c6c4d5bb40a29550009b07f8d4b583d3f03cb.tar.bz2
scummvm-rg350-858c6c4d5bb40a29550009b07f8d4b583d3f03cb.zip
Switching GUI to an alternate font; using a second, bigger, font for 640x480 games like COMI. Note: we can always easily switch back to the SCUMM font or any other font, if we want to
svn-id: r16467
Diffstat (limited to 'graphics')
-rw-r--r--graphics/font.cpp26
-rw-r--r--graphics/font.h8
-rw-r--r--graphics/fontman.cpp5
-rw-r--r--graphics/fontman.h3
-rw-r--r--graphics/module.mk1
-rw-r--r--graphics/scummfont.cpp18
6 files changed, 23 insertions, 38 deletions
diff --git a/graphics/font.cpp b/graphics/font.cpp
index aac9813bca..f5a6135dff 100644
--- a/graphics/font.cpp
+++ b/graphics/font.cpp
@@ -36,9 +36,8 @@ int NewFont::getCharWidth(byte chr) const {
return desc.width[chr - desc.firstchar];
}
-void NewFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color, int scaleFactor) const {
+void NewFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color) const {
assert(dst != 0);
- tx *= scaleFactor; ty *= scaleFactor;
byte *ptr = (byte *)dst->getBasePtr(tx, ty);
@@ -56,26 +55,15 @@ void NewFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 colo
chr -= desc.firstchar;
const bitmap_t *tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * desc.height));
- for (int y = 0; y < desc.height * scaleFactor; y++, ptr += dst->pitch) {
+ for (int y = 0; y < desc.height; y++, ptr += dst->pitch) {
const bitmap_t *buffer = 0;
- if(scaleFactor != 1) {
- if(!(y % 2))
- buffer = tmp++;
- else
- buffer = tmp;
- } else
- buffer = tmp++;
+ buffer = tmp++;
bitmap_t mask = 0x8000;
if (ty + y < 0 || ty + y >= dst->h)
continue;
- for (int x = 0; x < w * scaleFactor; x++) {
- if(scaleFactor != 1) {
- if(!(x % 2) && x != 0)
- mask >>= 1;
- } else if(x != 0) {
- mask >>= 1;
- }
+ for (int x = 0; x < w; x++) {
+ mask >>= 1;
if (tx + x < 0 || tx + x >= dst->w)
continue;
@@ -101,7 +89,7 @@ int Font::getStringWidth(const Common::String &str) const {
return space;
}
-void Font::drawString(const Surface *dst, const Common::String &s, int x, int y, int w, uint32 color, TextAlignment align, int deltax, bool useEllipsis, int scaleFactor) const {
+void Font::drawString(const Surface *dst, const Common::String &s, int x, int y, int w, uint32 color, TextAlignment align, int deltax, bool useEllipsis) const {
assert(dst != 0);
const int leftX = x, rightX = x + w;
uint i;
@@ -166,7 +154,7 @@ void Font::drawString(const Surface *dst, const Common::String &s, int x, int y,
if (x+w > rightX)
break;
if (x >= leftX)
- drawChar(dst, str[i], x, y, color, scaleFactor);
+ drawChar(dst, str[i], x, y, color);
x += w;
}
}
diff --git a/graphics/font.h b/graphics/font.h
index 4bacda5dde..134ba8bb48 100644
--- a/graphics/font.h
+++ b/graphics/font.h
@@ -52,9 +52,9 @@ public:
virtual int getMaxCharWidth() const = 0;
virtual int getCharWidth(byte chr) const = 0;
- virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color, int scaleFactor = 1) const = 0;
+ virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const = 0;
- void drawString(const Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlignment align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true, int scaleFactor = 1) const;
+ void drawString(const Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlignment align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
int getStringWidth(const Common::String &str) const;
};
@@ -65,7 +65,7 @@ public:
virtual int getMaxCharWidth() const { return 8; };
virtual int getCharWidth(byte chr) const;
- virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color, int scaleFactor) const;
+ virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const;
};
@@ -99,7 +99,7 @@ public:
virtual int getMaxCharWidth() const { return desc.maxwidth; };
virtual int getCharWidth(byte chr) const;
- virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color, int scaleFactor) const;
+ virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const;
};
} // End of namespace Graphics
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index 5ba5a80c0a..0bee9ea925 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -29,6 +29,7 @@ namespace Graphics {
const ScummFont g_scummfont;
extern const NewFont g_sysfont;
+extern const NewFont g_sysfont_big;
DECLARE_SINGLETON(FontManager);
@@ -46,7 +47,9 @@ const Font *FontManager::getFontByUsage(FontUsage usage) const {
case kConsoleFont:
return &GUI::g_consolefont;
case kGUIFont:
- return &g_scummfont;
+ return &g_sysfont;
+ case kBigGUIFont:
+ return &g_sysfont_big;
}
return 0;
}
diff --git a/graphics/fontman.h b/graphics/fontman.h
index 77d953b9e8..dff104f4c6 100644
--- a/graphics/fontman.h
+++ b/graphics/fontman.h
@@ -35,7 +35,8 @@ public:
enum FontUsage {
kOSDFont,
kConsoleFont,
- kGUIFont
+ kGUIFont,
+ kBigGUIFont
};
/**
diff --git a/graphics/module.mk b/graphics/module.mk
index fc608f12c5..0488ead3a6 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
graphics/font.o \
graphics/fontman.o \
graphics/newfont.o \
+ graphics/newfont_big.o \
graphics/surface.o
MODULE_DIRS += \
diff --git a/graphics/scummfont.cpp b/graphics/scummfont.cpp
index 7ec03edcb2..32935be6f8 100644
--- a/graphics/scummfont.cpp
+++ b/graphics/scummfont.cpp
@@ -63,9 +63,8 @@ int ScummFont::getCharWidth(byte chr) const {
}
//void ScummFont::drawChar(byte chr, int xx, int yy, OverlayColor color) {
-void ScummFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color, int scaleFactor) const {
+void ScummFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color) const {
assert(dst != 0);
- tx *= scaleFactor; ty *= scaleFactor;
byte *ptr = (byte *)dst->getBasePtr(tx, ty);
@@ -73,25 +72,18 @@ void ScummFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 co
uint buffer = 0;
uint mask = 0;
- for (int y = 0; y < 8 * scaleFactor; y++) {
+ for (int y = 0; y < 8; y++) {
if (ty + y < 0 || ty + y >= dst->h)
continue;
- for (int x = 0; x < 8 * scaleFactor; x++) {
- if(scaleFactor != 1 && !(x % 2))
- mask >>= 1;
- else if(scaleFactor == 1)
- mask >>= 1;
+ for (int x = 0; x < 8; x++) {
+ mask >>= 1;
if (tx + x < 0 || tx + x >= dst->w)
continue;
if (mask == 0) {
- if(scaleFactor != 1 && !(y % 2))
- buffer = *tmp++;
- else if(scaleFactor == 1)
- buffer = *tmp++;
-
+ buffer = *tmp++;
mask = 0x80;
}
const byte c = ((buffer & mask) != 0);