Changeset 5075 in orxonox.OLD for trunk/src/util
- Timestamp:
- Aug 19, 2005, 3:21:27 AM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/shell.cc
r5074 r5075 21 21 #include "list.h" 22 22 23 #include <stdarg.h> 24 #include <stdio.h> 25 23 26 using namespace std; 24 27 … … 41 44 42 45 43 this->addBufferLine("asjflksjdvklasmv", NULL);44 TextEngine::getInstance()->debug();46 //this->addBufferLineStatic("asjflksjdvklasmv %s", "doom"); 47 //TextEngine::getInstance()->debug(); 45 48 //exit(-1); 46 49 } … … 73 76 while(bufferDisplaySize > this->bufferText->getSize()) 74 77 { 75 Text* newText = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0);78 Text* newText = TextEngine::getInstance()->createText("fonts/earth.ttf", 10, TEXT_DYNAMIC, 0, 255, 0); 76 79 newText->setAlignment(TEXT_ALIGN_LEFT); 77 80 newText->setPosition2D(5, 5); … … 120 123 * @todo optimize 121 124 */ 122 void Shell::addBufferLine(const char* line, va_list args) 123 { 124 char tmp[1024];// = new char* 125 vsprintf(tmp, line, args); 126 127 char* newLine = new char[strlen(tmp)+1]; 128 strcpy(newLine, tmp); 129 130 this->buffer->addAtBeginning(newLine); 131 132 if (this->buffer->getSize() > this->bufferSize) 133 { 134 delete this->buffer->firstElement(); 135 this->buffer->remove(this->buffer->firstElement()); 136 } 125 bool Shell::addBufferLineStatic(const char* line, ...) 126 { 127 va_list arguments; 128 va_start(arguments, line); 129 130 if (Shell::singletonRef == NULL) 131 vprintf(line, arguments); 132 else 133 Shell::singletonRef->addBufferLine(line, arguments); 134 return true; 135 } 136 137 void Shell::addBufferLine(const char* line, va_list arguments) 138 { 139 vsprintf(this->bufferArray, line, arguments); 140 141 char* newLine = new char[strlen(this->bufferArray)+1]; 142 strcpy(newLine, this->bufferArray); 143 144 // this->buffer->add(newLine); 145 146 // if (this->buffer->getSize() > this->bufferSize) 147 // { 148 // delete this->buffer->firstElement(); 149 // this->buffer->remove(this->buffer->firstElement()); 150 // } 137 151 138 152 this->bufferText->firstElement()->setText(newLine); 139 140 153 } 141 154 -
trunk/src/util/shell.h
r5074 r5075 10 10 #include "event_listener.h" 11 11 12 #include <stdio.h>13 12 #include <stdarg.h> 14 15 13 16 14 // FORWARD DECLARATION … … 44 42 // BUFFER // 45 43 void flushBuffers(); 46 void addBufferLine(const char* Line, va_list args); 44 static bool addBufferLineStatic(const char* line, ...); 45 void addBufferLine(const char* line, va_list arg); 47 46 void moveBuffer(int lineCount); 48 47 const char* getBufferLine(unsigned int lineNumber); … … 81 80 tList<Text>* bufferText; //!< A list of stored bufferTexts for the display of the buffer 82 81 Text* inputLineText; //!< The inputLine of the Shell 82 83 char bufferArray[10000]; //!< a BUFFER for fast writing 84 83 85 }; 84 86
Note: See TracChangeset
for help on using the changeset viewer.