aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDenis Kasak2009-06-14 16:21:44 +0000
committerDenis Kasak2009-06-14 16:21:44 +0000
commit15a35e359d6a5a973a434b03626bc0e1e5001a0f (patch)
tree6c6707a6471a7aa0f139dad48b0f781f384cc257 /engines
parent7e7e96e77d849439ceed742f56cf757d116de3f6 (diff)
downloadscummvm-rg350-15a35e359d6a5a973a434b03626bc0e1e5001a0f.tar.gz
scummvm-rg350-15a35e359d6a5a973a434b03626bc0e1e5001a0f.tar.bz2
scummvm-rg350-15a35e359d6a5a973a434b03626bc0e1e5001a0f.zip
Changed DraciFont API to accept const Strings when loading fonts and added constants for font types.
svn-id: r41522
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/draci.cpp6
-rw-r--r--engines/draci/font.cpp4
-rw-r--r--engines/draci/font.h7
3 files changed, 9 insertions, 8 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index 1a2660acc0..151fb046ed 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -132,16 +132,14 @@ int DraciEngine::go() {
_system->fillScreen(255);
// Draw big string
- path = "Big.fon";
- DraciFont font(path);
+ DraciFont font(kFontBig);
Common::String testString = "Testing, testing, read all about it!";
Graphics::Surface *surf = _system->lockScreen();
font.drawString(surf, testString,
(320 - font.getStringWidth(testString, 1)) / 2, 130, 1);
// Draw small string
- path = "Small.fon";
- font.setFont(path);
+ font.setFont(kFontSmall);
testString = "I'm smaller than the font above me.";
font.drawString(surf, testString,
(320 - font.getStringWidth(testString, 1)) / 2, 150, 1);
diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp
index 72434d9aa0..284c6b8f48 100644
--- a/engines/draci/font.cpp
+++ b/engines/draci/font.cpp
@@ -30,7 +30,7 @@
namespace Draci {
-DraciFont::DraciFont(Common::String &filename) :
+DraciFont::DraciFont(const Common::String &filename) :
_fontHeight(0), _maxCharWidth(0),
_charWidths(NULL), _charData(0) {
setFont(filename);
@@ -58,7 +58,7 @@ DraciFont::~DraciFont() {
* [138 * fontHeight * maxWidth bytes] character data, stored row-wise
*/
-bool DraciFont::setFont(Common::String &filename) {
+bool DraciFont::setFont(const Common::String &filename) {
// Free previously loaded font (if any)
freeFont();
diff --git a/engines/draci/font.h b/engines/draci/font.h
index e222cd5e11..b28b1ec338 100644
--- a/engines/draci/font.h
+++ b/engines/draci/font.h
@@ -27,6 +27,9 @@
namespace Draci {
+const Common::String kFontSmall("Small.fon");
+const Common::String kFontBig("Big.fon");
+
/**
* Represents the game's fonts. See docs for setFont() for font format details.
*/
@@ -34,9 +37,9 @@ namespace Draci {
class DraciFont {
public:
- DraciFont(Common::String &filename);
+ DraciFont(const Common::String &filename);
~DraciFont();
- bool setFont(Common::String &filename);
+ bool setFont(const Common::String &filename);
uint8 getFontHeight() const { return _fontHeight; };
uint8 getMaxCharWidth() const { return _maxCharWidth; };
uint8 getCharWidth(byte chr) const;