From a4a3ad123cb407fc9862acb43d3ca2ea27d2da2b Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Wed, 15 Jul 2009 18:16:54 +0000 Subject: Renamed Font::setFont() to loadFont(). Removed DraciEngine::_font and added _smallFont and _bigFont so each font can be handled separately. svn-id: r42514 --- engines/draci/draci.cpp | 13 ++++++++----- engines/draci/draci.h | 4 +++- engines/draci/font.cpp | 16 ++-------------- engines/draci/font.h | 3 +-- 4 files changed, 14 insertions(+), 22 deletions(-) (limited to 'engines') diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index e9df63f9cd..1575ee2545 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -85,16 +85,16 @@ int DraciEngine::init() { _overlaysArchive = new BArchive(overlaysPath); _animationsArchive = new BArchive(animationsPath); + // Load the game's fonts + _smallFont = new Font(kFontSmall); + _bigFont = new Font(kFontBig); + _screen = new Screen(this); - _font = new Font(); _anims = new AnimationManager(this); _mouse = new Mouse(this); _script = new Script(this); _game = new Game(this); - // Load default font - _font->setFont(kFontBig); - if(!_objectsArchive->isOpen()) { debugC(2, kDraciGeneralDebugLevel, "ERROR - Opening objects archive failed"); return Common::kUnknownError; @@ -166,8 +166,11 @@ DraciEngine::~DraciEngine() { // Dispose your resources here // TODO: Investigate possibility of using sharedPtr or similar + + delete _smallFont; + delete _bigFont; + delete _screen; - delete _font; delete _mouse; delete _game; delete _script; diff --git a/engines/draci/draci.h b/engines/draci/draci.h index bdab419e64..c01a30a7e4 100644 --- a/engines/draci/draci.h +++ b/engines/draci/draci.h @@ -51,13 +51,15 @@ public: bool hasFeature(Engine::EngineFeature f) const; - Font *_font; Screen *_screen; Mouse *_mouse; Game *_game; Script *_script; AnimationManager *_anims; + Font *_smallFont; + Font *_bigFont; + BArchive *_objectsArchive; BArchive *_spritesArchive; BArchive *_paletteArchive; diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp index 8a6f353876..f1ef984adf 100644 --- a/engines/draci/font.cpp +++ b/engines/draci/font.cpp @@ -33,18 +33,6 @@ namespace Draci { const Common::String kFontSmall("Small.fon"); const Common::String kFontBig("Big.fon"); -Font::Font() { - - _fontHeight = 0; - _maxCharWidth = 0; - _charWidths = NULL; - _charData = NULL; - - setFont(kFontBig); - - _currentFontColour = kFontColour1; -} - Font::Font(const Common::String &filename) { _fontHeight = 0; @@ -52,7 +40,7 @@ Font::Font(const Common::String &filename) { _charWidths = NULL; _charData = NULL; - setFont(filename); + loadFont(filename); _currentFontColour = kFontColour1; } @@ -88,7 +76,7 @@ void Font::setColour(uint8 colour) { * [138 * fontHeight * maxWidth bytes] character data, stored row-wise */ -bool Font::setFont(const Common::String &filename) { +bool Font::loadFont(const Common::String &filename) { // Free previously loaded font (if any) freeFont(); diff --git a/engines/draci/font.h b/engines/draci/font.h index cdce071e5a..c269124919 100644 --- a/engines/draci/font.h +++ b/engines/draci/font.h @@ -53,11 +53,10 @@ class Font { public: - Font(); Font(const Common::String &filename); ~Font(); - bool setFont(const Common::String &filename); + bool loadFont(const Common::String &filename); uint8 getFontHeight() const { return _fontHeight; }; uint8 getMaxCharWidth() const { return _maxCharWidth; }; uint8 getCharWidth(byte chr) const; -- cgit v1.2.3