37 #include "FTGL/ftgl.h" 117 pFont =
GetFont( p_fontname,
true, p_fonttype, p_fontsize );
134 for(
int i=0; i< (int)
m_Fonts.Count(); i++) {
150 completepath+=
moText(p_fontname);
152 moFile fname( completepath );
155 completepath =
moText(
"../../art/fonts/") +
moText(p_fontname);
158 pFont =
LoadFont( completepath, p_fonttype, p_fontsize );
169 if( 0<=p_fontid && p_fontid<(
int)
m_Fonts.Count())
189 return GetFont( fontname, create );
194 return GetFont( fontname, create, fonttype );
200 return GetFont( fontname, create, fonttype, fontsize );
224 pFont->
Init( p_fonttype, p_fontname_path, p_fontsize, p_Texture->
GetGLId() );
227 }
else if ( pFont->
Init( p_fonttype, p_fontname_path, p_fontsize) ) {
248 if ( fonttype==
moText(
"TRANSLUCENT") ) {
250 }
else if ( fonttype==
moText(
"FILLED") ) {
252 }
else if ( fonttype==
moText(
"GRAYSCALE") ) {
254 }
else if ( fonttype==
moText(
"MONOCHROME") ) {
256 }
else if ( fonttype==
moText(
"OUTLINE") ) {
258 }
else if ( fonttype==
moText(
"SOLID") ) {
260 }
else if ( fonttype==
moText(
"TRANSLUCENTTEXTURE") ) {
262 }
else if ( fonttype==
moText(
"UNDEFINED") ) {
264 }
else if ( fonttype==
moText(
"GLBUILD") ) {
296 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
301 MODebug2->
Error(
"moFont:Init filename "+p_fontname+
" not found.");
305 switch( (
int)p_Type ) {
307 m_pFace = (FTFont*)
new FTGLOutlineFont( p_fontname );
310 m_pFace = (FTFont*)
new FTGLBitmapFont( p_fontname );
313 m_pFace = (FTFont*)
new FTGLTextureFont( p_fontname );
316 m_pFace = (FTFont*)
new FTGLPixmapFont( p_fontname );
319 m_pFace = (FTFont*)
new FTGLPixmapFont( p_fontname );
322 m_pFace = (FTFont*)
new FTGLExtrdFont( p_fontname );
325 m_pFace = (FTFont*)
new FTGLPolygonFont( p_fontname );
339 FTFont* FF = (FTFont*) m_pFace;
343 if (FF) FontError = FF->Error();
371 if (!FF->CharMap(ft_encoding_unicode)) {
390 FTFont* FF = (FTFont*) m_pFace;
405 FTFont* FF = (FTFont*) m_pFace;
406 if (FF) FF->FaceSize(m_FontSize);
412 glColor3f( p_r, p_g, p_b );
420 MODebug2->
Message(
"moFont::SetHorizontalJustification > p_horizontal_justification NOT IMPLEMENTED : " 421 +
IntToStr( p_horizontal_justification ) );
429 MODebug2->
Message(
"moFont::SetStringRotation > p_string_rotation NOT IMPLEMENTED: " 435 Draw( x, y, text, m_FontSize );
451 FTFont* FF = (FTFont*) m_pFace;
455 FF->Render( text, text.
Length(), FTPoint(x,y) );
461 this->glPrint( (
int)x, (
int)y, text,
set, sx, sy, rt );
480 m_GLBaseList = glGenLists(256);
481 glBindTexture( GL_TEXTURE_2D, m_FontGLId );
484 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
485 for(loop=0; loop<256; loop++)
487 cx=float((
int)(loop%16))/16.0f;
488 cy=float((
int)(loop/16))/16.0f;
490 glNewList(m_GLBaseList+loop,GL_COMPILE);
492 glTexCoord2f(cx,1.0f-cy-0.0625f);
494 glTexCoord2f(cx+0.0625f,1.0f-cy-0.0625f);
496 glTexCoord2f(cx+0.0625f,1.0f-cy);
498 glTexCoord2f(cx,1.0f-cy);
501 glTranslated(10,0,0);
504 #endif // Loop Until All 256 Are Built 509 moFont::glPrint( GLint x, GLint y,
char *
string,
int set,
float scx,
float scy,
float rt )
516 glBindTexture( GL_TEXTURE_2D, m_FontGLId );
517 glDisable(GL_DEPTH_TEST);
519 glMatrixMode(GL_PROJECTION);
522 glOrtho(0,800,0,600,-1,1);
524 glMatrixMode(GL_MODELVIEW);
527 glRotated(rt,0.0,0.0,1.0);
529 glScalef(scx,scy,1.0f);
530 glListBase( m_GLBaseList -32+(128*
set));
531 glCallLists(strlen(
string),GL_BYTE,
string);
532 glMatrixMode(GL_PROJECTION);
534 glMatrixMode(GL_MODELVIEW);
544 glDeleteLists( m_GLBaseList, 256);
virtual MOboolean Init()
Inicializa el objeto.
void SetHorizontalJustification(int p_horizontal_justification)
void Error(moText p_text)
Anuncia y registra un error.
void SetName(const moText &p_name)
clase base para una fuente 3d o 2d
moValueBase & GetSubValue(MOint p_indexsubvalue=0)
void glPrint(GLint x, GLint y, char *string, int set, float scx, float scy, float rt)
moFont * LoadFont(moText p_fontname_path, moFontType p_fonttype=MO_FONT_OUTLINE, MOfloat p_fontsize=12)
LIBMOLDEO_API moText0 FloatToStr(double a)
virtual MOboolean Finish()
void SetResourceType(moResourceType p_restype)
moFont * GetFont(moText p_fontname, bool create=false, moFontType p_fonttype=MO_FONT_OUTLINE, MOfloat p_fontsize=12)
moDefineDynamicArray(moFonts) moFontManager
clase de para manejar textos
moTexture * GetTexture(MOuint p_moid)
moResourceManager * m_pResourceManager
Puntero al administrador de recursos.
Dispositivo de entrada/salida, típicamente, interfaces humanas de IO y datos ( teclado, mouse, tableta, tcp, udp, serial )
void SetStringRotation(MOfloat p_string_rotation)
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
MOint GetTextureMOId(moParam *param, MOboolean p_create_tex)
clase base para el manejo de una textura
void SetForegroundColor(MOfloat p_r, MOfloat p_g, MOfloat p_b)
void SetLabelName(const moText &p_labelname)
void Draw(MOfloat x, MOfloat y, moText &text)
static moDebug * MODebug2
Clase de impresión de errores para depuración.
moFont * AddFont(moText p_fontname, moText p_fonttype="OUTLINE", MOfloat p_fontsize=12)
moDataManager * GetDataMan()
void Push(moText p_text)
Apila el mensaje dentro de la pila de mensajes.
LIBMOLDEO_API moText0 IntToStr(int a)
void SetSize(MOfloat size)
moFontType GetFontType(moText fonttype)
MOuint GetSubValueCount()
void Message(moText p_text)
Anuncia un mensaje al usuario además de guardarlo en el log de texto.
void SetType(moMoldeoObjectType p_type)
moTextureManager * GetTextureMan()