From 491800c19a73dc281823635a5406ecc488ce6408 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Wed, 17 Jun 2009 21:07:59 +0000 Subject: Changed the _font DraciEngine member from a Font instance to a pointer to an instance. This way the default constructor is invoked in DraciEngine::init() and can properly initialize the fonts because the game data paths are set. svn-id: r41612 --- engines/draci/draci.cpp | 17 +++++++++-------- engines/draci/draci.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 2ffec72927..1ee757ccb3 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -68,10 +68,11 @@ int DraciEngine::init() { // Initialize graphics using following: initGraphics(_screenWidth, _screenHeight, false); - _screen = new Screen(this); + _screen = new Screen(this); + _font = new Font(); // Load default font - _font.setFont(kFontBig); + _font->setFont(kFontBig); // Basic archive test debugC(2, kDraciGeneralDebugLevel, "Running archive tests..."); @@ -138,18 +139,18 @@ int DraciEngine::go() { // Draw big string Common::String testString = "Testing, testing, read all about it!"; Graphics::Surface *surf = _screen->getSurface(); - _font.drawString(surf, testString, - (320 - _font.getStringWidth(testString, 1)) / 2, 130, 1); + _font->drawString(surf, testString, + (320 - _font->getStringWidth(testString, 1)) / 2, 130, 1); // Draw small string - _font.setFont(kFontSmall); + _font->setFont(kFontSmall); testString = "I'm smaller than the font above me."; - _font.drawString(surf, testString, - (320 - _font.getStringWidth(testString, 1)) / 2, 150, 1); + _font->drawString(surf, testString, + (320 - _font->getStringWidth(testString, 1)) / 2, 150, 1); // Overflow handling test testString = "Checking overflooooooooooooooooooooooooow..."; - _font.drawString(surf, testString, 50, 170, 1); + _font->drawString(surf, testString, 50, 170, 1); _screen->copyToScreen(); diff --git a/engines/draci/draci.h b/engines/draci/draci.h index 481de8e4b3..cfc1e5c307 100644 --- a/engines/draci/draci.h +++ b/engines/draci/draci.h @@ -46,7 +46,7 @@ public: bool hasFeature(Engine::EngineFeature f) const; - Font _font; + Font *_font; Screen *_screen; int _screenWidth; -- cgit v1.2.3