aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CTextSceneNode.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CTextSceneNode.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CTextSceneNode.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CTextSceneNode.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CTextSceneNode.h
new file mode 100644
index 0000000..5c2e55e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CTextSceneNode.h
@@ -0,0 +1,160 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_TEXT_SCENE_NODE_H_INCLUDED__
6#define __C_TEXT_SCENE_NODE_H_INCLUDED__
7
8#include "ITextSceneNode.h"
9#include "IBillboardTextSceneNode.h"
10#include "IGUIFont.h"
11#include "IGUIFontBitmap.h"
12#include "ISceneCollisionManager.h"
13#include "SMesh.h"
14
15namespace irr
16{
17namespace scene
18{
19
20
21 class CTextSceneNode : public ITextSceneNode
22 {
23 public:
24
25 //! constructor
26 CTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
27 gui::IGUIFont* font, scene::ISceneCollisionManager* coll,
28 const core::vector3df& position = core::vector3df(0,0,0), const wchar_t* text=0,
29 video::SColor color=video::SColor(100,0,0,0));
30
31 //! destructor
32 virtual ~CTextSceneNode();
33
34 virtual void OnRegisterSceneNode();
35
36 //! renders the node.
37 virtual void render();
38
39 //! returns the axis aligned bounding box of this node
40 virtual const core::aabbox3d<f32>& getBoundingBox() const;
41
42 //! sets the text string
43 virtual void setText(const wchar_t* text);
44
45 //! sets the color of the text
46 virtual void setTextColor(video::SColor color);
47
48 //! Returns type of the scene node
49 virtual ESCENE_NODE_TYPE getType() const { return ESNT_TEXT; }
50
51 private:
52
53 core::stringw Text;
54 video::SColor Color;
55 gui::IGUIFont* Font;
56 scene::ISceneCollisionManager* Coll;
57 core::aabbox3d<f32> Box;
58 };
59
60 class CBillboardTextSceneNode : public IBillboardTextSceneNode
61 {
62 public:
63
64 CBillboardTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
65 gui::IGUIFont* font,const wchar_t* text,
66 const core::vector3df& position, const core::dimension2d<f32>& size,
67 video::SColor colorTop, video::SColor shade_bottom);
68
69 //! destructor
70 virtual ~CBillboardTextSceneNode();
71
72 //! sets the vertex positions etc
73 virtual void OnAnimate(u32 timeMs);
74
75 //! registers the node into the transparent pass
76 virtual void OnRegisterSceneNode();
77
78 //! renders the node.
79 virtual void render();
80
81 //! returns the axis aligned bounding box of this node
82 virtual const core::aabbox3d<f32>& getBoundingBox() const;
83
84 //! sets the text string
85 virtual void setText(const wchar_t* text);
86
87 //! sets the color of the text
88 virtual void setTextColor(video::SColor color);
89
90 //! sets the size of the billboard
91 virtual void setSize(const core::dimension2d<f32>& size);
92
93 //! gets the size of the billboard
94 virtual const core::dimension2d<f32>& getSize() const;
95
96 virtual video::SMaterial& getMaterial(u32 i);
97
98 //! returns amount of materials used by this scene node.
99 virtual u32 getMaterialCount() const;
100
101 //! Returns type of the scene node
102 virtual ESCENE_NODE_TYPE getType() const { return ESNT_TEXT; }
103
104 //! Set the color of all vertices of the billboard
105 //! \param overallColor: the color to set
106 virtual void setColor(const video::SColor & overallColor);
107
108 //! Set the color of the top and bottom vertices of the billboard
109 //! \param topColor: the color to set the top vertices
110 //! \param bottomColor: the color to set the bottom vertices
111 virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor);
112
113 //! Gets the color of the top and bottom vertices of the billboard
114 //! \param topColor: stores the color of the top vertices
115 //! \param bottomColor: stores the color of the bottom vertices
116 virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const;
117
118 virtual void setSize(f32 height, f32 bottomEdgeWidth, f32 topEdgeWidth)
119 {
120 setSize(core::dimension2df(bottomEdgeWidth, height));
121 }
122
123 virtual void getSize(f32& height, f32& bottomEdgeWidth, f32& topEdgeWidth) const
124 {
125 height = Size.Height;
126 bottomEdgeWidth = Size.Width;
127 topEdgeWidth = Size.Width;
128 }
129
130 private:
131
132 core::stringw Text;
133 video::SColor Color;
134 gui::IGUIFontBitmap* Font;
135
136 core::dimension2d<f32> Size;
137 core::aabbox3d<f32> BBox;
138 video::SMaterial Material;
139
140 video::SColor ColorTop;
141 video::SColor ColorBottom;
142 struct SSymbolInfo
143 {
144 u32 bufNo;
145 f32 Width;
146 f32 Kerning;
147 u32 firstInd;
148 u32 firstVert;
149 };
150
151 core::array < SSymbolInfo > Symbol;
152
153 SMesh *Mesh;
154 };
155
156} // end namespace scene
157} // end namespace irr
158
159#endif
160