From a683a420a9e43705c972b5e74d55e319729e1a81 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 29 Jul 2010 19:53:02 +0000 Subject: SWORD25: Importing original sources svn-id: r53171 --- engines/sword25/gfx/fontresource.h | 104 +++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 engines/sword25/gfx/fontresource.h (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h new file mode 100755 index 0000000000..adb790be6b --- /dev/null +++ b/engines/sword25/gfx/fontresource.h @@ -0,0 +1,104 @@ +// ----------------------------------------------------------------------------- +// This file is part of Broken Sword 2.5 +// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer +// +// Broken Sword 2.5 is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Broken Sword 2.5 is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Broken Sword 2.5; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// ----------------------------------------------------------------------------- + +#ifndef BS_FONTRESOURCE_H +#define BS_FONTRESOURCE_H + +// ----------------------------------------------------------------------------- +// Includes +// ----------------------------------------------------------------------------- + +#include "kernel/common.h" +#include "kernel/resource.h" +#include "math/rect.h" + +// ----------------------------------------------------------------------------- +// Forward declarations +// ----------------------------------------------------------------------------- + +class BS_Kernel; +class TiXmlDocument; +class TiXmlElement; + +// ----------------------------------------------------------------------------- +// Klassendefinition +// ----------------------------------------------------------------------------- + +class BS_FontResource : public BS_Resource +{ +public: + /** + @brief Erzeugt eine neues Exemplar von BS_FontResource + @param pKernel ein Pointer auf den Kernel + @param FileName der Dateiname der zu ladenen Resource + @remark Wenn der Konstruktor erfolgreich ausgeführt werden konnte gibt die Methode IsValid true zurück. + */ + BS_FontResource(BS_Kernel * pKernel, const std::string & FileName); + + /** + @brief Gibt true zurück, wenn das Objekt korrekt initialisiert wurde. + + Diese Methode kann dazu benutzt werden um festzustellen, ob der Konstruktor erfolgreich ausgeführt wurde. + */ + bool IsValid() const { return _Valid; } + + /** + @brief Gibt die Zeilenhöhe des Fonts in Pixeln zurück. + + Die Zeilenhöhe ist der Wert, der zur Y-Koordinate addiert wird, wenn ein Zeilenumbruch auftritt. + */ + int GetLineHeight() const { return _LineHeight; } + + /** + @brief Gibt den Buchstabenabstand der Fonts in Pixeln zurück. + + Der Buchstabenabstand ist der Wert, der zwischen zwei Buchstaben freigelassen wird. + */ + int GetGapWidth() const { return _GapWidth; } + + /** + @brief Gibt das Bounding-Rect eines Zeichens auf der Charactermap zurück. + @param Character der ASCII-Code des Zeichens + @return Das Bounding-Rect des übergebenen Zeichens auf der Charactermap. + */ + const BS_Rect & GetCharacterRect(int Character) const { BS_ASSERT(Character >= 0 && Character < 256); return _CharacterRects[Character]; } + + /** + @brief Gibt den Dateinamen der Charactermap zurück. + */ + const std::string & GetCharactermapFileName() const { return _BitmapFileName; } + +private: + BS_Kernel * _pKernel; + bool _Valid; + std::string _BitmapFileName; + int _LineHeight; + int _GapWidth; + BS_Rect _CharacterRects[256]; + + // ----------------------------------------------------------------------------- + // Hilfsmethoden + // ----------------------------------------------------------------------------- + + bool _ParseXMLDocument(const std::string & FileName, TiXmlDocument & Doc) const; + bool _ParseFontTag(TiXmlElement & Tag, std::string & BitmapFileName, int & LineHeight, int & GapWidth) const; + bool _ParseCharacterTag(TiXmlElement & Tag, int & Code, BS_Rect & Rect) const; +}; + +#endif -- cgit v1.2.3 From e8bca8b8fe0f80e0d5053b190840b034f50ae163 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 30 Jul 2010 09:02:39 +0000 Subject: SWORD25: Fixed rest of the include paths svn-id: r53181 --- engines/sword25/gfx/fontresource.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index adb790be6b..497e5ad687 100755 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -17,16 +17,16 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // ----------------------------------------------------------------------------- -#ifndef BS_FONTRESOURCE_H -#define BS_FONTRESOURCE_H +#ifndef SWORD25_FONTRESOURCE_H +#define SWORD25_FONTRESOURCE_H // ----------------------------------------------------------------------------- // Includes // ----------------------------------------------------------------------------- -#include "kernel/common.h" -#include "kernel/resource.h" -#include "math/rect.h" +#include "sword25/kernel/common.h" +#include "sword25/kernel/resource.h" +#include "sword25/math/rect.h" // ----------------------------------------------------------------------------- // Forward declarations -- cgit v1.2.3 From 293bf95c01f76c8d812a300eb038854f1246ab3d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 31 Jul 2010 09:53:02 +0000 Subject: SWORD25: Replacing headers with ScummVM ones plus original (C) svn-id: r53188 --- engines/sword25/gfx/fontresource.h | 51 ++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 18 deletions(-) mode change 100755 => 100644 engines/sword25/gfx/fontresource.h (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h old mode 100755 new mode 100644 index 497e5ad687..2ac21ee15d --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -1,21 +1,36 @@ -// ----------------------------------------------------------------------------- -// This file is part of Broken Sword 2.5 -// Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdörfer -// -// Broken Sword 2.5 is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// Broken Sword 2.5 is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Broken Sword 2.5; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// ----------------------------------------------------------------------------- +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +/* + * This code is based on Broken Sword 2.5 engine + * + * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer + * + * Licensed under GNU GPL v2 + * + */ #ifndef SWORD25_FONTRESOURCE_H #define SWORD25_FONTRESOURCE_H -- cgit v1.2.3 From de0fe1db4939bbb787de60231dd30a7b5391f269 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 5 Aug 2010 12:48:19 +0000 Subject: SWORD25: Mass-putting of all files in gfx/ into Sword25 namespace svn-id: r53214 --- engines/sword25/gfx/fontresource.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index 2ac21ee15d..826a14522f 100644 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -43,6 +43,8 @@ #include "sword25/kernel/resource.h" #include "sword25/math/rect.h" +namespace Sword25 { + // ----------------------------------------------------------------------------- // Forward declarations // ----------------------------------------------------------------------------- @@ -116,4 +118,6 @@ private: bool _ParseCharacterTag(TiXmlElement & Tag, int & Code, BS_Rect & Rect) const; }; +} // End of namespace Sword25 + #endif -- cgit v1.2.3 From 6dcf9f0ee557e692df3c70a263ca35068ff45380 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 10:59:35 +0000 Subject: SWORD25: std::string -> Common::String in gfx/ svn-id: r53218 --- engines/sword25/gfx/fontresource.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index 826a14522f..dff0cee085 100644 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -66,7 +66,7 @@ public: @param FileName der Dateiname der zu ladenen Resource @remark Wenn der Konstruktor erfolgreich ausgeführt werden konnte gibt die Methode IsValid true zurück. */ - BS_FontResource(BS_Kernel * pKernel, const std::string & FileName); + BS_FontResource(BS_Kernel * pKernel, const Common::String & FileName); /** @brief Gibt true zurück, wenn das Objekt korrekt initialisiert wurde. @@ -99,12 +99,12 @@ public: /** @brief Gibt den Dateinamen der Charactermap zurück. */ - const std::string & GetCharactermapFileName() const { return _BitmapFileName; } + const Common::String & GetCharactermapFileName() const { return _BitmapFileName; } private: BS_Kernel * _pKernel; bool _Valid; - std::string _BitmapFileName; + Common::String _BitmapFileName; int _LineHeight; int _GapWidth; BS_Rect _CharacterRects[256]; @@ -113,8 +113,8 @@ private: // Hilfsmethoden // ----------------------------------------------------------------------------- - bool _ParseXMLDocument(const std::string & FileName, TiXmlDocument & Doc) const; - bool _ParseFontTag(TiXmlElement & Tag, std::string & BitmapFileName, int & LineHeight, int & GapWidth) const; + bool _ParseXMLDocument(const Common::String & FileName, TiXmlDocument & Doc) const; + bool _ParseFontTag(TiXmlElement & Tag, Common::String & BitmapFileName, int & LineHeight, int & GapWidth) const; bool _ParseCharacterTag(TiXmlElement & Tag, int & Code, BS_Rect & Rect) const; }; -- cgit v1.2.3 From a17ec87b7dd09e7b251a3f578d1f788917550451 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 10:59:50 +0000 Subject: SWORD25: Number of compilation and warning fixes svn-id: r53219 --- engines/sword25/gfx/fontresource.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index dff0cee085..fbaa368170 100644 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -43,6 +43,9 @@ #include "sword25/kernel/resource.h" #include "sword25/math/rect.h" +class TiXmlDocument; +class TiXmlElement; + namespace Sword25 { // ----------------------------------------------------------------------------- @@ -50,8 +53,6 @@ namespace Sword25 { // ----------------------------------------------------------------------------- class BS_Kernel; -class TiXmlDocument; -class TiXmlElement; // ----------------------------------------------------------------------------- // Klassendefinition -- cgit v1.2.3 From 47904bc7b2992189bb554833f00a79ff0fea9fb8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 6 Aug 2010 13:13:25 +0000 Subject: SWORD25: Mass-astyle. svn-id: r53222 --- engines/sword25/gfx/fontresource.h | 76 +++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 33 deletions(-) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index fbaa368170..d26c79c575 100644 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -23,7 +23,7 @@ * */ -/* +/* * This code is based on Broken Sword 2.5 engine * * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer @@ -58,65 +58,75 @@ class BS_Kernel; // Klassendefinition // ----------------------------------------------------------------------------- -class BS_FontResource : public BS_Resource -{ +class BS_FontResource : public BS_Resource { public: /** - @brief Erzeugt eine neues Exemplar von BS_FontResource - @param pKernel ein Pointer auf den Kernel - @param FileName der Dateiname der zu ladenen Resource - @remark Wenn der Konstruktor erfolgreich ausgeführt werden konnte gibt die Methode IsValid true zurück. + @brief Erzeugt eine neues Exemplar von BS_FontResource + @param pKernel ein Pointer auf den Kernel + @param FileName der Dateiname der zu ladenen Resource + @remark Wenn der Konstruktor erfolgreich ausgeführt werden konnte gibt die Methode IsValid true zurück. */ - BS_FontResource(BS_Kernel * pKernel, const Common::String & FileName); + BS_FontResource(BS_Kernel *pKernel, const Common::String &FileName); /** - @brief Gibt true zurück, wenn das Objekt korrekt initialisiert wurde. + @brief Gibt true zurück, wenn das Objekt korrekt initialisiert wurde. - Diese Methode kann dazu benutzt werden um festzustellen, ob der Konstruktor erfolgreich ausgeführt wurde. + Diese Methode kann dazu benutzt werden um festzustellen, ob der Konstruktor erfolgreich ausgeführt wurde. */ - bool IsValid() const { return _Valid; } + bool IsValid() const { + return _Valid; + } /** - @brief Gibt die Zeilenhöhe des Fonts in Pixeln zurück. + @brief Gibt die Zeilenhöhe des Fonts in Pixeln zurück. - Die Zeilenhöhe ist der Wert, der zur Y-Koordinate addiert wird, wenn ein Zeilenumbruch auftritt. + Die Zeilenhöhe ist der Wert, der zur Y-Koordinate addiert wird, wenn ein Zeilenumbruch auftritt. */ - int GetLineHeight() const { return _LineHeight; } + int GetLineHeight() const { + return _LineHeight; + } /** - @brief Gibt den Buchstabenabstand der Fonts in Pixeln zurück. + @brief Gibt den Buchstabenabstand der Fonts in Pixeln zurück. - Der Buchstabenabstand ist der Wert, der zwischen zwei Buchstaben freigelassen wird. + Der Buchstabenabstand ist der Wert, der zwischen zwei Buchstaben freigelassen wird. */ - int GetGapWidth() const { return _GapWidth; } + int GetGapWidth() const { + return _GapWidth; + } /** - @brief Gibt das Bounding-Rect eines Zeichens auf der Charactermap zurück. - @param Character der ASCII-Code des Zeichens - @return Das Bounding-Rect des übergebenen Zeichens auf der Charactermap. + @brief Gibt das Bounding-Rect eines Zeichens auf der Charactermap zurück. + @param Character der ASCII-Code des Zeichens + @return Das Bounding-Rect des übergebenen Zeichens auf der Charactermap. */ - const BS_Rect & GetCharacterRect(int Character) const { BS_ASSERT(Character >= 0 && Character < 256); return _CharacterRects[Character]; } + const BS_Rect &GetCharacterRect(int Character) const { + BS_ASSERT(Character >= 0 && Character < 256); + return _CharacterRects[Character]; + } /** - @brief Gibt den Dateinamen der Charactermap zurück. + @brief Gibt den Dateinamen der Charactermap zurück. */ - const Common::String & GetCharactermapFileName() const { return _BitmapFileName; } + const Common::String &GetCharactermapFileName() const { + return _BitmapFileName; + } private: - BS_Kernel * _pKernel; - bool _Valid; - Common::String _BitmapFileName; - int _LineHeight; - int _GapWidth; - BS_Rect _CharacterRects[256]; + BS_Kernel *_pKernel; + bool _Valid; + Common::String _BitmapFileName; + int _LineHeight; + int _GapWidth; + BS_Rect _CharacterRects[256]; // ----------------------------------------------------------------------------- // Hilfsmethoden // ----------------------------------------------------------------------------- - - bool _ParseXMLDocument(const Common::String & FileName, TiXmlDocument & Doc) const; - bool _ParseFontTag(TiXmlElement & Tag, Common::String & BitmapFileName, int & LineHeight, int & GapWidth) const; - bool _ParseCharacterTag(TiXmlElement & Tag, int & Code, BS_Rect & Rect) const; + + bool _ParseXMLDocument(const Common::String &FileName, TiXmlDocument &Doc) const; + bool _ParseFontTag(TiXmlElement &Tag, Common::String &BitmapFileName, int &LineHeight, int &GapWidth) const; + bool _ParseCharacterTag(TiXmlElement &Tag, int &Code, BS_Rect &Rect) const; }; } // End of namespace Sword25 -- cgit v1.2.3 From 485ff15d23b3ae9545f5c9df794f1326185eae7a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 10:52:24 +0000 Subject: SWORD25: Mass-eliminating of BS_ prefix in fmv/ and gfx/ svn-id: r53258 --- engines/sword25/gfx/fontresource.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index d26c79c575..8c45219b37 100644 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -58,7 +58,7 @@ class BS_Kernel; // Klassendefinition // ----------------------------------------------------------------------------- -class BS_FontResource : public BS_Resource { +class FontResource : public BS_Resource { public: /** @brief Erzeugt eine neues Exemplar von BS_FontResource @@ -66,7 +66,7 @@ public: @param FileName der Dateiname der zu ladenen Resource @remark Wenn der Konstruktor erfolgreich ausgeführt werden konnte gibt die Methode IsValid true zurück. */ - BS_FontResource(BS_Kernel *pKernel, const Common::String &FileName); + FontResource(BS_Kernel *pKernel, const Common::String &FileName); /** @brief Gibt true zurück, wenn das Objekt korrekt initialisiert wurde. -- cgit v1.2.3 From b01994a53bbc96da907a4c28934e644184291017 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 18 Aug 2010 12:58:22 +0000 Subject: SWORD25: removed BS_ prefix from rest of the classes. The things which are intentionally left with the prefix: BS_LOG, BS_ASSERT, BS_Rect, BS_String. svn-id: r53261 --- engines/sword25/gfx/fontresource.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index 8c45219b37..3888927f9c 100644 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -52,13 +52,13 @@ namespace Sword25 { // Forward declarations // ----------------------------------------------------------------------------- -class BS_Kernel; +class Kernel; // ----------------------------------------------------------------------------- // Klassendefinition // ----------------------------------------------------------------------------- -class FontResource : public BS_Resource { +class FontResource : public Resource { public: /** @brief Erzeugt eine neues Exemplar von BS_FontResource @@ -66,7 +66,7 @@ public: @param FileName der Dateiname der zu ladenen Resource @remark Wenn der Konstruktor erfolgreich ausgeführt werden konnte gibt die Methode IsValid true zurück. */ - FontResource(BS_Kernel *pKernel, const Common::String &FileName); + FontResource(Kernel *pKernel, const Common::String &FileName); /** @brief Gibt true zurück, wenn das Objekt korrekt initialisiert wurde. @@ -113,7 +113,7 @@ public: } private: - BS_Kernel *_pKernel; + Kernel *_pKernel; bool _Valid; Common::String _BitmapFileName; int _LineHeight; -- cgit v1.2.3 From 1d16dfd281b30627ce0ade7c6c2de0cb7e4cc985 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Aug 2010 08:20:32 +0000 Subject: SWORD25: Refactored engine to remove BS_Rect class svn-id: r53265 --- engines/sword25/gfx/fontresource.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index 3888927f9c..786405fe11 100644 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -41,7 +41,7 @@ #include "sword25/kernel/common.h" #include "sword25/kernel/resource.h" -#include "sword25/math/rect.h" +#include "common/rect.h" class TiXmlDocument; class TiXmlElement; @@ -100,7 +100,7 @@ public: @param Character der ASCII-Code des Zeichens @return Das Bounding-Rect des übergebenen Zeichens auf der Charactermap. */ - const BS_Rect &GetCharacterRect(int Character) const { + const Common::Rect &GetCharacterRect(int Character) const { BS_ASSERT(Character >= 0 && Character < 256); return _CharacterRects[Character]; } @@ -118,7 +118,7 @@ private: Common::String _BitmapFileName; int _LineHeight; int _GapWidth; - BS_Rect _CharacterRects[256]; + Common::Rect _CharacterRects[256]; // ----------------------------------------------------------------------------- // Hilfsmethoden @@ -126,7 +126,7 @@ private: bool _ParseXMLDocument(const Common::String &FileName, TiXmlDocument &Doc) const; bool _ParseFontTag(TiXmlElement &Tag, Common::String &BitmapFileName, int &LineHeight, int &GapWidth) const; - bool _ParseCharacterTag(TiXmlElement &Tag, int &Code, BS_Rect &Rect) const; + bool _ParseCharacterTag(TiXmlElement &Tag, int &Code, Common::Rect &Rect) const; }; } // End of namespace Sword25 -- cgit v1.2.3 From b294e88f7e89a0b3d89b5d184e1b491eaddff70f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 Aug 2010 02:06:18 +0000 Subject: SWORD25: Converted FontResource to use ScummVM XML Parser svn-id: r53277 --- engines/sword25/gfx/fontresource.h | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'engines/sword25/gfx/fontresource.h') diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h index 786405fe11..cfb0251084 100644 --- a/engines/sword25/gfx/fontresource.h +++ b/engines/sword25/gfx/fontresource.h @@ -39,12 +39,11 @@ // Includes // ----------------------------------------------------------------------------- +#include "common/scummsys.h" +#include "common/rect.h" +#include "common/xmlparser.h" #include "sword25/kernel/common.h" #include "sword25/kernel/resource.h" -#include "common/rect.h" - -class TiXmlDocument; -class TiXmlElement; namespace Sword25 { @@ -58,7 +57,7 @@ class Kernel; // Klassendefinition // ----------------------------------------------------------------------------- -class FontResource : public Resource { +class FontResource : public Resource, Common::XMLParser { public: /** @brief Erzeugt eine neues Exemplar von BS_FontResource @@ -120,13 +119,34 @@ private: int _GapWidth; Common::Rect _CharacterRects[256]; + // Parser + CUSTOM_XML_PARSER(FontResource) { + XML_KEY(font) + XML_PROP(bitmap, true) + XML_PROP(lineheight, false) + XML_PROP(gap, false) + + XML_KEY(character) + XML_PROP(code, true) + XML_PROP(left, true) + XML_PROP(top, true) + XML_PROP(right, true) + XML_PROP(bottom, true) + KEY_END() + KEY_END() + } PARSER_END() + + // Parser callback methods + bool parserCallback_font(ParserNode *node); + bool parserCallback_character(ParserNode *node); + // ----------------------------------------------------------------------------- // Hilfsmethoden // ----------------------------------------------------------------------------- - bool _ParseXMLDocument(const Common::String &FileName, TiXmlDocument &Doc) const; - bool _ParseFontTag(TiXmlElement &Tag, Common::String &BitmapFileName, int &LineHeight, int &GapWidth) const; - bool _ParseCharacterTag(TiXmlElement &Tag, int &Code, Common::Rect &Rect) const; +// bool _ParseXMLDocument(const Common::String &FileName, TiXmlDocument &Doc) const; +// bool _ParseFontTag(TiXmlElement &Tag, Common::String &BitmapFileName, int &LineHeight, int &GapWidth) const; +// bool _ParseCharacterTag(TiXmlElement &Tag, int &Code, Common::Rect &Rect) const; }; } // End of namespace Sword25 -- cgit v1.2.3