Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

OpenGLConsole.cpp

Go to the documentation of this file.
00001 
00007 #include "OpenGLConsole.h"
00008 
00009 OpenGLConsole::OpenGLConsole() {
00010 }
00011 
00012 OpenGLConsole::~OpenGLConsole() {
00013 }
00014 
00015 void OpenGLConsole::draw(OpenGLFont *font) {
00016         if (!g_drawConsole)
00017                 return;
00018 
00019         float x = 20.0f;
00020         float y = 40.0f;
00021 
00022         font->startTextMode();
00023 
00024         LLNode <ConsoleEntry> *node = history.getLast();
00025 
00026         ConsoleEntry *ce;
00027         float alpha;
00028         int n = 10;
00029 
00030         while (node != NULL && n > 0) {
00031                 ce = (ConsoleEntry *)&node->obj;
00032 
00033                 //font->setColor(ce.clr.x, ce.clr.y, ce.clr.z, n/10.0f);
00034 
00035                 if (g_time - ce->time <= 1000.0f)
00036                         alpha = (g_time - ce->time)/1000.0f;
00037                 else
00038                         alpha = 1.0f - (g_time - ce->time - 1000.0f)/6000.0f;
00039                         //alpha = 2000.0f / (g_time - ce.time - 500.0f + n/10.0f);
00040 
00041                 if (alpha <= 0.0f) alpha = 0.0f;
00042                 font->setColor(ce->clr.x, ce->clr.y, ce->clr.z, alpha);
00043 
00044                 font->print(x, g_height- y, (const char *)ce->str);
00045 
00046                 node = node->prev;
00047 
00048                 y += 20.0f;
00049                 n--;
00050         }
00051 
00052         if (g_console) {
00053                 String str = "> ";
00054                 str += console;
00055 
00056                 font->setColor(1.0f, 1.0f, 1.0f, 1.0f);
00057                 font->print(x, g_height-20.0f, str);
00058 
00059                 font->print(x + 8.0f*(pos+2), g_height-20.0f, "_");
00060         }
00061 
00062         font->endTextMode();
00063 }

Generated on Sun Jun 5 15:47:04 2005 for Defacto by  doxygen 1.4.3