aboutsummaryrefslogtreecommitdiff
path: root/engines/made/resource.cpp
diff options
context:
space:
mode:
authorBenjamin Haisch2008-04-28 10:56:21 +0000
committerBenjamin Haisch2008-04-28 10:56:21 +0000
commitfc6fe46951f999d7fc14bf4bedcce7bfe728a77d (patch)
tree3d373e2c69567fd77dc61702857711ecea98bbff /engines/made/resource.cpp
parent6d3a7e4f6b90b4e24119af735b976031a6c9c7e7 (diff)
downloadscummvm-rg350-fc6fe46951f999d7fc14bf4bedcce7bfe728a77d.tar.gz
scummvm-rg350-fc6fe46951f999d7fc14bf4bedcce7bfe728a77d.tar.bz2
scummvm-rg350-fc6fe46951f999d7fc14bf4bedcce7bfe728a77d.zip
Implemented text drawing and cleanup.
svn-id: r31756
Diffstat (limited to 'engines/made/resource.cpp')
-rw-r--r--engines/made/resource.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp
index cfab28cca5..1eb04f6211 100644
--- a/engines/made/resource.cpp
+++ b/engines/made/resource.cpp
@@ -225,7 +225,7 @@ int FontResource::getHeight() const {
return _data[0];
}
-int FontResource::getCharWidth(char c) const {
+int FontResource::getCharWidth(uint c) const {
byte *charData = getCharData(c);
if (charData)
return charData[0];
@@ -233,7 +233,7 @@ int FontResource::getCharWidth(char c) const {
return 0;
}
-byte *FontResource::getChar(char c) const {
+byte *FontResource::getChar(uint c) const {
byte *charData = getCharData(c);
if (charData)
return charData + 1;
@@ -241,7 +241,17 @@ byte *FontResource::getChar(char c) const {
return NULL;
}
-byte *FontResource::getCharData(char c) const {
+int FontResource::getTextWidth(const char *text) {
+ int width = 0;
+ if (text) {
+ int len = strlen(text);
+ for (int pos = 0; pos < len; pos++)
+ width += getCharWidth(text[pos]);
+ }
+ return width;
+}
+
+byte *FontResource::getCharData(uint c) const {
if (c < 28 || c > 255)
return NULL;
return _data + 1 + (c - 28) * (getHeight() + 1);