updated Engine::drawText() - and broke something with drawing text on the way...

git-svn-id: svn://anubis/anaglym/trunk@186 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-11-17 04:45:33 +00:00
parent 5de4ed348b
commit 2472e9ee4d
2 changed files with 14 additions and 12 deletions

View File

@ -507,12 +507,14 @@ void Engine::drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
int ptsize, float x, float y)
{
m_font->FaceSize(ptsize);
glPushMatrix();
glTranslatef(x, y, 0);
GLfloat color[] = {r, g, b, 1.0};
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
m_font->Render(text);
glPopMatrix();
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_LIGHTING);
glPushMatrix();
glTranslatef(x, y, 0);
glColor3f(r, g, b);
m_font->Render(text);
glPopMatrix();
glPopAttrib();
}
void Engine::getTextSize(const char * text, int ptsize,

View File

@ -57,10 +57,10 @@ end
function update_overlay_event(width, height)
local tw, th = ag.getTextSize("Hi there", 18)
ag.drawText("Hi there", 1, 1, 1, 18, width - tw - 4, height - th - 4)
ag.drawLine(1, 0, 0.3, 10, 10, 40, 60)
ag.drawLine(1, 0.7, 1, 50, 10, 100, 60, 5)
ag.drawRect(0, 1, 0, 40, 40, width / 2, height / 2)
ag.fillRect(0, 0, 1, 20, 30, width / 2, height / 2)
local rot = ag.elapsedTime() / 10
ag.drawImage(50, 50, 80, 160, crate_texture, rot)
-- ag.drawLine(1, 0, 0.3, 10, 10, 40, 60)
-- ag.drawLine(1, 0.7, 1, 50, 10, 100, 60, 5)
-- ag.drawRect(0, 1, 0, 40, 40, width / 2, height / 2)
-- ag.fillRect(0, 0, 1, 20, 30, width / 2, height / 2)
-- local rot = ag.elapsedTime() / 10
-- ag.drawImage(50, 50, 80, 160, crate_texture, rot)
end