comparison src/video/macdsp/SDL_dspvideo.c @ 1545:8d9bb0cf2c2a

Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set. SDL_SetVideoMode() now accepts 0 for width or height and will use the current video mode (or the desktop mode if no mode has been set.)
author Sam Lantinga <slouken@libsdl.org>
date Wed, 15 Mar 2006 17:46:41 +0000
parents 7a610f25c12f
children e49147870aac e6de7e5fd451
comparison
equal deleted inserted replaced
1544:ab1e4c41ab71 1545:8d9bb0cf2c2a
327 "DSp", "MacOS DrawSprocket", 327 "DSp", "MacOS DrawSprocket",
328 DSp_Available, DSp_CreateDevice 328 DSp_Available, DSp_CreateDevice
329 }; 329 };
330 330
331 /* Use DSp/Display Manager to build mode list for given screen */ 331 /* Use DSp/Display Manager to build mode list for given screen */
332 static SDL_Rect** DSp_BuildModeList (const GDHandle gDevice) 332 static SDL_Rect** DSp_BuildModeList (const GDHandle gDevice, int *displayWidth, int *displayHeight)
333 { 333 {
334 DSpContextAttributes attributes; 334 DSpContextAttributes attributes;
335 DSpContextReference context; 335 DSpContextReference context;
336 DisplayIDType displayID; 336 DisplayIDType displayID;
337 SDL_Rect temp_list [16]; 337 SDL_Rect temp_list [16];
353 return NULL; 353 return NULL;
354 } 354 }
355 355
356 if ( DSpContext_GetAttributes (context, &attributes) != noErr ) 356 if ( DSpContext_GetAttributes (context, &attributes) != noErr )
357 return NULL; 357 return NULL;
358
359 *displayWidth = attributes.displayWidth;
360 *displayHeight = attributes.displayHeight;
358 361
359 for ( i = 0; i < SDL_arraysize(temp_list); i++ ) { 362 for ( i = 0; i < SDL_arraysize(temp_list); i++ ) {
360 width = attributes.displayWidth; 363 width = attributes.displayWidth;
361 height = attributes.displayHeight; 364 height = attributes.displayHeight;
362 365
554 break; 557 break;
555 default: 558 default:
556 break; 559 break;
557 } 560 }
558 561
559 if ( DSp_CreatePalette (this) < 0 ) { 562 if ( DSp_CreatePalette (this) < 0 ) {
560 563 SDL_SetError ("Could not create palette");
561 SDL_SetError ("Could not create palette"); 564 return (-1);
562 return (-1); 565 }
563 }
564 566
565 /* Get a list of available fullscreen modes */ 567 /* Get a list of available fullscreen modes */
566 SDL_modelist = DSp_BuildModeList (SDL_Display); 568 SDL_modelist = DSp_BuildModeList (SDL_Display,
569 &this->info.current_w, &this->info.current_h);
567 if (SDL_modelist == NULL) { 570 if (SDL_modelist == NULL) {
568 SDL_SetError ("DrawSprocket could not build a mode list"); 571 SDL_SetError ("DrawSprocket could not build a mode list");
569 return (-1); 572 return (-1);
570 } 573 }
571 574