[Scummvm-cvs-logs] SF.net SVN: scummvm:[41522] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Sun Jun 14 18:21:45 CEST 2009
Revision: 41522
http://scummvm.svn.sourceforge.net/scummvm/?rev=41522&view=rev
Author: dkasak13
Date: 2009-06-14 16:21:44 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Changed DraciFont API to accept const Strings when loading fonts and added constants for font types.
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
scummvm/branches/gsoc2009-draci/engines/draci/font.h
Modified: scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp 2009-06-14 15:07:57 UTC (rev 41521)
+++ scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp 2009-06-14 16:21:44 UTC (rev 41522)
@@ -132,16 +132,14 @@
_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);
Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.cpp 2009-06-14 15:07:57 UTC (rev 41521)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.cpp 2009-06-14 16:21:44 UTC (rev 41522)
@@ -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 @@
* [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();
Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.h 2009-06-14 15:07:57 UTC (rev 41521)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.h 2009-06-14 16:21:44 UTC (rev 41522)
@@ -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 @@
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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list