Changeset 8509 in orxonox.OLD for branches/gui/src/lib/gui/gl/specials/glgui_notifier.cc
- Timestamp:
- Jun 16, 2006, 12:22:35 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/gui/gl/specials/glgui_notifier.cc
r8503 r8509 33 33 // Element2D and generals 34 34 this->lineSpacing = 0; 35 this->linesProcessed = 0; 35 36 36 this->set BufferDisplaySize(10);37 this->setDisplayLineCount(10); 37 38 } 38 39 … … 43 44 { 44 45 // delete the displayable Buffers 45 while (!this->bufferText.empty()) 46 /* while (!this->displayLines.empty()) 47 { 48 delete this->displayLines.front().text; 49 this->displayLines.pop_front(); 50 } 51 52 while (!this->hiddenText.empty()) 53 { 54 delete this->hiddenText.top(); 55 this->hiddenText.pop(); 56 }*/ 57 } 58 59 void GLGuiNotifier::pushNotifyMessage(const std::string& message) 60 { 61 if (!this->hiddenText.empty()) 46 62 { 47 delete this->bufferText.front(); 48 this->bufferText.pop_front(); 63 printf("%s\n", message.c_str()); 64 DisplayLine dl; 65 dl.text = this->hiddenText.top(); 66 67 dl.text->setText(message); 68 this->hiddenText.pop(); 69 dl.age = 0.0f; 70 this->displayLines.push_back(dl); 71 72 this->repositionText(); 73 } 74 else 75 { 76 printf("grumble... must be fixed\n"); 49 77 } 50 78 } 51 79 80 81 void GLGuiNotifier::setDisplayLineCount(unsigned int count) 82 { 83 unsigned int currentCount = displayLines.size() + hiddenText.size(); 84 85 for (unsigned int i = currentCount; i < count; ++i) 86 { 87 MultiLineText* text = new MultiLineText(); 88 this->applyTextSettings(text); 89 this->hiddenText.push(text); 90 } 91 bufferDisplaySize = count; 92 } 52 93 53 94 … … 58 99 { 59 100 int linePos = -1; 60 std::list< MultiLineText*>::iterator textIt;61 for (textIt = this-> bufferText.begin() ; textIt != this->bufferText.end(); ++textIt )101 std::list<DisplayLine>::iterator textIt; 102 for (textIt = this->displayLines.begin() ; textIt != this->displayLines.end(); ++textIt ) 62 103 { 63 linePos += (*textIt)->getLineCount(); 64 (*textIt)->setRelCoorSoft2D(this->calculateLinePosition(linePos), 8); 104 linePos += (*textIt).text->getLineCount(); 105 (*textIt).text->setRelCoorSoft2D(this->calculateLinePosition(linePos), 8); 106 // printf("%f %f\n", (*textIt).text->getAbsCoor2D().x, (*textIt).text->getAbsCoor2D().y); 65 107 } 66 108 } … … 71 113 * @param text the Text to apply the settings to. 72 114 */ 73 void GLGuiNotifier::applyTextSettings( Text* text)115 void GLGuiNotifier::applyTextSettings(MultiLineText* text) 74 116 { 75 /* text->setSize(this->textSize);76 text->set Font(this->fontFile, this->textSize);77 text->setColor(this->textColor[0], this->textColor[1], this->textColor[2]);78 text->setBlending(this->textColor[3]); 79 text->setLayer(this->getLayer());117 text->setSize(this->style().textSize()); 118 text->setLineWidth( 300 ); 119 //text->setFont(this->fontFile, this->textSize); 120 121 //text->setColor( Color(1,1,1,1)/*this->style().foregroundColor() */); 80 122 if (text->getParent2D() != this) 81 text->setParent2D(this); */123 text->setParent2D(this); 82 124 } 83 125 … … 113 155 Vector2D GLGuiNotifier::calculateLinePosition(unsigned int lineNumber) 114 156 { 115 // return Vector2D(5.0f, (float)(this->textSize + this->lineSpacing)*(float)((int)this->bufferDisplaySize - (int)lineNumber - (int)1)); 116 return Vector2D(); 157 return Vector2D(0.0f, (float)(this->style().textSize() + this->lineSpacing)*(float)((int)this->bufferDisplaySize - (int)lineNumber - (int)1)); 117 158 } 118 159 119 160 161 void GLGuiNotifier::resize() 162 {} 120 163 121 164 /**
Note: See TracChangeset
for help on using the changeset viewer.