From 149b45f7a59c5319c912d13d8259b63b5fbb2a21 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Sun, 14 Jun 2009 16:33:20 +0000 Subject: Renamed DraciFont class to Font to be more consistent with the rest of the classes and other engines. svn-id: r41523 --- engines/draci/draci.cpp | 2 +- engines/draci/font.cpp | 18 +++++++++--------- engines/draci/font.h | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 151fb046ed..a75080d31d 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -132,7 +132,7 @@ int DraciEngine::go() { _system->fillScreen(255); // Draw big string - DraciFont font(kFontBig); + Font font(kFontBig); Common::String testString = "Testing, testing, read all about it!"; Graphics::Surface *surf = _system->lockScreen(); font.drawString(surf, testString, diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp index 284c6b8f48..104b341fd1 100644 --- a/engines/draci/font.cpp +++ b/engines/draci/font.cpp @@ -30,13 +30,13 @@ namespace Draci { -DraciFont::DraciFont(const Common::String &filename) : +Font::Font(const Common::String &filename) : _fontHeight(0), _maxCharWidth(0), _charWidths(NULL), _charData(0) { setFont(filename); } -DraciFont::~DraciFont() { +Font::~Font() { freeFont(); } @@ -45,7 +45,7 @@ DraciFont::~DraciFont() { * @param path Path to font file * @return true if the font was loaded successfully, false otherwise * - * Loads fonts from a file into a DraciFont instance. The original game uses two + * Loads fonts from a file into a Font instance. The original game uses two * fonts (located inside files "Small.fon" and "Big.fon"). The characters in the * font are indexed from the space character so an appropriate offset must be * added to convert them to equivalent char values, i.e. kDraciIndexOffset. @@ -58,7 +58,7 @@ DraciFont::~DraciFont() { * [138 * fontHeight * maxWidth bytes] character data, stored row-wise */ -bool DraciFont::setFont(const Common::String &filename) { +bool Font::setFont(const Common::String &filename) { // Free previously loaded font (if any) freeFont(); @@ -96,12 +96,12 @@ bool DraciFont::setFont(const Common::String &filename) { return true; } -void DraciFont::freeFont() { +void Font::freeFont() { delete[] _charWidths; delete[] _charData; } -uint8 DraciFont::getCharWidth(uint8 chr) const { +uint8 Font::getCharWidth(uint8 chr) const { return _charWidths[chr - kCharIndexOffset]; } @@ -114,7 +114,7 @@ uint8 DraciFont::getCharWidth(uint8 chr) const { * @param ty Vertical offset on the surface */ -void DraciFont::drawChar(Graphics::Surface *dst, uint8 chr, int tx, int ty) const { +void Font::drawChar(Graphics::Surface *dst, uint8 chr, int tx, int ty) const { assert(dst != NULL); assert(tx >= 0); assert(ty >= 0); @@ -155,7 +155,7 @@ void DraciFont::drawChar(Graphics::Surface *dst, uint8 chr, int tx, int ty) cons * @param spacing Space to leave between individual characters. Defaults to 0. */ -void DraciFont::drawString(Graphics::Surface *dst, Common::String &str, +void Font::drawString(Graphics::Surface *dst, Common::String &str, int x, int y, int spacing) const { assert(dst != NULL); assert(x >= 0); @@ -185,7 +185,7 @@ void DraciFont::drawString(Graphics::Surface *dst, Common::String &str, * @return The calculated width of the string */ -int DraciFont::getStringWidth(Common::String &str, int spacing) const { +int Font::getStringWidth(Common::String &str, int spacing) const { int width = 0; uint len = str.size(); for (unsigned int i = 0; i < len; ++i) { diff --git a/engines/draci/font.h b/engines/draci/font.h index b28b1ec338..ddc6eaec7e 100644 --- a/engines/draci/font.h +++ b/engines/draci/font.h @@ -34,11 +34,11 @@ const Common::String kFontBig("Big.fon"); * Represents the game's fonts. See docs for setFont() for font format details. */ -class DraciFont { +class Font { public: - DraciFont(const Common::String &filename); - ~DraciFont(); + Font(const Common::String &filename); + ~Font(); bool setFont(const Common::String &filename); uint8 getFontHeight() const { return _fontHeight; }; uint8 getMaxCharWidth() const { return _maxCharWidth; }; -- cgit v1.2.3