1 | /*-------------------------------------------------------------------------
|
---|
2 | This source file is a part of OGRE
|
---|
3 | (Object-oriented Graphics Rendering Engine)
|
---|
4 |
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This library is free software; you can redistribute it and/or modify it
|
---|
11 | under the terms of the GNU Lesser General Public License (LGPL) as
|
---|
12 | published by the Free Software Foundation; either version 2.1 of the
|
---|
13 | License, or (at your option) any later version.
|
---|
14 |
|
---|
15 | This library is distributed in the hope that it will be useful, but
|
---|
16 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
---|
17 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
---|
18 | License for more details.
|
---|
19 |
|
---|
20 | You should have received a copy of the GNU Lesser General Public License
|
---|
21 | along with this library; if not, write to the Free Software Foundation,
|
---|
22 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or go to
|
---|
23 | http://www.gnu.org/copyleft/lesser.txt
|
---|
24 | -------------------------------------------------------------------------*/
|
---|
25 |
|
---|
26 | #ifndef _FontManager_H__
|
---|
27 | #define _FontManager_H__
|
---|
28 |
|
---|
29 | #include "OgrePrerequisites.h"
|
---|
30 | #include "OgreSingleton.h"
|
---|
31 | #include "OgreResourceManager.h"
|
---|
32 | #include "OgreFont.h"
|
---|
33 |
|
---|
34 | namespace Ogre
|
---|
35 | {
|
---|
36 | /** Manages Font resources, parsing .fontdef files and generally organising them.*/
|
---|
37 | class _OgreExport FontManager : public ResourceManager, public Singleton< FontManager >
|
---|
38 | {
|
---|
39 | public:
|
---|
40 |
|
---|
41 | FontManager();
|
---|
42 | ~FontManager();
|
---|
43 |
|
---|
44 | /** @copydoc ScriptLoader::parseScript */
|
---|
45 | void parseScript(DataStreamPtr& stream, const String& groupName);
|
---|
46 | /** Override standard Singleton retrieval.
|
---|
47 | @remarks
|
---|
48 | Why do we do this? Well, it's because the Singleton
|
---|
49 | implementation is in a .h file, which means it gets compiled
|
---|
50 | into anybody who includes it. This is needed for the
|
---|
51 | Singleton template to work, but we actually only want it
|
---|
52 | compiled into the implementation of the class based on the
|
---|
53 | Singleton, not all of them. If we don't change this, we get
|
---|
54 | link errors when trying to use the Singleton-based class from
|
---|
55 | an outside dll.
|
---|
56 | @par
|
---|
57 | This method just delegates to the template version anyway,
|
---|
58 | but the implementation stays in this single compilation unit,
|
---|
59 | preventing link errors.
|
---|
60 | */
|
---|
61 | static FontManager& getSingleton(void);
|
---|
62 | /** Override standard Singleton retrieval.
|
---|
63 | @remarks
|
---|
64 | Why do we do this? Well, it's because the Singleton
|
---|
65 | implementation is in a .h file, which means it gets compiled
|
---|
66 | into anybody who includes it. This is needed for the
|
---|
67 | Singleton template to work, but we actually only want it
|
---|
68 | compiled into the implementation of the class based on the
|
---|
69 | Singleton, not all of them. If we don't change this, we get
|
---|
70 | link errors when trying to use the Singleton-based class from
|
---|
71 | an outside dll.
|
---|
72 | @par
|
---|
73 | This method just delegates to the template version anyway,
|
---|
74 | but the implementation stays in this single compilation unit,
|
---|
75 | preventing link errors.
|
---|
76 | */
|
---|
77 | static FontManager* getSingletonPtr(void);
|
---|
78 |
|
---|
79 | protected:
|
---|
80 |
|
---|
81 | /// Internal methods
|
---|
82 | Resource* createImpl(const String& name, ResourceHandle handle,
|
---|
83 | const String& group, bool isManual, ManualResourceLoader* loader,
|
---|
84 | const NameValuePairList* params);
|
---|
85 | void parseAttribute(const String& line, FontPtr& pFont);
|
---|
86 |
|
---|
87 | void logBadAttrib(const String& line, FontPtr& pFont);
|
---|
88 |
|
---|
89 |
|
---|
90 | };
|
---|
91 | }
|
---|
92 |
|
---|
93 | #endif
|
---|