summaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-05-14 16:26:15 +0000
committerMatt Turner <mattst88@gmail.com>2008-05-14 16:26:15 +0000
commit15e2da75f4a8550b445a4ba8cb3d21c20beb007f (patch)
tree7e2708a75653b85e468523c08629f870f174b07e /text.c
parenta8921d2baf7fe632839ec4c1a6f55db9c78f1c1c (diff)
Make quesoglc work. Still need to sort out why GLC_TRIANGLE works but GLC_TEXTURE doesn't.
git-svn-id: svn://mattst88.com/svn/glpong/trunk@15 449aeecc-241a-0410-943f-e2f883e2d7a2
Diffstat (limited to 'text.c')
-rw-r--r--text.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/text.c b/text.c
index 2694e4b..06254c3 100644
--- a/text.c
+++ b/text.c
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
#include <GL/glc.h>
#include "text.h"
@@ -6,6 +8,9 @@ static GLuint font;
int
GLPong_TextInit() {
+#ifdef DEBUG
+ int count, i;
+#endif
GLuint context = glcGenContext();
glcContext(context);
@@ -13,6 +18,7 @@ GLPong_TextInit() {
if (!glcIsContext(context)) {
return -1;
}
+ glcAppendCatalog("/usr/share/fonts/dejavu/");
#ifdef DEBUG
count = glcGeti(GLC_CATALOG_COUNT);
@@ -22,10 +28,15 @@ GLPong_TextInit() {
#endif
font = glcGenFontID();
- glcNewFontFromFamily(font, "Ar");
+ glcNewFontFromFamily(font, "Deja Vu Sans");
glcFontFace(font, "Normal");
- glcRenderStyle(GLC_TEXTURE);
- glcFont(font);
+/* glcRenderStyle(GLC_TEXTURE);*/
+ glcRenderStyle(GLC_TRIANGLE);
+ if (glcIsFont(font)) {
+ glcFont(font);
+ } else {
+ return -1;
+ }
return 0;
}
@@ -36,4 +47,18 @@ GLPong_TextDeinit() {
}
void
-GLPong_TextDrawFPS(GLfloat fps) { }
+GLPong_TextDrawFPS(GLfloat fps) {
+ char buffer[10];
+
+ sprintf(buffer, "%.0f FPS", fps);
+#ifdef DEBUG
+ printf("%s frames per second\n", buffer);
+#endif
+
+ glLoadIdentity();
+ glTranslatef(40.0f, 400.0f, 0.0f);
+ glScalef(25.0f, 25.0f, 0.0f);
+ glColor3f(1.0f, 0.0f, 0.0f);
+ glcRenderString(buffer);
+}
+