- Timestamp:
- Jan 5, 2005, 2:32:58 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/world.cc
r3335 r3337 28 28 #include "helper_parent.h" 29 29 30 #include <SDL/SDL_image.h> 31 30 32 using namespace std; 31 33 … … 66 68 67 69 this->nullParent->destroy (); 70 71 //delete this->testCurve; 68 72 69 73 /* … … 138 142 139 143 144 void World::displayLoadScreen () 145 { 146 printf ("World::displayLoadScreen - start\n"); 147 SDL_Surface *screen; 148 SDL_RWops *rwop; 149 int i; 150 151 //SDL_FreeSurface (Orxonox::getInstance()->getScreen ()); 152 153 /* load the image */ 154 rwop = SDL_RWFromFile("load_screen.png", "rb"); 155 this->loadImage = IMG_LoadPNG_RW (rwop); 156 if( !this->loadImage) 157 { 158 /* image failed to load */ 159 printf ("IMG_Load: %s\n", IMG_GetError()); 160 } 161 printf("loaded %s: %dx%d %dbpp\n", "load_screen.png", 162 this->loadImage->w, this->loadImage->h, this->loadImage->format->BitsPerPixel); 163 164 165 // screen = SDL_SetVideoMode(this->loadImage->w, this->loadImage->h, this->loadImage->format->BitsPerPixel, SDL_ANYFORMAT); 166 screen = Orxonox::getInstance()->getScreen (); 167 if( !screen) 168 { 169 printf ("SDL_SetVideoMode: %s\n", SDL_GetError()); 170 SDL_FreeSurface (this->loadImage); 171 SDL_Quit (); 172 return; 173 } 174 175 /* print some info about the obtained screen */ 176 printf("screen is %dx%d %dbpp\n", screen->w, screen->h, screen->format->BitsPerPixel); 177 178 /* do the initial image display */ 179 SDL_BlitSurface (this->loadImage, 0, screen, 0); 180 181 if (SDL_Flip (screen) != 0) 182 printf("World::displayLoadScreen - couldn't filp buffers"); 183 184 //image = IMG_Load ("load_screen.png"); 185 printf ("World::displayLoadScreen - end\n"); 186 } 187 188 189 void World::releaseLoadScreen () 190 { 191 printf ("World::releaseLoadScreen - start\n"); 192 193 //if( SDL_Flip (Orxonox::getInstance()->getScreen ()) != 0) 194 // printf("World::displayLoadScreen - culdn't filp buffers"); 195 196 SDL_Delay (1000); 197 198 SDL_FreeSurface (this->loadImage); 199 SDL_FreeSurface (Orxonox::getInstance()->getScreen ()); 200 201 SDL_Flip (Orxonox::getInstance()->getScreen ()); 202 203 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); 204 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); 205 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); 206 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 207 208 int bpp = 16; 209 int width = 640; 210 int height = 480; 211 Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; 212 213 SDL_Surface* screen = SDL_SetVideoMode (width, height, bpp, flags); 214 215 // OpenGL stuff 216 glClearColor(0.0, 0.0, 0.0, 0.0); 217 glEnable(GL_DEPTH_TEST); 218 219 // LIGHTING 220 GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0}; 221 GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0}; 222 GLfloat lightPosition[] = {10.0, 10, 19.0, 0.0}; 223 224 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight); 225 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight); 226 glEnable(GL_LIGHTING); 227 glEnable(GL_LIGHT0); 228 glEnable(GL_DEPTH_TEST); 229 glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); 230 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight); 231 232 //SDL_Surface* screen = Orxonox::getInstance()->getScreen (); 233 234 //SDL_Flip (screen); 235 236 237 printf ("World::releaseLoadScreen - end\n"); 238 } 140 239 141 240 … … 197 296 198 297 199 Vector* es = new Vector (50, 0, 5);298 Vector* es = new Vector (50, 2, 0); 200 299 Quaternion* qs = new Quaternion (); 201 300 WorldEntity* env = new Environment(); … … 208 307 case DEBUG_WORLD_1: 209 308 { 309 /* 310 this->testCurve = new UPointCurve(); 311 this->testCurve->addNode(Vector( 0, 0, 0)); 312 this->testCurve->addNode(Vector(10, 0, 5)); 313 this->testCurve->addNode(Vector(20, -5,-5)); 314 this->testCurve->addNode(Vector(30, 5, 10)); 315 this->testCurve->addNode(Vector(40, 0,-10)); 316 this->testCurve->addNode(Vector(50, 0,-10)); 317 */ 318 210 319 this->nullParent = NullParent::getInstance (); 211 320 this->nullParent->setName ("NullParent"); … … 438 547 } 439 548 glEnd(); 549 440 550 glEndList(); 441 551 } … … 802 912 this->draw(); 803 913 // draw HUD 914 /* \todo draw HUD */ 804 915 // flip buffers 805 916 SDL_GL_SwapBuffers(); 917 //SDL_Surface* screen = Orxonox::getInstance()->getScreen (); 918 //SDL_Flip (screen); 806 919 } 807 920
Note: See TracChangeset
for help on using the changeset viewer.