00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <stdlib.h>
00021 #include <time.h>
00022 #include "globals.h"
00023
00024
00025 glictGlobalsClass glictGlobals;
00026
00027 glictGlobalsClass::glictGlobalsClass() {
00028 windowTitleBgColor.r = 0.0; windowTitleBgColor.g = 0.0; windowTitleBgColor.b = 1.0; windowTitleBgColor.a = 1.0;
00029 windowTitleColor.r = 1.0; windowTitleColor.g = 1.0; windowTitleColor.b = 1.0; windowTitleColor.a = 1.0;
00030 windowTitleSkin = NULL;
00031 windowBodySkin = NULL;
00032 buttonSkin = NULL;
00033 buttonHighlightSkin = NULL;
00034 textboxSkin = NULL;
00035 buttonTextColor.r = 1.; buttonTextColor.g = 1.; buttonTextColor.b = 1.; buttonTextColor.a = 1.;
00036 buttonHighlightTextColor.r = 1.; buttonHighlightTextColor.g = 1.; buttonHighlightTextColor.b = 1.; buttonHighlightTextColor.a = 1.;
00037 panelTextColor.r = 1.; panelTextColor.g = 1.; panelTextColor.b = 1.; panelTextColor.a = 1.;
00038 textboxTextColor.r = 1.; textboxTextColor.g = 1.; textboxTextColor.b = 1.; textboxTextColor.a = 1.;
00039
00040 drawPartialOut = true;
00041
00042 lastMousePos.x = 0; lastMousePos.y = 0;
00043 srand(time(NULL));
00044
00045 topFocused = NULL;
00046
00047 clippingMode = GLICT_NOCLIP;
00048
00049 this->debugCallback = NULL;
00050 this->paintrectCallback = NULL;
00051 this->paintrectlinesCallback = NULL;
00052 #ifndef NO_GL
00053 this->enableGlTranslate = true;
00054 #else
00055 this->enableGlTranslate = false;
00056 #endif
00057 translation.x = 0; translation.y = 0;
00058 }
00059 glictGlobalsClass::~glictGlobalsClass() {
00060 }
00061
00062 void glictGlobalsClass::Translatef(float x, float y, float z) {
00063 if (enableGlTranslate) {
00064 #ifndef NO_GL
00065 glTranslatef(x,y,z);
00066 #endif
00067 } else {
00068 translation.x += x;
00069 translation.y += y;
00070 }
00071 }
00072 void glictGlobalsClass::PaintRect(float left, float right, float top, float bottom ) {
00073 glictColor tmp (-1,-1,-1,-1);
00074 PaintRect(left, right, top, bottom, tmp);
00075 }
00076 void glictGlobalsClass::PaintRect(float left, float right, float top, float bottom, glictColor &col) {
00077 if (paintrectCallback) {
00078 paintrectCallback (left, right, top, bottom, col) ;
00079 } else {
00080 #ifndef NO_GL
00081 if (col.a >= 0) glColor4f(col.r, col.g, col.b, col.a);
00082 glBegin(GL_QUADS);
00083 glTexCoord2f(0, 0);
00084 glVertex2f(left, top);
00085 glTexCoord2f(0, 1);
00086 glVertex2f(left, bottom);
00087 glTexCoord2f(1, 1);
00088 glVertex2f(right, bottom);
00089 glTexCoord2f(1, 0);
00090 glVertex2f(right, top);
00091 glEnd();
00092 #endif
00093 }
00094 }
00095
00096 void glictGlobalsClass::PaintRectLines(float left, float right, float top, float bottom ) {
00097 glictColor tmp (-1,-1,-1,-1);
00098 PaintRectLines(left, right, top, bottom, tmp);
00099 }
00100 void glictGlobalsClass::PaintRectLines(float left, float right, float top, float bottom, glictColor &col) {
00101 if (paintrectCallback) {
00102 paintrectCallback (left, right, top, bottom, col) ;
00103 } else {
00104 #ifndef NO_GL
00105 if (col.a >= 0) glColor4f(col.r, col.g, col.b, col.a);
00106 glBegin(GL_LINE_LOOP);
00107 glTexCoord2f(0, 0);
00108 glVertex2f(left, top);
00109 glTexCoord2f(0, 1);
00110 glVertex2f(left, bottom);
00111 glTexCoord2f(1, 1);
00112 glVertex2f(right, bottom);
00113 glTexCoord2f(1, 0);
00114 glVertex2f(right, top);
00115 glEnd();
00116 #endif
00117 }
00118 }
00119
00120 void glictGlobalsClass::SetColor(float r, float g, float b, float a) {
00121 #ifndef NO_GL
00122 glColor4f(r,g,b,a);
00123 #endif
00124 }