Changeset 4139 in orxonox.OLD for orxonox/branches/md2_loader/src/lib/graphics/graphics_engine.cc
- Timestamp:
- May 10, 2005, 10:39:01 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/lib/graphics/graphics_engine.cc
r4126 r4139 17 17 18 18 #include "graphics_engine.h" 19 #include "resource_manager.h" 19 20 20 21 #include "debug.h" … … 34 35 this->maxFPS = 0; 35 36 this->setClassName ("GraphicsEngine"); 37 38 this->fullscreen = false; 39 36 40 this->initVideo(); 37 41 … … 105 109 106 110 // TO DO: Create a cool icon and use it here 107 SDL_WM_SetIcon(SDL_LoadBMP("../data/pictures/orxonox-icon32x32.bmp"), NULL); 108 111 char* loadPic = new char[strlen(ResourceManager::getInstance()->getDataDir())+ 100]; 112 sprintf(loadPic, "%s%s", ResourceManager::getInstance()->getDataDir(), "pictures/orxonox-icon32x32.bmp"); 113 SDL_WM_SetIcon(SDL_LoadBMP(loadPic), NULL); 114 delete loadPic; 109 115 // Enable default GL stuff 110 116 glEnable(GL_DEPTH_TEST); … … 141 147 int GraphicsEngine::setResolution(int width, int height, int bpp) 142 148 { 149 Uint32 fullscreenFlag; 143 150 this->resolutionX = width; 144 151 this->resolutionY = height; 145 152 this->bitsPerPixel = bpp; 153 if (this->fullscreen) 154 fullscreenFlag = SDL_FULLSCREEN; 155 else 156 fullscreenFlag = 0; 146 157 147 158 printf ("ok\n"); 148 if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags )) == NULL)159 if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags | fullscreenFlag)) == NULL) 149 160 { 150 161 PRINTF(1)("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags, SDL_GetError()); … … 152 163 // return -1; 153 164 } 154 165 } 166 167 void GraphicsEngine::setFullscreen(bool fullscreen) 168 { 169 this->fullscreen = fullscreen; 170 this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel); 155 171 } 156 172 … … 258 274 /* Check if our resolution is restricted */ 259 275 if(this->videoModes == (SDL_Rect **)-1){ 260 PRINTF( 1)("All resolutions available.\n");276 PRINTF(2)("All resolutions available.\n"); 261 277 } 262 278 else{ … … 264 280 PRINT(0)("Available Resoulution Modes are\n"); 265 281 for(int i = 0; this->videoModes[i]; ++i) 266 PRINT( 0)(" | %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h);282 PRINT(4)(" | %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h); 267 283 } 268 284 }
Note: See TracChangeset
for help on using the changeset viewer.