diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CGUIFont.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CGUIFont.h | 236 |
1 files changed, 118 insertions, 118 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CGUIFont.h b/libraries/irrlicht-1.8/source/Irrlicht/CGUIFont.h index ada89c8..a414768 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CGUIFont.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CGUIFont.h | |||
@@ -1,118 +1,118 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __C_GUI_FONT_H_INCLUDED__ | 5 | #ifndef __C_GUI_FONT_H_INCLUDED__ |
6 | #define __C_GUI_FONT_H_INCLUDED__ | 6 | #define __C_GUI_FONT_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IrrCompileConfig.h" | 8 | #include "IrrCompileConfig.h" |
9 | #ifdef _IRR_COMPILE_WITH_GUI_ | 9 | #ifdef _IRR_COMPILE_WITH_GUI_ |
10 | 10 | ||
11 | #include "IGUIFontBitmap.h" | 11 | #include "IGUIFontBitmap.h" |
12 | #include "irrString.h" | 12 | #include "irrString.h" |
13 | #include "irrMap.h" | 13 | #include "irrMap.h" |
14 | #include "IXMLReader.h" | 14 | #include "IXMLReader.h" |
15 | #include "IReadFile.h" | 15 | #include "IReadFile.h" |
16 | #include "irrArray.h" | 16 | #include "irrArray.h" |
17 | 17 | ||
18 | namespace irr | 18 | namespace irr |
19 | { | 19 | { |
20 | 20 | ||
21 | namespace video | 21 | namespace video |
22 | { | 22 | { |
23 | class IVideoDriver; | 23 | class IVideoDriver; |
24 | class IImage; | 24 | class IImage; |
25 | } | 25 | } |
26 | 26 | ||
27 | namespace gui | 27 | namespace gui |
28 | { | 28 | { |
29 | 29 | ||
30 | class IGUIEnvironment; | 30 | class IGUIEnvironment; |
31 | 31 | ||
32 | class CGUIFont : public IGUIFontBitmap | 32 | class CGUIFont : public IGUIFontBitmap |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | 35 | ||
36 | //! constructor | 36 | //! constructor |
37 | CGUIFont(IGUIEnvironment* env, const io::path& filename); | 37 | CGUIFont(IGUIEnvironment* env, const io::path& filename); |
38 | 38 | ||
39 | //! destructor | 39 | //! destructor |
40 | virtual ~CGUIFont(); | 40 | virtual ~CGUIFont(); |
41 | 41 | ||
42 | //! loads a font from a texture file | 42 | //! loads a font from a texture file |
43 | bool load(const io::path& filename); | 43 | bool load(const io::path& filename); |
44 | 44 | ||
45 | //! loads a font from a texture file | 45 | //! loads a font from a texture file |
46 | bool load(io::IReadFile* file); | 46 | bool load(io::IReadFile* file); |
47 | 47 | ||
48 | //! loads a font from an XML file | 48 | //! loads a font from an XML file |
49 | bool load(io::IXMLReader* xml); | 49 | bool load(io::IXMLReader* xml); |
50 | 50 | ||
51 | //! draws an text and clips it to the specified rectangle if wanted | 51 | //! draws an text and clips it to the specified rectangle if wanted |
52 | virtual void draw(const core::stringw& text, const core::rect<s32>& position, | 52 | virtual void draw(const core::stringw& text, const core::rect<s32>& position, |
53 | video::SColor color, bool hcenter=false, | 53 | video::SColor color, bool hcenter=false, |
54 | bool vcenter=false, const core::rect<s32>* clip=0); | 54 | bool vcenter=false, const core::rect<s32>* clip=0); |
55 | 55 | ||
56 | //! returns the dimension of a text | 56 | //! returns the dimension of a text |
57 | virtual core::dimension2d<u32> getDimension(const wchar_t* text) const; | 57 | virtual core::dimension2d<u32> getDimension(const wchar_t* text) const; |
58 | 58 | ||
59 | //! Calculates the index of the character in the text which is on a specific position. | 59 | //! Calculates the index of the character in the text which is on a specific position. |
60 | virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) const; | 60 | virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) const; |
61 | 61 | ||
62 | //! Returns the type of this font | 62 | //! Returns the type of this font |
63 | virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; } | 63 | virtual EGUI_FONT_TYPE getType() const { return EGFT_BITMAP; } |
64 | 64 | ||
65 | //! set an Pixel Offset on Drawing ( scale position on width ) | 65 | //! set an Pixel Offset on Drawing ( scale position on width ) |
66 | virtual void setKerningWidth (s32 kerning); | 66 | virtual void setKerningWidth (s32 kerning); |
67 | virtual void setKerningHeight (s32 kerning); | 67 | virtual void setKerningHeight (s32 kerning); |
68 | 68 | ||
69 | //! set an Pixel Offset on Drawing ( scale position on width ) | 69 | //! set an Pixel Offset on Drawing ( scale position on width ) |
70 | virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const; | 70 | virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const; |
71 | virtual s32 getKerningHeight() const; | 71 | virtual s32 getKerningHeight() const; |
72 | 72 | ||
73 | //! gets the sprite bank | 73 | //! gets the sprite bank |
74 | virtual IGUISpriteBank* getSpriteBank() const; | 74 | virtual IGUISpriteBank* getSpriteBank() const; |
75 | 75 | ||
76 | //! returns the sprite number from a given character | 76 | //! returns the sprite number from a given character |
77 | virtual u32 getSpriteNoFromChar(const wchar_t *c) const; | 77 | virtual u32 getSpriteNoFromChar(const wchar_t *c) const; |
78 | 78 | ||
79 | virtual void setInvisibleCharacters( const wchar_t *s ); | 79 | virtual void setInvisibleCharacters( const wchar_t *s ); |
80 | 80 | ||
81 | private: | 81 | private: |
82 | 82 | ||
83 | struct SFontArea | 83 | struct SFontArea |
84 | { | 84 | { |
85 | SFontArea() : underhang(0), overhang(0), width(0), spriteno(0) {} | 85 | SFontArea() : underhang(0), overhang(0), width(0), spriteno(0) {} |
86 | s32 underhang; | 86 | s32 underhang; |
87 | s32 overhang; | 87 | s32 overhang; |
88 | s32 width; | 88 | s32 width; |
89 | u32 spriteno; | 89 | u32 spriteno; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | //! load & prepare font from ITexture | 92 | //! load & prepare font from ITexture |
93 | bool loadTexture(video::IImage * image, const io::path& name); | 93 | bool loadTexture(video::IImage * image, const io::path& name); |
94 | 94 | ||
95 | void readPositions(video::IImage* texture, s32& lowerRightPositions); | 95 | void readPositions(video::IImage* texture, s32& lowerRightPositions); |
96 | 96 | ||
97 | s32 getAreaFromCharacter (const wchar_t c) const; | 97 | s32 getAreaFromCharacter (const wchar_t c) const; |
98 | void setMaxHeight(); | 98 | void setMaxHeight(); |
99 | 99 | ||
100 | core::array<SFontArea> Areas; | 100 | core::array<SFontArea> Areas; |
101 | core::map<wchar_t, s32> CharacterMap; | 101 | core::map<wchar_t, s32> CharacterMap; |
102 | video::IVideoDriver* Driver; | 102 | video::IVideoDriver* Driver; |
103 | IGUISpriteBank* SpriteBank; | 103 | IGUISpriteBank* SpriteBank; |
104 | IGUIEnvironment* Environment; | 104 | IGUIEnvironment* Environment; |
105 | u32 WrongCharacter; | 105 | u32 WrongCharacter; |
106 | s32 MaxHeight; | 106 | s32 MaxHeight; |
107 | s32 GlobalKerningWidth, GlobalKerningHeight; | 107 | s32 GlobalKerningWidth, GlobalKerningHeight; |
108 | 108 | ||
109 | core::stringw Invisible; | 109 | core::stringw Invisible; |
110 | }; | 110 | }; |
111 | 111 | ||
112 | } // end namespace gui | 112 | } // end namespace gui |
113 | } // end namespace irr | 113 | } // end namespace irr |
114 | 114 | ||
115 | #endif // _IRR_COMPILE_WITH_GUI_ | 115 | #endif // _IRR_COMPILE_WITH_GUI_ |
116 | 116 | ||
117 | #endif // __C_GUI_FONT_H_INCLUDED__ | 117 | #endif // __C_GUI_FONT_H_INCLUDED__ |
118 | 118 | ||