FIFE
2008.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Functions
Variables
Enumerations
Enumerator
Pages
imagefontbase.h
1
/***************************************************************************
2
* Copyright (C) 2005-2009 by the FIFE team *
3
* http://www.fifengine.de *
4
* This file is part of FIFE. *
5
* *
6
* FIFE is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Lesser General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2.1 of the License, or (at your option) any later version. *
10
* *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14
* Lesser General Public License for more details. *
15
* *
16
* You should have received a copy of the GNU Lesser General Public *
17
* License along with this library; if not, write to the *
18
* Free Software Foundation, Inc., *
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20
***************************************************************************/
21
22
#ifndef FIFE_FONTS_IMAGEFONTBASE_H
23
#define FIFE_FONTS_IMAGEFONTBASE_H
24
25
// Standard C++ library includes
26
#include <map>
27
#include <string>
28
29
// 3rd party library includes
30
31
// FIFE includes
32
// These includes are split up in two parts, separated by one empty line
33
// First block: files included from the FIFE root src directory
34
// Second block: files included from the same folder
35
#include "util/structures/point.h"
36
37
#include "fontbase.h"
38
39
namespace
FIFE {
40
46
class
ImageFontBase
:
public
FontBase
{
47
public
:
48
52
ImageFontBase
();
53
57
virtual
~ImageFontBase
();
58
62
virtual
int32_t
getWidth
(
const
std::string& text)
const
;
63
66
virtual
int32_t
getHeight
()
const
;
67
68
virtual
SDL_Surface *renderString(
const
std::string& text);
69
virtual
void
setColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 255);
70
71
protected
:
72
// A glyph (visible character)
73
typedef
struct
{
74
// The offset of the glyph relative to the top-left corner.
75
Point
offset;
76
// The glyphs image
77
// should be with SDL_SRCALPHA off, so that it's just copied over.
78
SDL_Surface* surface;
79
} s_glyph;
80
81
typedef
std::map<int32_t,s_glyph> type_glyphs;
82
type_glyphs m_glyphs;
83
84
// The glyph used, when the real glyph is not found
85
// Should default to '?'
86
s_glyph m_placeholder;
87
88
int32_t mHeight;
89
int32_t mGlyphSpacing;
90
int32_t mRowSpacing;
91
92
std::string mFilename;
93
bool
mAntiAlias;
94
};
95
}
96
97
#endif // end GCN_SDLTRUETYPEFONT_HPP
engine
core
video
fonts
imagefontbase.h
Generated by
1.8.4