www.pudn.com > Gimcrack-v0.0051-Source.zip > font.h


/* This code is based on the font loading code in */ 
/* OpenGL Game Progamming by Hawkins and Astle    */ 
 
#ifndef _FONT_H_ 
#define _FONT_H_ 
 
#include "../Texture.h" 
 
#define COLORKEY_RED	0 
#define COLORKEY_GREEN	255 
#define COLORKEY_BLUE	0 
 
class GcFont 
{ 
public: 
 
	// Constructor / Destructor 
	GcFont(); 
	~GcFont(); 
 
	// Build font 
	bool Build(char *fontFile, int cols, int rows, int width, int height, int spacing); 
 
	// Print the text 
	void Print(char *string, int x, int y); 
 
	// Delete the font 
	void Delete(); 
 
	// Set the scale 
	void SetScale(float sScale) { scale = sScale; } 
 
private: 
 
	bool LoadTexture(char *fontFile); 
 
	int		colums;			// The numbers of colums in the bitmap 
	int		rows;			// The numbers of rows in the bitmap 
	int		width;			// The width of each letter 
	int		height;			// The hieght of each letter 
	int		spacing;		// The spacing betwen the letters 
	uint	base;			// The begining point of the list 
	float	scale;			// The scale of the bitmap 
	uint	fontID;			// The ID for the font texture 
	uint	texWidth; 
	uint	texHeight; 
}; 
 
#endif