Main MRPT website
>
C++ reference
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
mrpt
opengl
CText.h
Go to the documentation of this file.
1
/* +---------------------------------------------------------------------------+
2
| The Mobile Robot Programming Toolkit (MRPT) C++ library |
3
| |
4
| http://www.mrpt.org/ |
5
| |
6
| Copyright (C) 2005-2012 University of Malaga |
7
| |
8
| This software was written by the Machine Perception and Intelligent |
9
| Robotics Lab, University of Malaga (Spain). |
10
| Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11
| |
12
| This file is part of the MRPT project. |
13
| |
14
| MRPT is free software: you can redistribute it and/or modify |
15
| it under the terms of the GNU General Public License as published by |
16
| the Free Software Foundation, either version 3 of the License, or |
17
| (at your option) any later version. |
18
| |
19
| MRPT is distributed in the hope that it will be useful, |
20
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
| GNU General Public License for more details. |
23
| |
24
| You should have received a copy of the GNU General Public License |
25
| along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26
| |
27
+---------------------------------------------------------------------------+ */
28
29
#ifndef opengl_CText_H
30
#define opengl_CText_H
31
32
#include <
mrpt/opengl/CRenderizable.h
>
33
34
namespace
mrpt
35
{
36
namespace
opengl
37
{
38
class
OPENGL_IMPEXP
CText
;
39
40
// This must be added to any CSerializable derived class:
41
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE
(
CText
,
CRenderizable
,
OPENGL_IMPEXP
)
42
43
/** A 2D text (bitmap rendering): it always "faces the observer" despite it's at some 3D location.
44
* Use setString and setFont to change the text displayed by this object.
45
*
46
* \note All texts appear with the font GLUT_BITMAP_TIMES_ROMAN_10 for now (i.e. setFont is ignored)
47
* \sa opengl::COpenGLScene
48
*
49
* <div align="center">
50
* <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
51
* <tr> <td> mrpt::opengl::CText </td> <td> \image html preview_CText.png </td> </tr>
52
* </table>
53
* </div>
54
*
55
* \sa CText3D
56
* \ingroup mrpt_opengl_grp
57
*/
58
class
OPENGL_IMPEXP
CText
: public
CRenderizable
59
{
60
DEFINE_SERIALIZABLE
(
CText
)
61
protected:
62
std::
string
m_str;
63
std::
string
m_fontName;
64
int
m_fontHeight, m_fontWidth;
65
66
public:
67
void
setString( const std::
string
&s ) { m_str=s; }
//!< Sets the text to display
68
std::string
getString
()
const
{
return
m_str; }
//!< Return the current text associated to this label
69
70
void
setFont
(
const
std::string &s,
int
height ) { m_fontName=s; m_fontHeight=height; }
//!< Sets the font (It has no effect yet!)
71
std::string
getFont
()
const
{
return
m_fontName; }
72
73
/** Render */
74
void
render()
const
;
75
76
77
/** Class factory */
78
static
CTextPtr
Create
(
const
std::string &str) {
return
CTextPtr
(
new
CText
(str) ); }
79
80
private
:
81
/** Constructor */
82
CText
(
const
std::string &str = std::string(
""
) );
83
84
/** Private, virtual destructor: only can be deleted from smart pointers */
85
virtual
~
CText
();
86
};
87
88
}
// end namespace
89
90
}
// End of namespace
91
92
93
#endif
Page generated by
Doxygen 1.8.3
for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013