1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Benjamin Grauer |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER |
---|
17 | |
---|
18 | #include "font_data.h" |
---|
19 | |
---|
20 | #include "debug.h" |
---|
21 | #include "compiler.h" |
---|
22 | |
---|
23 | #include "sdlincl.h" |
---|
24 | |
---|
25 | /** |
---|
26 | * @brief creates a new Font Data. |
---|
27 | */ |
---|
28 | FontData::FontData() |
---|
29 | : texData(new TextureData) |
---|
30 | { |
---|
31 | printf("CREATE FONT_DATA\n"); |
---|
32 | this->fontTTF = NULL; |
---|
33 | this->glyphArray = NULL; |
---|
34 | this->renderStyle = TTF_STYLE_NORMAL; |
---|
35 | this->renderSize = FONT_DEFAULT_RENDER_SIZE; |
---|
36 | } |
---|
37 | |
---|
38 | |
---|
39 | /** |
---|
40 | * @brief Destructor of a Font |
---|
41 | * |
---|
42 | * Frees Data, and deletes the fonts from GL |
---|
43 | */ |
---|
44 | FontData::~FontData() |
---|
45 | { |
---|
46 | // deleting all Glyphs |
---|
47 | if (this->glyphArray != NULL) |
---|
48 | { |
---|
49 | for (int i = 0; i < FONT_HIGHEST_KNOWN_CHAR; i++) |
---|
50 | { |
---|
51 | if (this->glyphArray[i] != NULL) |
---|
52 | delete this->glyphArray[i]; |
---|
53 | } |
---|
54 | delete[] this->glyphArray; |
---|
55 | } |
---|
56 | |
---|
57 | //! @todo check if we really do not need to delete the fastTextureID here. |
---|
58 | // if (this->fastTextureID != 0) |
---|
59 | // if(glIsTexture(this->fastTextureID)) |
---|
60 | // glDeleteTextures(1, &this->fastTextureID); |
---|
61 | |
---|
62 | // erease this font out of the memory. |
---|
63 | if (likely(this->fontTTF != NULL)) |
---|
64 | TTF_CloseFont(this->fontTTF); |
---|
65 | } |
---|
66 | |
---|
67 | |
---|