44 #ifndef __TEXT_WRITER_H__
45 #define __TEXT_WRITER_H__
50 #include "SDL/SDL_ttf.h"
59 typedef std::map< int, TTF_Font * > FontMap;
64 typedef FontMap::iterator FontMapItr;
69 typedef FontMap::const_iterator FontMapCItr;
81 static std::string DEFAULT_FONT;
86 static const int DEFAULT_SIZE;
93 static void setDefaultFont(
const std::string & fontName );
141 void printText(
const std::string & text, Alignment alignment,
float anchorX,
float anchorY,
int fontSize,
bool currColor=
false,
bool transparent=
true );
155 void printText(
const std::string & text,
float left,
float bottom,
int fontSize,
bool currColor=
false,
bool transparent=
true );
172 void printAlignText(
const std::string & text, Alignment alignment,
int fontSize,
float hpad,
float vpad,
bool currColor=
false,
bool transparent=
true );
189 void printAnchorText(
const std::string & text,
float anchorX,
float anchorY,
float xWeight,
float yWeight,
int fontSize,
bool currColor=
false,
bool transparent=
true );
200 void textSize(
const std::string & text,
int fontSize,
float & textWidth,
float & textHeight );
211 void resize(
int w,
int h );
237 bool setFont(
const std::string & fontName );
248 void setDefaultColor(
float r,
float g,
float b,
float alpha=1.f );
259 inline int flipY(
int y ) {
return _height - y; }
271 TTF_Font * getFont(
int size );
306 void makeTextDList();
311 void makeGLTexture();
318 void sdlSurfaceToGLTex( SDL_Surface * surf );
333 void printLine( TTF_Font * font,
const char * text,
float left,
float bottom,
int lineNum );
363 #endif //__TEXT_WRITER_H__
GLuint _textID
Texture object for texturing the rendered text.
Definition: TextWriter.h:348
std::string _fontName
Name of font.
Definition: TextWriter.h:343
int _height
The height of the viewport the TextWriter considers when computing text positions.
Definition: TextWriter.h:301
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
Sets up the proper compiler directives for platform and dll export/import.
Alignment
Enumeration for controlling text alignment.
Definition: TextWriter.h:98
int getViewHeight() const
Reports TextWriter's belief of the viewport width.
Definition: TextWriter.h:225
int getViewWidth() const
Reports TextWriter's belief of the viewport width.
Definition: TextWriter.h:218
The interface for loading and using images in the scene graph.
int flipY(int y)
A utility function to map from screen to image coordinates.
Definition: TextWriter.h:259
The SceneGraph (SceneGraph) name space, containing all elements to use in a SceneGraph.
static TextWriter * _instance
The singleton pointer.
Definition: TextWriter.h:291
FontMap _fonts
Map of all font sizes for this font face.
Definition: TextWriter.h:338
int _width
The width of the viewport the TextWriter considers when computing text positions. ...
Definition: TextWriter.h:296
GLuint _textQuadID
Call list for the text surface.
Definition: TextWriter.h:353
A singleton class responsible for writing text to an OpenGL context.
Definition: TextWriter.h:77