Changeset 3746 in orxonox.OLD for orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.cc
- Timestamp:
- Apr 7, 2005, 3:54:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.cc
r3499 r3746 27 27 #include "orxonox_gui_video.h" 28 28 29 #include "glincl.h" 30 29 31 /** 30 32 \brief Creates the Video-Option-Frame … … 40 42 this->fullscreen->saveability(); 41 43 this->videoBox->fill(this->fullscreen); 42 this->resolution = new Menu("Resolution", "640x480", "800x600", "1024x768", "1280x1024", "1400x1050", "1600x1200", "1920x1200", "lastItem"); 44 this->resolution = new Menu("Resolution"); 45 this->getResolutions(this->resolution); 43 46 this->resolution->saveability(); 44 47 this->videoBox->fill(this->resolution); … … 146 149 } 147 150 151 void OrxonoxGuiVideo::getResolutions(Menu* menu) 152 { 153 SDL_Init(SDL_INIT_VIDEO); 154 SDL_Rect **modes; 155 int i; 156 int x = 0,y =0; // check for difference 157 char tmpChar[100]; 158 159 /* Get available fullscreen/hardware modes */ 160 modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); 161 162 /* Check is there are any modes available */ 163 if(modes == (SDL_Rect **)0){ 164 PRINTF(2)("No video-modes available!\n"); 165 exit(-1); 166 } 167 168 /* Check if our resolution is restricted */ 169 if(modes == (SDL_Rect **)-1){ 170 PRINTF(2)("All resolutions available.\n"); 171 } 172 else{ 173 /* Print valid modes */ 174 PRINT(4)("Available Modes\n"); 175 for(i = 0; modes[i] ;++i) 176 { 177 if (x != modes[i]->w || y != modes[i]->h) 178 { 179 PRINT(4)(" %d x %d\n", modes[i]->w, modes[i]->h); 180 sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h); 181 menu->addItem(tmpChar); 182 x = modes[i]->w; y = modes[i]->h; 183 } 184 } 185 } 186 SDL_Quit(); 187 }
Note: See TracChangeset
for help on using the changeset viewer.