- Timestamp:
- Jan 28, 2007, 10:27:14 PM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/scrolling_screen.cc
r10465 r10466 75 75 this->offset = 0.0; 76 76 77 this->xSize = 0.; 78 this->ySize = 0.; 77 79 this->mode = SCSC_VIEW; 78 80 } … … 91 93 LoadParam(root, "setHeight", this, ScrollingScreen, setViewHeight); 92 94 93 LoadParam(root, "setSize", this, ScrollingScreen, setSize); 95 LoadParam(root, "setSizeX", this, ScrollingScreen, setSizeX); 96 LoadParam(root, "setSizeY", this, ScrollingScreen, setSizeY); 94 97 95 98 LoadParam(root, "texture", this, ScrollingScreen, setTexture); … … 186 189 float resize = (1. - (this->viewHeight + this->offset)); 187 190 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 } 189 209 190 210 glBegin(GL_QUADS); 191 192 211 // unten links 193 212 glTexCoord2f(0., this->offset + ratio); 194 glVertex3f(0., - view*0.5, -this->ySize*0.5);213 glVertex3f(0., -x*0.5, -y*0.5); 195 214 196 215 // unten rechts 197 216 glTexCoord2f(1., this->offset + ratio); 198 glVertex3f(0., - view*0.5, this->ySize*0.5);217 glVertex3f(0., -x*0.5, y*0.5); 199 218 200 219 // oben rechts 201 220 glTexCoord2f(1., this->offset); 202 glVertex3f(0., view*0.5, this->ySize*0.5);221 glVertex3f(0., x*0.5, y*0.5); 203 222 204 223 // oben links 205 224 glTexCoord2f(0., this->offset); 206 glVertex3f(0., view*0.5, -this->ySize*0.5);225 glVertex3f(0., x*0.5, -y*0.5); 207 226 208 227 glEnd(); -
trunk/src/world_entities/scrolling_screen.h
r10464 r10466 35 35 void setSpeed(float speed) { this->scrollingSpeed = speed; } 36 36 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; } 38 39 39 40 virtual void tick (float time);
Note: See TracChangeset
for help on using the changeset viewer.