#include "cTextManager.h"

cTextManager* cTextManager::instance_ = 0;

cTextManager* cTextManager::instance()
{
    if(instance_ == 0)
        instance_ = new cTextManager;
    return instance_;
}

cTextManager::cTextManager()
{
	hDC = NULL;
}

void cTextManager::draw(int x, int y, char *string)
{
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	glOrtho(0.0, glutGet(GLUT_WINDOW_WIDTH), 0.0,glutGet(GLUT_WINDOW_HEIGHT), -1.0, 1.0);
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glLoadIdentity();
	
	glColor3f(1,1,1);

	int len;
	glRasterPos2f(x, y);
	len = (int) strlen(string);
	for (int i = 0; i < len; i++)
		glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, string[i]);

	glPopMatrix();
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
}
