- Timestamp:
- Oct 13, 2005, 12:40:04 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r5354 r5372 55 55 this->loadParams(root); 56 56 57 NullParent::getInstance()->addChild(this); 57 if (this->parent == NULL) 58 NullParent::getInstance()->addChild(this); 58 59 } 59 60 -
trunk/src/lib/gui/gl_gui/glgui_widget.h
r5366 r5372 39 39 bool focusable; //!< If it can receive focus. 40 40 bool clickable; //!< if it can be clicked upon. 41 42 43 44 45 41 }; 46 42 -
trunk/src/lib/shell/shell.cc
r5369 r5372 25 25 #include "list.h" 26 26 #include "graphics_engine.h" 27 #include "material.h" 27 28 #include "event_handler.h" 28 29 #include "debug.h" … … 61 62 EventHandler::getInstance()->subscribe(this, ES_SHELL, SDLK_PAGEDOWN); 62 63 64 // BUFFER 65 this->bufferText = NULL; 66 this->bufferDisplaySize = 10; 67 this->bufferOffset = 0; 68 this->bufferIterator = ShellBuffer::getInstance()->getBuffer()->getIterator(); 69 70 // INPUT LINE 71 this->shellInput = new ShellInput; 72 73 this->backgroundMaterial = new Material; 63 74 // Element2D and generals 64 75 this->setAbsCoor2D(3, -400); … … 69 80 strcpy(this->fontFile, SHELL_DEFAULT_FONT); 70 81 71 // BUFFER72 this->bufferText = NULL;73 this->bufferDisplaySize = 10;74 this->bufferOffset = 0;75 this->bufferIterator = ShellBuffer::getInstance()->getBuffer()->getIterator();76 77 // INPUT LINE78 this->shellInput = new ShellInput;79 //this->commandList = new tList<ShellCommand>;80 82 81 83 this->rebuildText(); 84 this->setTextColor(SHELL_DEFAULT_TEXT_COLOR); 85 this->setBackgroundColor(SHELL_DEFAULT_BACKGROUND_COLOR); 82 86 83 87 // register the shell at the ShellBuffer … … 100 104 // delete the inputLine 101 105 delete this->shellInput; 106 delete this->backgroundMaterial; 102 107 } 103 108 … … 183 188 this->textSize = textSize; 184 189 this->lineSpacing = lineSpacing; 185 this->shellInput->setSize(this->textSize); 186 this->shellInput->setRelCoor2D(5, (this->textSize + this->lineSpacing)*this->bufferDisplaySize + this->textSize); 190 this->resetValues(); 191 } 192 193 /** 194 * sets the color of the Font. 195 * @param r: red 196 * @param g: green 197 * @param b: blue 198 * @param a: alpha-value. 199 */ 200 void Shell::setTextColor(float r, float g, float b, float a) 201 { 202 this->textColor[0] = r; 203 this->textColor[1] = g; 204 this->textColor[2] = b; 205 this->textColor[3] = a; 206 207 this->resetValues(); 208 } 209 210 211 /** 212 * sets the color of the Backgrond. 213 * @param r: red 214 * @param g: green 215 * @param b: blue 216 * @param a: alpha-value. 217 */ 218 void Shell::setBackgroundColor(float r, float g, float b, float a) 219 { 220 this->backgroundMaterial->setDiffuse(r, g, b); 221 this->backgroundColor[0] = r; 222 this->backgroundColor[1] = g; 223 this->backgroundColor[2] = b; 224 this->backgroundColor[3] = a; 225 this->backgroundMaterial->setTransparency(a); 226 } 227 228 /** 229 * resets the Values of all visible shell's commandos to the Shell's stored values 230 * 231 * this functions synchronizes the stored Data with the visible one. 232 */ 233 void Shell::resetValues() 234 { 235 if (this->shellInput != NULL) 236 { 237 this->shellInput->setSize(this->textSize); 238 this->shellInput->setColor(this->textColor[0], this->textColor[1], this->textColor[2]); 239 this->shellInput->setBlending(this->textColor[3]); 240 this->shellInput->setRelCoor2D(5, (this->textSize + this->lineSpacing)*this->bufferDisplaySize + this->textSize); 241 } 187 242 188 243 if (this->bufferText != NULL) … … 193 248 { 194 249 this->bufferText[i]->setSize(this->textSize); 195 this->bufferText[i]->setRelCoorSoft2D(calculateLinePosition(i)); 250 this->bufferText[i]->setColor(this->textColor[0], this->textColor[1], this->textColor[2]); 251 this->bufferText[i]->setBlending(this->textColor[3]); 252 this->bufferText[i]->setRelCoor2D(calculateLinePosition(i)); 196 253 } 197 254 } … … 209 266 { 210 267 this->shellInput->setFont(this->fontFile, this->textSize); 211 this->shellInput->setColor(1, 0, 0);212 268 this->shellInput->setAlignment(TEXT_ALIGN_LEFT); 213 269 if (shellInput->getParent() != this) 214 270 this->shellInput->setParent2D(this); 215 this->shellInput->setRelCoor2D(5, (this->textSize + this->lineSpacing)*this->bufferDisplaySize + this->textSize);216 271 217 272 this->setBufferDisplaySize(this->bufferDisplaySize); … … 239 294 { 240 295 bufferText[i] = new Text(this->fontFile, this->textSize, TEXT_RENDER_DYNAMIC); 241 bufferText[i]->setColor(1, 0, 0);242 296 bufferText[i]->setAlignment(TEXT_ALIGN_LEFT); 243 bufferText[i]->setRelCoor2D(calculateLinePosition(i));244 297 bufferText[i]->setText(text); 245 298 bufferText[i]->setParent2D(this); … … 391 444 // setting the Blending effects 392 445 393 glColor4f(0.0f, 0.0f, 0.8f, .4); 394 glEnable(GL_BLEND); 395 glDisable(GL_TEXTURE_2D); 396 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 397 398 glBindTexture(GL_TEXTURE_2D, 0); 446 this->backgroundMaterial->select(); 447 glColor4f(*(this->backgroundColor), 448 *(this->backgroundColor+1), 449 *(this->backgroundColor+2), 450 *(this->backgroundColor+3)); 451 452 399 453 glBegin(GL_TRIANGLE_STRIP); 400 454 -
trunk/src/lib/shell/shell.h
r5253 r5372 4 4 * 5 5 * @todo Buffer Display in different Colors for different debug mode. 6 * @todo choose color of the Font and the background. 6 7 */ 7 8 … … 14 15 #include <stdarg.h> 15 16 16 #define SHELL_DEFAULT_FONT "fonts/dpquake_.ttf" 17 #define SHELL_DEFAULT_FONT "fonts/dpquake_.ttf" 18 #define SHELL_DEFAULT_TEXT_COLOR 1,0,0,1 19 #define SHELL_DEFAULT_BACKGROUND_COLOR 0,0,.8,.8 17 20 18 21 // FORWARD DECLARATION 19 22 class Text; 20 23 class ShellInput; 24 class Material; 21 25 template<class T> class tIterator; 22 26 … … 52 56 void setFont(const char* fontFile); 53 57 void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1); 58 void setTextColor(float r, float g, float b, float a); 59 void setBackgroundColor(float r, float g, float b, float a); 60 61 void resetValues(); 54 62 void rebuildText(); 55 63 … … 86 94 unsigned int lineSpacing; //!< The Spacing between lines. 87 95 unsigned int textSize; //!< The size of the text. 96 float textColor[4]; //!< The text's color [r,g,b,a]. 88 97 char* fontFile; //!< The file containing the font. 98 Material* backgroundMaterial; //!< A material for the background. 99 float backgroundColor[4]; //!< The color of the background [r,g,b,a]. 89 100 90 101 // HANDLING TEXT INPUT -
trunk/src/util/resource_manager.cc
r5366 r5372 31 31 #ifndef NO_TEXT 32 32 #include "font.h" 33 #include "text.h" //!< @todo this should not be included here. -> make FONT independant of SIZE...34 33 #endif /* NO_TEXT */ 35 34 #ifndef NO_AUDIO … … 365 364 tmpResource->ttfSize = *(unsigned int*)param1; 366 365 else 367 tmpResource->ttfSize = TEXT_DEFAULT_SIZE;366 tmpResource->ttfSize = FONT_DEFAULT_RENDER_SIZE; 368 367 369 368 if(isFile(fullName)) … … 621 620 if (param1 == NULL) 622 621 { 623 if (enumRes->ttfSize == TEXT_DEFAULT_SIZE)622 if (enumRes->ttfSize == FONT_DEFAULT_RENDER_SIZE) 624 623 match = true; 625 624 }
Note: See TracChangeset
for help on using the changeset viewer.