Neo  0.5.0
Developer Documentation
OText.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 
25 
26 #ifndef __OTEXT_H
27 #define __OTEXT_H
28 
29 namespace Neo
30 {
31 // align modes
33 {
37 };
38 
39 // MOText
40 class NEO_ENGINE_EXPORT OText : public Object3d
41 {
42 public:
43 
44  // constructor / destructor
45  OText(FontRef * fontRef);
46  ~OText(void);
47 
48  // copy constructor
49  OText(const OText & text);
50 
51 private:
52 
53  // font ref
54  FontRef * m_fontRef;
55 
56  // text
57  String m_text;
58 
59  // align
60  TEXT_ALIGN_MODES m_align;
61  vector <float> m_linesOffset;
62 
63  // size
64  float m_size;
65 
66  // color
67  Vector4 m_color;
68 
69  // bounding box
70  Box3d m_boundingBox;
71 
72 private:
73 
74  void updateLinesOffset(void);
75  void prepare(void);
76 
77 public:
78 
79  // type
80  int getType(void){ return OBJECT3D_TEXT; }
81 
82  // font
83  void setFontRef(FontRef * fontRef);
84  Font * getFont(void);
85  inline FontRef * getFontRef(void){ return m_fontRef; }
86 
87  // text
88  void setText(const char * text);
89  inline const char * getText(void){ return m_text.getSafeString(); }
90 
91  // lines offset
92  inline vector <float> * getLinesOffset(void){ return &m_linesOffset; }
93 
94  // align
95  void setAlign(TEXT_ALIGN_MODES align);
96  inline TEXT_ALIGN_MODES getAlign(void){ return m_align; }
97 
98  // size
99  void setSize(float size);
100  inline float getSize(void){ return m_size; }
101 
102  // color
103  inline void setColor(const Vector4 & color){ m_color = color; }
104  inline Vector4 getColor(void) const { return m_color; }
105 
106  // bounding box
107  inline Box3d * getBoundingBox(void){ return &m_boundingBox; }
108 
109  // visibility
110  void updateVisibility(OCamera * camera);
111 };
112 }
113 #endif
Definition: Vector4.h:31
vector< float > * getLinesOffset(void)
Definition: OText.h:92
Definition: FontRef.h:32
Box3d * getBoundingBox(void)
Definition: OText.h:107
int getType(void)
Returns the type of the object.
Definition: OText.h:80
Definition: OText.h:40
Definition: NeoEngine.h:50
Implements a framework for string manipulation that operates directly on C strings.
Definition: NeoString.h:35
float getSize(void)
Definition: OText.h:100
Definition: Box3d.h:31
Definition: OText.h:35
Definition: OText.h:34
Definition: OText.h:36
const char * getText(void)
Definition: OText.h:89
TEXT_ALIGN_MODES
Definition: OText.h:32
The Object3d class represents a general object in a 3D scene.
Definition: Object3d.h:43
const char * getSafeString(void)
Returns the C string. This method is ensured to return a valid C string and never NULL...
FontRef * getFontRef(void)
Definition: OText.h:85
Vector4 getColor(void) const
Definition: OText.h:104
Definition: Font.h:61
void setColor(const Vector4 &color)
Definition: OText.h:103
Definition: OCamera.h:30
Definition: Color.h:29
TEXT_ALIGN_MODES getAlign(void)
Definition: OText.h:96