aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-09-19 22:37:00 +0000
committerMax Horn2002-09-19 22:37:00 +0000
commit85aa2cd8e8ba3338108df15148211bc5e1c45df9 (patch)
tree8250f8fd93e7189cc3d9817109d53fc35a120bc8
parent5f716f54f05533ff22d5a6d0d2f121065fcb572f (diff)
downloadscummvm-rg350-85aa2cd8e8ba3338108df15148211bc5e1c45df9.tar.gz
scummvm-rg350-85aa2cd8e8ba3338108df15148211bc5e1c45df9.tar.bz2
scummvm-rg350-85aa2cd8e8ba3338108df15148211bc5e1c45df9.zip
found out that guifont actually contains a char width table -> make use of it now
svn-id: r4976
-rw-r--r--gui/newgui.cpp49
1 files changed, 7 insertions, 42 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 036619fefe..d110c474c9 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -38,7 +38,8 @@
*/
// Built-in font
-static byte guifont[] = {0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,0,0,0,0,0,0,0,0,0,0,0,0,4,3,7,8,7,7,8,4,5,5,8,7,4,7,3,8,7,7,7,7,8,7,7,7,7,7,3,4,7,5,7,7,8,7,7,7,7,7,7,7,7,5,7,7,
+static byte guifont[] = {
+0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,0,0,0,0,0,0,0,0,0,0,0,0,4,3,7,8,7,7,8,4,5,5,8,7,4,7,3,8,7,7,7,7,8,7,7,7,7,7,3,4,7,5,7,7,8,7,7,7,7,7,7,7,7,5,7,7,
7,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,8,5,8,8,7,7,7,6,7,7,7,7,7,5,6,7,5,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,3,5,0,8,7,7,7,7,7,7,0,6,7,7,7,5,5,5,7,0,6,8,8,7,7,7,7,7,0,7,7,0,0,
0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,1,3,6,12,
24,62,3,0,128,192,96,48,24,124,192,0,0,3,62,24,12,6,3,1,0,192,124,24,48,96,192,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -63,7 +64,8 @@ static byte guifont[] = {0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,28,54,54,124,102,102,124,64,0,0,0};
+0,0,0,0,0,0,28,54,54,124,102,102,124,64,0,0,0
+};
// Constructor
NewGui::NewGui(Scumm *s) : _s(s), _system(s->_system), _screen(0),
@@ -384,13 +386,12 @@ void NewGui::addDirtyRect(int x, int y, int w, int h)
_system->copy_rect_overlay(buf, _screen_pitch, x, y, w, h);
}
-void NewGui::drawChar(const char str, int xx, int yy, int16 color)
+void NewGui::drawChar(const char chr, int xx, int yy, int16 color)
{
unsigned int buffer = 0, mask = 0, x, y;
byte *tmp;
- tmp = &guifont[0];
- tmp += 224 + (str + 1) * 8;
+ tmp = guifont + 224 + (chr + 1) * 8;
int16 *ptr = getBasePtr(xx, yy);
if (ptr == NULL)
@@ -421,43 +422,7 @@ int NewGui::getStringWidth(const char *str)
int NewGui::getCharWidth(char c)
{
- int space;
-
- switch (c) {
- case '.':
- case ':':
- case '\'':
- case '!':
- space = 3;
- break;
- case 'I':
- case 'i':
- case 'l':
- space = 5;
- break;
- case ';':
- case ' ':
- space = 4;
- break;
- case '(':
- case ')':
- space = 5;
- break;
- case 'c':
- space = 6;
- break;
- case '4':
- case '/':
- case 'W':
- case 'w':
- case 'M':
- case 'm':
- space = 8;
- break;
- default:
- space = 7;
- }
- return space;
+ return guifont[c+6];
}
void NewGui::drawString(const char *str, int x, int y, int w, int16 color, int align)