Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Teddy::Graphics::Font Class Reference

Glyph rendering with OpenGL textured quads. More...

#include <Font.h>

Collaboration diagram for Teddy::Graphics::Font:

Collaboration graph
[legend]
List of all members.

Public Methods

 Font (const char *fname, const int mode=0)
 Font constructor. More...

 Font ()
 Dummy font constructor for font which is used for default font while none is loaded. More...

void drawString (const Teddy::Maths::Vector2 &pos, const char *str, View *v)
int getWidth ()
 Return font width in pixels. More...

int getHeight ()
 Return font height in pixels. More...


Static Public Attributes

Font * default_font = &Font::dummy_font
Font dummy_font
const int MODE_NORMAL = 0
const int MODE_NO_BLEND = 1

Private Attributes

Texturetexture
 Texture object. More...

Teddy::Maths::Vector2 tx [256]
 Texture coordinates, char = index. More...

Teddy::Maths::Vector2 tsize [4]
Teddy::Maths::Vector2 psize [4]
Teddy::Maths::Vector2 pos
int mode
int cw
 Char width in pixels. More...

int ch
 Char height. More...

float tw
 Char width in texture coords. More...

float th
 Char height in texture coords. More...


Detailed Description

Glyph rendering with OpenGL textured quads.

Todo:
Freetype

Variable width font.

This class implements glyph storing and rendering code (but it is not Renderable).

Implementation is very primitive at the moment. Later, FreeType library could be intergrated here.

Definition at line 51 of file Font.h.


Constructor & Destructor Documentation

Teddy::Graphics::Font::Font const char *    fname,
const int    mode = 0
 

Font constructor.

Parameters:
fname  Name of the datafile containing font definition as raw 256x256 8bit alpha values

Definition at line 76 of file Font.cpp.

References ch, cw, Teddy::Graphics::DIV_256, IntVector2, Teddy::SysSupport::M_INIT, mode, MODE_NO_BLEND, MODE_NORMAL, Teddy::SysSupport::msg, psize, texture, th, tsize, tw, tx, and Vector2.

Teddy::Graphics::Font::Font  
 

Dummy font constructor for font which is used for default font while none is loaded.

Definition at line 55 of file Font.cpp.

References ch, cw, pos, psize, texture, th, tsize, tw, tx, and Vector2.


Member Function Documentation

void Teddy::Graphics::Font::drawString const Teddy::Maths::Vector2 &    pos,
const char *    str,
View   v
 

int Teddy::Graphics::Font::getHeight  
 

Return font height in pixels.

Returns:
The font height in pixels

Definition at line 230 of file Font.cpp.

References ch.

int Teddy::Graphics::Font::getWidth  
 

Return font width in pixels.

Returns:
The font width in pixels

Definition at line 221 of file Font.cpp.

References cw.


Member Data Documentation

int Teddy::Graphics::Font::ch [private]
 

Char height.

Definition at line 75 of file Font.h.

Referenced by Font, and getHeight.

int Teddy::Graphics::Font::cw [private]
 

Char width in pixels.

Definition at line 74 of file Font.h.

Referenced by Font, and getWidth.

Font * Teddy::Graphics::Font::default_font = &Font::dummy_font [static]
 

Definition at line 43 of file Font.cpp.

Font Teddy::Graphics::Font::dummy_font [static]
 

Definition at line 42 of file Font.cpp.

int Teddy::Graphics::Font::mode [private]
 

Definition at line 73 of file Font.h.

Referenced by Font.

const int Teddy::Graphics::Font::MODE_NO_BLEND = 1 [static]
 

Definition at line 45 of file Font.cpp.

Referenced by Font.

const int Teddy::Graphics::Font::MODE_NORMAL = 0 [static]
 

Definition at line 44 of file Font.cpp.

Referenced by Font.

Teddy::Maths::Vector2 Teddy::Graphics::Font::pos [private]
 

Definition at line 72 of file Font.h.

Referenced by Font.

Teddy::Maths::Vector2 Teddy::Graphics::Font::psize[4] [private]
 

Definition at line 71 of file Font.h.

Referenced by Font.

Texture* Teddy::Graphics::Font::texture [private]
 

Texture object.

Definition at line 68 of file Font.h.

Referenced by Font.

float Teddy::Graphics::Font::th [private]
 

Char height in texture coords.

Definition at line 77 of file Font.h.

Referenced by Font.

Teddy::Maths::Vector2 Teddy::Graphics::Font::tsize[4] [private]
 

Definition at line 70 of file Font.h.

Referenced by Font.

float Teddy::Graphics::Font::tw [private]
 

Char width in texture coords.

Definition at line 76 of file Font.h.

Referenced by Font.

Teddy::Maths::Vector2 Teddy::Graphics::Font::tx[256] [private]
 

Texture coordinates, char = index.

Definition at line 69 of file Font.h.

Referenced by Font.


The documentation for this class was generated from the following files: