Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5123 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Aug 25, 2005, 2:13:22 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: patches, to make TextEngine more intuitive

Location:
trunk/src/lib/graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/text_engine.cc

    r5122 r5123  
    143143          tmpText++;
    144144        }
    145       this->posSize.w = width;
     145      this->width = width;
    146146    }
    147147}
     
    168168    this->texture = loadTexture(tmpSurf, &this->texCoord);
    169169
    170   this->posSize.w = tmpSurf->w;
    171   this->posSize.h = tmpSurf->h;
     170  this->width = tmpSurf->w;
     171  this->height = tmpSurf->h;
    172172  SDL_FreeSurface(tmpSurf);
    173173}
     
    181181  // transform for alignment.
    182182  if (this->getAlignment() == TEXT_ALIGN_RIGHT)
    183     glTranslatef(-this->posSize.w, 0, 0);
     183    glTranslatef(-this->width, 0, 0);
    184184  else if (this->getAlignment() == TEXT_ALIGN_CENTER || this->getAlignment() == TEXT_ALIGN_SCREEN_CENTER)
    185     glTranslatef(-this->posSize.w/2, 0, 0);
     185    glTranslatef(-this->width/2, 0, 0);
    186186
    187187  // drawing this Text.
     
    223223
    224224      glTexCoord2f(this->texCoord.maxU, this->texCoord.minV);
    225       glVertex2f(this->getAbsCoor2D().x + this->posSize.w, this->getAbsCoor2D().y  );
     225      glVertex2f(this->getAbsCoor2D().x + this->width, this->getAbsCoor2D().y  );
    226226
    227227      glTexCoord2f(this->texCoord.maxU, this->texCoord.maxV);
    228       glVertex2f(this->getAbsCoor2D().x + this->posSize.w, getAbsCoor2D().y + this->posSize.h);
     228      glVertex2f(this->getAbsCoor2D().x + this->width, getAbsCoor2D().y + this->height);
    229229
    230230      glTexCoord2f(this->texCoord.minU, this->texCoord.maxV);
    231       glVertex2f(getAbsCoor2D().x, getAbsCoor2D().y + this->posSize.h);
     231      glVertex2f(getAbsCoor2D().x, getAbsCoor2D().y + this->height);
    232232
    233233      glEnd();
     
    249249  if (this->getBindNode())
    250250    PRINT(0)("is bind to %s; ref=%p\n", this->getBindNode()->getName(), this->getBindNode());
    251   PRINT(0)("Relative Position: (%d::%d)\n", this->posSize.x, this->posSize.y);
    252251  PRINT(0)("Color: %0.2f %0.2f %0.2f\n", this->color.x, this->color.y, this->color.z);
    253252}
  • trunk/src/lib/graphics/text_engine.h

    r5122 r5123  
    139139  GLuint            texture;        //!< A GL-texture to hold the text
    140140  TexCoord          texCoord;       //!< Texture-coordinates @todo fix this to have a struct
    141   SDL_Rect          posSize;        //!< An SDL-Rectangle representing the position and size of the Text on the screen.
     141  float             height;
     142  float             width;
    142143};
    143144
Note: See TracChangeset for help on using the changeset viewer.