Changeset 3845 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Apr 17, 2005, 1:19:54 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/text_engine.cc
r3844 r3845 138 138 \param alignment the alignment to set 139 139 */ 140 void Text::setAlignment(TEXT_ALIGNMENT align emnt)140 void Text::setAlignment(TEXT_ALIGNMENT alignment) 141 141 { 142 142 this->alignment = alignment; … … 185 185 // setting the Position of this Text. 186 186 Vector pos; 187 if (this->bindNode) 187 if (this->alignment == TEXT_ALIGN_SCREEN_CENTER) 188 { 189 pos.x = GraphicsEngine::getInstance()->getResolutionX()/2 + this->posSize.x; 190 pos.y = GraphicsEngine::getInstance()->getResolutionY()/2 + this->posSize.y; 191 pos.z = 0; 192 } 193 else if (this->bindNode) 188 194 { 189 195 GLdouble x = this->bindNode->getAbsCoor().x; … … 211 217 if (this->alignment == TEXT_ALIGN_RIGHT) 212 218 glTranslatef(-this->posSize.w, 0, 0); 213 else if (this->alignment == TEXT_ALIGN_CENTER )219 else if (this->alignment == TEXT_ALIGN_CENTER || this->alignment == TEXT_ALIGN_SCREEN_CENTER) 214 220 glTranslatef(-this->posSize.w/2, 0, 0); 215 221 -
orxonox/trunk/src/lib/graphics/text_engine.h
r3843 r3845 30 30 31 31 //! An enumerator for the text alignment. 32 enum TEXT_ALIGNMENT {TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER };32 enum TEXT_ALIGNMENT {TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_SCREEN_CENTER}; 33 33 34 34 /* some default values */ … … 104 104 void setText(const char* text); 105 105 void setPosition(int x, int y); 106 void setAlignment(TEXT_ALIGNMENT align emnt);106 void setAlignment(TEXT_ALIGNMENT alignment); 107 107 /** \param blending the blending intensity to set (between 0.0 and 1.0) */ 108 108 inline void setBlending(float blending) {this->blending = blending;} -
orxonox/trunk/src/track_manager.cc
r3842 r3845 23 23 #include "stdincl.h" 24 24 #include "list.h" 25 26 25 #include "text_engine.h" 26 #include "animation.h" 27 27 28 28 #include <stdarg.h> … … 386 386 this->maxTime = 0; 387 387 this->trackElemCount = 1; 388 388 389 this->trackNode = new TrackNode(); 389 390 this->setBindSlave(this->trackNode); 391 // initializing the Text 392 this->trackText = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0); 393 this->trackText->setAlignment(TEXT_ALIGN_SCREEN_CENTER); 394 // initializing the Animation for the Text. 395 this->textAnimation = new tAnim<Text>(this->trackText, &Text::setBlending); 396 this->textAnimation->addKeyFrame(1.0, 1.0, ANIM_LINEAR); 397 this->textAnimation->addKeyFrame(0.0, 1.0); 398 this->textAnimation->setInfinity(ANIM_INF_CONSTANT); 390 399 } 391 400 … … 929 938 this->currentTrackElem = this->currentTrackElem->getChild(this->choosePath(this->currentTrackElem)); 930 939 this->currentTrackElem->history = tmpHistoryElem; 940 if (this->currentTrackElem->getName()) 941 { 942 this->trackText->setText(this->currentTrackElem->getName()); 943 this->textAnimation->play(); 944 } 931 945 } 932 946 if (this->bindSlave) … … 954 968 { 955 969 if (time == 0) 956 this->currentTrackElem = this->firstTrackElem; 970 { 971 this->currentTrackElem = this->firstTrackElem; 972 if (this->currentTrackElem->getName()) 973 { 974 this->trackText->setText(this->currentTrackElem->getName()); 975 this->textAnimation->play(); 976 } 977 } 957 978 this->localTime = time; 958 979 } -
orxonox/trunk/src/track_manager.h
r3841 r3845 15 15 #include "base_object.h" 16 16 17 // Forward Definition 17 18 class PNode; 19 class Text; 20 template<class T> class tAnim; 18 21 template<class T> class tList; 19 22 … … 136 139 float maxTime; //!< The maximal time the track has. 137 140 int trackElemCount; //!< The count of TrackElements that exist. 141 142 // external 138 143 PNode* bindSlave; //!< The node that is slave to the TrackManager. This node will be moved while update the TrackManager, and must NOT move itself. 139 144 PNode* trackNode; //!< The main TrackNode of this Track. 145 Text* trackText; //!< The text to display when switching between Worlds. 146 tAnim<Text>* textAnimation; //!< An Animation for the Text. 140 147 141 148 void initChildren(unsigned int childCount, TrackElement* trackElem = NULL);
Note: See TracChangeset
for help on using the changeset viewer.