Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10466 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jan 28, 2007, 10:27:14 PM (18 years ago)
Author:
patrick
Message:

better implementation, scalable in both dim

Location:
trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/scrolling_screen.cc

    r10465 r10466  
    7575  this->offset = 0.0;
    7676
     77  this->xSize = 0.;
     78  this->ySize = 0.;
    7779  this->mode = SCSC_VIEW;
    7880}
     
    9193  LoadParam(root, "setHeight", this, ScrollingScreen, setViewHeight);
    9294
    93   LoadParam(root, "setSize", this, ScrollingScreen, setSize);
     95  LoadParam(root, "setSizeX", this, ScrollingScreen, setSizeX);
     96  LoadParam(root, "setSizeY", this, ScrollingScreen, setSizeY);
    9497
    9598  LoadParam(root, "texture", this, ScrollingScreen, setTexture);
     
    186189  float resize = (1. - (this->viewHeight + this->offset));
    187190
    188   float view = this->ySize * this->ratio;
     191  float x,y;
     192  if( this->xSize != 0.)
     193  {
     194    x = this->xSize;
     195    y = x * this->ratio;
     196  }
     197  else
     198  {
     199    y = this->ySize;
     200    x = y * this->ratio;
     201  }
     202
     203  float dx;
     204  // we are above/below
     205  if( 1 - (offset + ratio) < 0)
     206  {
     207
     208  }
    189209
    190210  glBegin(GL_QUADS);
    191 
    192211    // unten links
    193212    glTexCoord2f(0., this->offset + ratio);
    194     glVertex3f(0., -view*0.5, -this->ySize*0.5);
     213    glVertex3f(0., -x*0.5, -y*0.5);
    195214
    196215    // unten rechts
    197216    glTexCoord2f(1., this->offset + ratio);
    198     glVertex3f(0., -view*0.5, this->ySize*0.5);
     217    glVertex3f(0., -x*0.5, y*0.5);
    199218
    200219    // oben rechts
    201220    glTexCoord2f(1., this->offset);
    202     glVertex3f(0., view*0.5, this->ySize*0.5);
     221    glVertex3f(0., x*0.5, y*0.5);
    203222
    204223    // oben links
    205224    glTexCoord2f(0., this->offset);
    206     glVertex3f(0., view*0.5, -this->ySize*0.5);
     225    glVertex3f(0., x*0.5, -y*0.5);
    207226
    208227  glEnd();
  • trunk/src/world_entities/scrolling_screen.h

    r10464 r10466  
    3535  void setSpeed(float speed) { this->scrollingSpeed = speed; }
    3636  void setViewHeight(float height) { this->viewHeight = height; }
    37   void setSize(float xSize, float ySize) { this->xSize = xSize; this->ySize = ySize; }
     37  void setSizeY(float ySize) { this->ySize = ySize; }
     38  void setSizeX(float xSize) { this->xSize = xSize; }
    3839
    3940  virtual void tick (float time);
Note: See TracChangeset for help on using the changeset viewer.