Changeset 5068 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Aug 18, 2005, 3:51:43 PM (19 years ago)
- Location:
- orxonox/trunk/src/util
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/shell.cc
r5065 r5068 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 14 */ … … 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 17 17 18 #include " proto_class.h"18 #include "shell.h" 19 19 20 20 using namespace std; … … 23 23 /** 24 24 * standard constructor 25 * @todo this constructor is not jet implemented - do it 26 */ 27 ProtoClass::ProtoClass () 25 */ 26 Shell::Shell () 28 27 { 29 this->setClassID(CL_PROTO_ID, "ProtoClass"); 28 this->setClassID(CL_SHELL, "Shell"); 29 } 30 30 31 /* If you make a new class, what is most probably the case when you write this file32 don't forget to:33 1. Add the new file new_class.cc to the ./src/Makefile.am34 2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS35 31 36 Advanced Topics: 37 - if you want to let your object be managed via the ObjectManager make sure to read 38 the object_manager.h header comments. You will use this most certanly only if you 39 make many objects of your class, like a weapon bullet. 40 */ 32 Shell* Shell::singletonRef = NULL; 33 34 /** 35 * standard deconstructor 36 */ 37 Shell::~Shell () 38 { 39 // delete what has to be deleted here 40 41 Shell::singletonRef = NULL; 42 } 43 44 45 46 47 void setBufferDisplaySize(unsigned int bufferDisplaySize); 48 49 /** 50 * deletes all the Buffers 51 */ 52 void Shell::flushBuffers() 53 { 54 55 } 56 57 /** 58 * adds a new Line to the List of Buffers 59 * @param line the Line as in the first argument in printf 60 * @param args the arguments as a va_list 61 */ 62 void Shell::addBufferLine(const char* line, va_list args) 63 { 64 } 65 66 /** 67 * moves the buffer around lineCount lines upwards (negative values move down) 68 * @param lineCount the Count of lines to move upwards 69 */ 70 void Shell::moveBuffer(int lineCount) 71 { 72 } 73 74 /** 75 * @param lineNumber the n-th line from the bottom 76 * @returns the Buffer at Line lineNumber 77 */ 78 const char* Shell::getBufferLine(unsigned int lineNumber) 79 { 41 80 } 42 81 43 82 44 83 /** 45 * standard deconstructor46 */47 ProtoClass::~ProtoClass()84 * deletes the InputLine 85 */ 86 void Shell::flushInputLine() 48 87 { 49 // delete what has to be deleted here50 88 } 89 90 /** 91 * adds one character to the inputLine 92 * @param character the character to add to the inputLine 93 */ 94 void Shell::addCharacter(char character) 95 { 96 } 97 98 /** 99 * adds multiple Characters to thr inputLine 100 * @param characters a '\0' terminated char-array to add to the InputLine 101 */ 102 void Shell::addCharacters(const char* characters) 103 { 104 } 105 106 /** 107 * removes characterCount characters from the InputLine 108 * @param characterCount the count of Characters to remove from the input Line 109 */ 110 void Shell::removeCharacters(unsigned int characterCount) 111 { 112 } 113 114 115 /** 116 * ticks the Shell for dt Seconds 117 * @param dt the elapsed time since the last tick(); 118 */ 119 void Shell::tick(float dt) 120 { 121 } 122 123 /** 124 * displays the Shell 125 */ 126 void Shell::draw() const 127 { 128 } 129 130 131 /** 132 * autocompletes the Shell's inputLine 133 * @returns true, if a result was found, false otherwise 134 */ 135 bool Shell::autoComplete() 136 { 137 138 } 139 140 /** 141 * displays some nice output from the Shell 142 */ 143 void Shell::debug() const 144 { 145 146 } -
orxonox/trunk/src/util/shell.h
r5065 r5068 1 1 /*! 2 * @file proto_class.h3 * @brief Definition of ...2 * @file shell.h 3 * Definition of a on-screen-shell 4 4 */ 5 5 6 #ifndef _ PROTO_CLASS_H7 #define _ PROTO_CLASS_H6 #ifndef _SHELL_H 7 #define _SHELL_H 8 8 9 #include "base_object.h" 9 #include "element_2d.h" 10 11 #include <stdio.h> 12 #include <stdarg.h> 13 10 14 11 15 // FORWARD DECLARATION 16 class Text; 17 template<class T> class tList; 18 19 //! A class that is able to redirect all output to a openGL-Shell, and that one can use to input some commands 20 /** 21 * the major idea is, that all the Output can be redirected to the Shell, 22 * and does not have to be displayed to the opening Shell, this is good, 23 * for developers using Windows, where all output is otherwise redirected 24 * to stdout.txt 25 * 26 * Furthermore the Shell should enable us, to input some simple commands 27 * Each Class can tell check itself in to the Shell, and listen for commands. 28 * 29 * @todo implement what is written above :/ 30 */ 31 class Shell : public Element2D { 32 33 public: 34 virtual ~Shell(); 35 /** @returns a Pointer to the only object of this Class */ 36 inline static Shell* getInstance(void) { if (!Shell::singletonRef) Shell::singletonRef = new Shell(); return Shell::singletonRef; }; 12 37 13 38 39 void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; }; 14 40 15 //! A class for ... 16 class ProtoClass : public BaseObject { 41 void setBufferDisplaySize(unsigned int bufferDisplaySize); 17 42 18 public: 19 ProtoClass(); 20 virtual ~ProtoClass(); 43 // BUFFER // 44 void flushBuffers(); 45 void addBufferLine(const char* Line, va_list args); 46 void moveBuffer(int lineCount); 47 const char* getBufferLine(unsigned int lineNumber); 48 49 // inputLine 50 void flushInputLine(); 51 void addCharacter(char character); 52 void addCharacters(const char* characters); 53 void removeCharacters(unsigned int characterCount = 1); 21 54 22 55 23 private: 56 // Element2D-functions 57 void tick(float dt); 58 virtual void draw() const; 24 59 60 void debug() const; 61 62 private: 63 bool autoComplete(); 64 65 66 private: 67 Shell(); 68 static Shell* singletonRef; 69 70 unsigned int bufferSize; 71 unsigned int bufferDisplaySize; 72 73 char* inputLine; 74 75 tList<const char>* buffer; 76 77 tList<Text>* bufferText; //!< A list of sored bufferLines of the Shell 78 Text* inputLineText; //!< The inputLine of the Shell 25 79 }; 26 80 27 #endif /* _ PROTO_CLASS_H */81 #endif /* _SHELL_H */
Note: See TracChangeset
for help on using the changeset viewer.