- Timestamp:
- Oct 10, 2005, 12:39:21 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Makefile.am
r5342 r5344 77 77 lib/graphics/light.cc \ 78 78 lib/graphics/shader.cc \ 79 lib/graphics/text_engine/text.cc \ 80 lib/graphics/text_engine/font.cc \ 79 81 lib/graphics/text_engine/text_engine.cc \ 80 82 lib/graphics/render2D/element_2d.cc \ … … 150 152 lib/graphics/light.h \ 151 153 lib/graphics/shader.h \ 154 lib/graphics/text_engine/text.h \ 155 lib/graphics/text_engine/font.h \ 152 156 lib/graphics/text_engine/text_engine.h \ 153 157 lib/lang/base_object.h \ -
trunk/src/Makefile.in
r5342 r5344 76 76 orxonox-p_node.$(OBJEXT) orxonox-null_parent.$(OBJEXT) \ 77 77 orxonox-graphics_engine.$(OBJEXT) orxonox-light.$(OBJEXT) \ 78 orxonox-shader.$(OBJEXT) orxonox-text_engine.$(OBJEXT) \ 78 orxonox-shader.$(OBJEXT) orxonox-text.$(OBJEXT) \ 79 orxonox-font.$(OBJEXT) orxonox-text_engine.$(OBJEXT) \ 79 80 orxonox-element_2d.$(OBJEXT) orxonox-render_2d.$(OBJEXT) \ 80 81 orxonox-base_object.$(OBJEXT) orxonox-class_list.$(OBJEXT) \ … … 104 105 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-factory.Po \ 105 106 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-fast_factory.Po \ 107 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-font.Po \ 106 108 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-game_loader.Po \ 107 109 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-garbage_collector.Po \ … … 132 134 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-test_entity.Po \ 133 135 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-test_gun.Po \ 136 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-text.Po \ 134 137 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-text_engine.Po \ 135 138 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox-track_manager.Po \ … … 337 340 lib/graphics/light.cc \ 338 341 lib/graphics/shader.cc \ 342 lib/graphics/text_engine/text.cc \ 343 lib/graphics/text_engine/font.cc \ 339 344 lib/graphics/text_engine/text_engine.cc \ 340 345 lib/graphics/render2D/element_2d.cc \ … … 410 415 lib/graphics/light.h \ 411 416 lib/graphics/shader.h \ 417 lib/graphics/text_engine/text.h \ 418 lib/graphics/text_engine/font.h \ 412 419 lib/graphics/text_engine/text_engine.h \ 413 420 lib/lang/base_object.h \ … … 518 525 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-factory.Po@am__quote@ 519 526 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-fast_factory.Po@am__quote@ 527 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-font.Po@am__quote@ 520 528 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-game_loader.Po@am__quote@ 521 529 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-garbage_collector.Po@am__quote@ … … 546 554 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-test_entity.Po@am__quote@ 547 555 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-test_gun.Po@am__quote@ 556 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-text.Po@am__quote@ 548 557 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-text_engine.Po@am__quote@ 549 558 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-track_manager.Po@am__quote@ … … 1244 1253 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1245 1254 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-shader.obj `if test -f 'lib/graphics/shader.cc'; then $(CYGPATH_W) 'lib/graphics/shader.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/shader.cc'; fi` 1255 1256 orxonox-text.o: lib/graphics/text_engine/text.cc 1257 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-text.o -MD -MP -MF "$(DEPDIR)/orxonox-text.Tpo" -c -o orxonox-text.o `test -f 'lib/graphics/text_engine/text.cc' || echo '$(srcdir)/'`lib/graphics/text_engine/text.cc; \ 1258 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/orxonox-text.Tpo" "$(DEPDIR)/orxonox-text.Po"; else rm -f "$(DEPDIR)/orxonox-text.Tpo"; exit 1; fi 1259 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/graphics/text_engine/text.cc' object='orxonox-text.o' libtool=no @AMDEPBACKSLASH@ 1260 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/orxonox-text.Po' tmpdepfile='$(DEPDIR)/orxonox-text.TPo' @AMDEPBACKSLASH@ 1261 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1262 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-text.o `test -f 'lib/graphics/text_engine/text.cc' || echo '$(srcdir)/'`lib/graphics/text_engine/text.cc 1263 1264 orxonox-text.obj: lib/graphics/text_engine/text.cc 1265 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-text.obj -MD -MP -MF "$(DEPDIR)/orxonox-text.Tpo" -c -o orxonox-text.obj `if test -f 'lib/graphics/text_engine/text.cc'; then $(CYGPATH_W) 'lib/graphics/text_engine/text.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/text_engine/text.cc'; fi`; \ 1266 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/orxonox-text.Tpo" "$(DEPDIR)/orxonox-text.Po"; else rm -f "$(DEPDIR)/orxonox-text.Tpo"; exit 1; fi 1267 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/graphics/text_engine/text.cc' object='orxonox-text.obj' libtool=no @AMDEPBACKSLASH@ 1268 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/orxonox-text.Po' tmpdepfile='$(DEPDIR)/orxonox-text.TPo' @AMDEPBACKSLASH@ 1269 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1270 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-text.obj `if test -f 'lib/graphics/text_engine/text.cc'; then $(CYGPATH_W) 'lib/graphics/text_engine/text.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/text_engine/text.cc'; fi` 1271 1272 orxonox-font.o: lib/graphics/text_engine/font.cc 1273 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-font.o -MD -MP -MF "$(DEPDIR)/orxonox-font.Tpo" -c -o orxonox-font.o `test -f 'lib/graphics/text_engine/font.cc' || echo '$(srcdir)/'`lib/graphics/text_engine/font.cc; \ 1274 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/orxonox-font.Tpo" "$(DEPDIR)/orxonox-font.Po"; else rm -f "$(DEPDIR)/orxonox-font.Tpo"; exit 1; fi 1275 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/graphics/text_engine/font.cc' object='orxonox-font.o' libtool=no @AMDEPBACKSLASH@ 1276 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/orxonox-font.Po' tmpdepfile='$(DEPDIR)/orxonox-font.TPo' @AMDEPBACKSLASH@ 1277 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1278 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-font.o `test -f 'lib/graphics/text_engine/font.cc' || echo '$(srcdir)/'`lib/graphics/text_engine/font.cc 1279 1280 orxonox-font.obj: lib/graphics/text_engine/font.cc 1281 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-font.obj -MD -MP -MF "$(DEPDIR)/orxonox-font.Tpo" -c -o orxonox-font.obj `if test -f 'lib/graphics/text_engine/font.cc'; then $(CYGPATH_W) 'lib/graphics/text_engine/font.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/text_engine/font.cc'; fi`; \ 1282 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/orxonox-font.Tpo" "$(DEPDIR)/orxonox-font.Po"; else rm -f "$(DEPDIR)/orxonox-font.Tpo"; exit 1; fi 1283 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/graphics/text_engine/font.cc' object='orxonox-font.obj' libtool=no @AMDEPBACKSLASH@ 1284 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/orxonox-font.Po' tmpdepfile='$(DEPDIR)/orxonox-font.TPo' @AMDEPBACKSLASH@ 1285 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1286 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-font.obj `if test -f 'lib/graphics/text_engine/font.cc'; then $(CYGPATH_W) 'lib/graphics/text_engine/font.cc'; else $(CYGPATH_W) '$(srcdir)/lib/graphics/text_engine/font.cc'; fi` 1246 1287 1247 1288 orxonox-text_engine.o: lib/graphics/text_engine/text_engine.cc -
trunk/src/lib/graphics/graphics_engine.cc
r5318 r5344 27 27 #include "ini_parser.h" 28 28 #include "substring.h" 29 29 #include "text.h" 30 30 31 31 using namespace std; … … 564 564 if (this->geTextCFPS == NULL) 565 565 { 566 this->geTextCFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);566 this->geTextCFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC); 567 567 this->geTextCFPS->setName("curFPS"); 568 568 this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT); … … 571 571 if (this->geTextMaxFPS == NULL) 572 572 { 573 this->geTextMaxFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);573 this->geTextMaxFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC); 574 574 this->geTextMaxFPS->setName("MaxFPS"); 575 575 this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT); … … 578 578 if (this->geTextMinFPS == NULL) 579 579 { 580 this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);580 this->geTextMinFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC); 581 581 this->geTextMinFPS->setName("MinFPS"); 582 582 this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT); -
trunk/src/lib/graphics/text_engine/font.h
r5343 r5344 2 2 * @file font.h 3 3 * brief Definition of the FONT-loading class 4 * 5 * !! IMPORTANT !! When using ttf fonts clear the license issues prior to 6 * adding them to orxonox. This is really important, because we do not want 7 * to offend anyone. 4 8 */ 5 9 -
trunk/src/lib/graphics/text_engine/text.cc
r5343 r5344 38 38 if (fontFile != NULL) 39 39 this->setFont(fontFile, fontSize); 40 this->setType(type);41 }42 43 /**44 * creates a new Text Element45 * @param font the Font to render this text in46 * @param type The renderType to display this font in47 *48 * this constructor is private, because the user should initialize49 * a text with the TextEngine.50 */51 Text::Text(Font* font, TEXT_RENDER_TYPE type)52 {53 this->init();54 55 this->font = font;56 40 this->setType(type); 57 41 } … … 89 73 90 74 /** 91 * sets the Font of this Text to font92 * @param font the Font (normaly from the ResourceManager) to allocate to this Text93 */94 void Text::setFont(Font* font)95 {96 if (this->font != NULL)97 ResourceManager::getInstance()->unload(this->font);98 this->font = font;99 }100 101 /**102 75 * sets the Font of this Text to font from fontFile 103 76 * @param fontFile the File to load the Font from. … … 111 84 112 85 tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, &fontSize); 113 if (tmpFont == NULL) 86 if (tmpFont != NULL) 87 { 88 if (this->font != NULL) 89 ResourceManager::getInstance()->unload(this->font); 90 this->font = tmpFont; 91 } 92 93 else 114 94 { 115 95 PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile); 116 this->setFont(NULL);117 }118 else119 this->setFont(tmpFont);96 if (this->font != NULL) 97 ResourceManager::getInstance()->unload(this->font); 98 this->font = NULL; 99 } 120 100 } 121 101 -
trunk/src/lib/graphics/text_engine/text.h
r5343 r5344 24 24 // FORWARD DECLARATION 25 25 class Font; 26 27 26 28 27 /** … … 57 56 class Text : public Element2D 58 57 { 59 friend class TextEngine;60 58 public: 61 59 Text(const char* fontFile, unsigned int fontSize = TEXT_DEFAULT_SIZE, TEXT_RENDER_TYPE type = TEXT_RENDER_DYNAMIC); … … 86 84 87 85 private: 88 Text(Font* font = NULL, TEXT_RENDER_TYPE type = TEXT_RENDER_DYNAMIC);89 void setFont(Font* font);90 91 86 92 87 private: -
trunk/src/lib/graphics/text_engine/text_engine.cc
r5343 r5344 23 23 24 24 #include "text_engine.h" 25 #include "text.h" 26 #include "font.h" 25 27 26 28 using namespace std; … … 34 36 #include "class_list.h" 35 37 36 #include "p_node.h"37 #include "vector.h"38 38 #include "debug.h" 39 39 #include "list.h" … … 126 126 127 127 /** 128 * creates a new Text with a certain font.129 * @see Font::Font130 * @see Text::Text131 */132 Text* TextEngine::createText(const char* fontFile, unsigned int fontSize, int textType)133 {134 Font* tmpFont;135 Text* newText;136 Vector tmpVec;137 138 tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, &fontSize);139 if (!tmpFont)140 {141 PRINTF(2)("Font %s could not be loaded, probably file not found\n", fontFile);142 return NULL;143 }144 else145 return new Text(tmpFont, TEXT_RENDER_DYNAMIC);146 }147 148 /**149 128 * outputs some nice Debug information 150 129 -
trunk/src/lib/graphics/text_engine/text_engine.h
r5343 r5344 18 18 19 19 #include "base_object.h" 20 #include "font.h"21 #include "text.h"22 20 23 21 #include "vector.h" … … 26 24 class PNode; 27 25 class Font; 26 class Text; 28 27 29 28 /////////////////// … … 37 36 /** @returns a Pointer to the only object of this Class */ 38 37 inline static TextEngine* getInstance() { if (!singletonRef) singletonRef = new TextEngine(); return singletonRef; }; 39 40 Text* createText(const char* fontFile,41 unsigned int fontSize = TEXT_DEFAULT_SIZE,42 int textType = TEXT_RENDER_DYNAMIC);43 38 44 39 void debug() const; -
trunk/src/lib/shell/shell.cc
r5335 r5344 22 22 23 23 24 #include "text _engine.h"24 #include "text.h" 25 25 #include "list.h" 26 26 #include "graphics_engine.h" … … 225 225 for (unsigned int i = 0; i < bufferDisplaySize; i++) 226 226 { 227 bufferText[i] = TextEngine::getInstance()->createText(this->fontFile, this->textSize, TEXT_RENDER_DYNAMIC);227 bufferText[i] = new Text(this->fontFile, this->textSize, TEXT_RENDER_DYNAMIC); 228 228 bufferText[i]->setColor(1, 0, 0); 229 229 bufferText[i]->setAlignment(TEXT_ALIGN_LEFT); -
trunk/src/lib/shell/shell_input.h
r5254 r5344 10 10 #define _SHELL_INPUT_H 11 11 12 #include "text _engine.h"12 #include "text.h" 13 13 #include "event_listener.h" 14 14 -
trunk/src/util/resource_manager.cc
r5335 r5344 30 30 #endif /* NO_TEXTURES */ 31 31 #ifndef NO_TEXT 32 #include "text_engine.h" 32 #include "font.h" 33 #include "text.h" //!< @todo this should not be included here. -> make FONT independant of SIZE... 33 34 #endif /* NO_TEXT */ 34 35 #ifndef NO_AUDIO … … 359 360 tmpResource->ttfSize = *(unsigned int*)param1; 360 361 else 361 tmpResource->ttfSize = FONT_DEFAULT_SIZE;362 tmpResource->ttfSize = TEXT_DEFAULT_SIZE; 362 363 363 364 if(isFile(fullName)) … … 613 614 if (param1 == NULL) 614 615 { 615 if (enumRes->ttfSize == FONT_DEFAULT_SIZE)616 if (enumRes->ttfSize == TEXT_DEFAULT_SIZE) 616 617 match = true; 617 618 } -
trunk/src/util/track/track_manager.cc
r5336 r5344 24 24 #include "stdincl.h" 25 25 #include "list.h" 26 #include "text _engine.h"26 #include "text.h" 27 27 #include "t_animation.h" 28 28 … … 380 380 this->setBindSlave(this->trackNode); 381 381 // initializing the Text 382 this->trackText = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_RENDER_DYNAMIC);382 this->trackText = new Text("fonts/earth.ttf", 30, TEXT_RENDER_DYNAMIC); 383 383 this->trackText->setAlignment(E2D_ALIGN_SCREEN_CENTER); 384 384 // initializing the Animation for the Text.
Note: See TracChangeset
for help on using the changeset viewer.