Index: orxonox/trunk/src/sfont/cone3dfont.cc
===================================================================
--- orxonox/trunk/src/sfont/cone3dfont.cc	(revision 3455)
+++ orxonox/trunk/src/sfont/cone3dfont.cc	(revision 3455)
@@ -0,0 +1,145 @@
+/***************************************************************************
+                          cone3dfont.cpp  -  description
+                             -------------------
+    copyright            : (C) 2001 by Marius Andra aka Cone3D
+    email                : marius@hot.ee
+    ICQ                  : 43999510
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "cone3dfont.h"
+#include <stdarg.h>
+
+#include "../importer/texture.h"
+
+int Cone3DFont::SetSize(float x, float y)       // Set the size of the font
+{
+  sizex=x;
+  sizey=y;
+  
+  return 1;
+}
+
+int Cone3DFont::BuildFont(char *file)          // Build Our Font Display List
+{
+  int loop1;
+  float cx, cy;
+  
+  font = new Texture();
+  font->loadImage(file);
+  
+  base=glGenLists(256);                          // Creating 256 Display Lists
+  glBindTexture(GL_TEXTURE_2D, font->getTexture()); // Select Our Font Texture
+  for (loop1=0; loop1<256; loop1++)              // Loop Through All 256 Lists
+    {
+      cx=(float)(loop1%16)/16.0f;                  // X Position Of Current Character
+      cy=(float)(loop1/16)/16.0f;                  // Y Position Of Current Character
+      
+      glNewList(base+loop1,GL_COMPILE);            // Start Building A List
+      glBegin(GL_QUADS);                           // Use A Quad For Each Character
+      glTexCoord2f(cx,1.0f-cy-0.0625f);          // Texture Coord (Bottom Left)
+      glVertex2d(0,16);                          // Vertex Coord (Bottom Left)
+      glTexCoord2f(cx+0.0625f,1.0f-cy-0.0625f);  // Texture Coord (Bottom Right)
+      glVertex2i(16,16);                         // Vertex Coord (Bottom Right)
+      glTexCoord2f(cx+0.0625f,1.0f-cy-0.001f);   // Texture Coord (Top Right)
+      glVertex2i(16,0);                          // Vertex Coord (Top Right)
+      glTexCoord2f(cx,1.0f-cy-0.001f);           // Texture Coord (Top Left)
+      glVertex2i(0,0);                           // Vertex Coord (Top Left)
+      glEnd();                                     // Done Building Our Quad (Character)
+      glTranslated(12,0,0);                        // Move To The Right Of The Character
+      glEndList();                                 // Done Building The Display List
+    }                                              // Loop Until All 256 Are Built
+  return 1;
+}
+
+int Cone3DFont::KillFont(GLvoid)                          // Delete The Font From Memory
+{
+  glDeleteLists(base,256);                       // Delete All 256 Display Lists
+  return 1;
+}
+
+int Cone3DFont::PrintText(GLint x, GLint y, char type, char *fmt,...)// Where The Printing Happens
+{
+  char    text[1024];                            // Holds Our String
+  int blendOn,scissorOn,textureOn,lightOn;  // Holds the previous GL settings
+  int depthOn,matrixMode,screenStats[4],blendSrc,blendDst;
+  char typ=type;
+
+  va_list ap;                                    // Pointer To List Of Arguments
+
+  if (fmt == NULL)                               // If There's No Text
+    return 1;                                      // Do Nothing
+  
+  va_start(ap, fmt);                             // Parses The String For Variables
+  vsprintf(text, fmt, ap);                       // And Converts Symbols To Actual Numbers
+  va_end(ap);                                    // Results Are Stored In Text
+  
+  if (type>3)                                     // Did User Choose An Invalid Character Set?
+    type=3;                                       // If So, Select Set 2 (Italic)
+  
+  textureOn = glIsEnabled(GL_TEXTURE_2D); // Were textures enabled?
+  depthOn = glIsEnabled(GL_DEPTH_TEST);  // Was GL_DEPTH_TEST enabled?
+  lightOn = glIsEnabled(GL_LIGHTING); // Was GL_LIGHTING enabled?
+  scissorOn = glIsEnabled(GL_SCISSOR_TEST);  // etc.
+  glGetIntegerv(GL_MATRIX_MODE, &matrixMode);
+  glGetIntegerv(GL_VIEWPORT, screenStats);
+  blendOn= glIsEnabled(GL_BLEND);
+  glGetIntegerv(GL_BLEND_SRC, &blendSrc);
+  glGetIntegerv(GL_BLEND_DST, &blendDst);
+  
+  if (depthOn) glDisable(GL_DEPTH_TEST);  // If they were enabled/disabled
+  if (!textureOn) glEnable(GL_TEXTURE_2D); // then enable/disable them
+  if (!blendOn) glEnable(GL_BLEND);
+  if (!scissorOn) glEnable(GL_SCISSOR_TEST);
+  if (lightOn) glDisable(GL_LIGHTING);
+  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Set the correct blending mode
+  
+  glMatrixMode(GL_PROJECTION); // and initalize Ortho mode
+  glPushMatrix();
+  glLoadIdentity();
+  glOrtho(0.0f,screenStats[2],screenStats[3],0.0f,-1.0f,1.0f);
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+  glBindTexture(GL_TEXTURE_2D, font->getTexture());
+
+  if(type>1) typ=typ-2;
+  glLoadIdentity();
+  glTranslated(x,y,0);
+  glListBase(base-32+(128*typ));
+  glScalef(sizex,sizey,1.0f);
+  glCallLists(strlen(text),GL_UNSIGNED_BYTE, text); // Write The Text To The Screen
+  
+  if(type>1)
+    {
+      glLoadIdentity();
+      glTranslated(x+1,y,0);
+      glListBase(base-32+(128*(type-2)));
+      glScalef(sizex,sizey,1.0f);
+      glCallLists(strlen(text),GL_UNSIGNED_BYTE, text); // Write The Text To The Screen
+    }
+
+  glBindTexture(GL_TEXTURE_2D, 0); // Fix everything up
+  glMatrixMode(GL_PROJECTION);
+  glPopMatrix();
+  glMatrixMode(GL_MODELVIEW);
+  glPopMatrix();
+
+  if (depthOn) glEnable(GL_DEPTH_TEST);
+  if (!textureOn) glDisable(GL_TEXTURE_2D);
+  if (!blendOn) glDisable(GL_BLEND);
+  if (!scissorOn) glDisable(GL_SCISSOR_TEST);
+  if (lightOn) glEnable(GL_LIGHTING);
+
+  glBlendFunc(blendSrc, blendDst);
+  glMatrixMode(matrixMode);
+
+  return 1;
+}
Index: orxonox/trunk/src/sfont/cone3dfont.h
===================================================================
--- orxonox/trunk/src/sfont/cone3dfont.h	(revision 3455)
+++ orxonox/trunk/src/sfont/cone3dfont.h	(revision 3455)
@@ -0,0 +1,42 @@
+/***************************************************************************
+                          cone3dfont.h  -  description
+                             -------------------
+    copyright            : (C) 2001 by Marius Andra aka Cone3D
+    email                : marius@hot.ee
+    ICQ                  : 43999510
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+/*
+  This file is extended to the needs of the orxonox-project.
+  The main difference to the version of Marius is, that textures get 
+  loaded by orxonox Texture-class
+*/
+
+class Texture;
+
+
+class Cone3DFont
+{
+public:
+  Cone3DFont() {sizex=1.0f; sizey=1.0f;};
+	~Cone3DFont() {KillFont();};
+  int BuildFont(char *file);
+  int PrintText(int x, int y, char type, char *fmt, ...);
+  int KillFont();
+  int SetSize(float x, float y);
+
+  //  Cone3DTGA font;
+private:
+  int base;
+  float sizex,sizey;
+  Texture* font;
+
+};
