Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 3500:4b594623401b
Work in progress on multi-display support:
* Added display parameter to many internal functions so video modes can be set on displays that aren't the public current one.
* The fullscreen mode is associated with fullscreen windows - not displays, so different windows more naturally have a mode associated with them based on their width and height. It's no longer necessary to specify a fullscreen mode, a default one will be picked automatically for fullscreen windows.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 01 Dec 2009 05:57:15 +0000 |
parents | 00cace2d9080 |
children | abefdc334970 |
comparison
equal
deleted
inserted
replaced
3499:4cf8a1423d57 | 3500:4b594623401b |
---|---|
480 | 480 |
481 SDL_Surface * | 481 SDL_Surface * |
482 SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) | 482 SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) |
483 { | 483 { |
484 SDL_DisplayMode desktop_mode; | 484 SDL_DisplayMode desktop_mode; |
485 SDL_DisplayMode mode; | |
486 int window_x = SDL_WINDOWPOS_UNDEFINED; | 485 int window_x = SDL_WINDOWPOS_UNDEFINED; |
487 int window_y = SDL_WINDOWPOS_UNDEFINED; | 486 int window_y = SDL_WINDOWPOS_UNDEFINED; |
488 Uint32 window_flags; | 487 Uint32 window_flags; |
489 Uint32 desktop_format; | 488 Uint32 desktop_format; |
490 Uint32 desired_format; | 489 Uint32 desired_format; |
550 } | 549 } |
551 if (flags & SDL_NOFRAME) { | 550 if (flags & SDL_NOFRAME) { |
552 window_flags |= SDL_WINDOW_BORDERLESS; | 551 window_flags |= SDL_WINDOW_BORDERLESS; |
553 } | 552 } |
554 GetEnvironmentWindowPosition(width, height, &window_x, &window_y); | 553 GetEnvironmentWindowPosition(width, height, &window_x, &window_y); |
555 SDL_SetFullscreenDisplayMode(NULL); | |
556 SDL_VideoWindow = | 554 SDL_VideoWindow = |
557 SDL_CreateWindow(wm_title, window_x, window_y, width, height, | 555 SDL_CreateWindow(wm_title, window_x, window_y, width, height, |
558 window_flags); | 556 window_flags); |
559 if (!SDL_VideoWindow) { | 557 if (!SDL_VideoWindow) { |
560 return NULL; | 558 return NULL; |
609 default: | 607 default: |
610 SDL_SetError("Unsupported bpp in SDL_SetVideoMode()"); | 608 SDL_SetError("Unsupported bpp in SDL_SetVideoMode()"); |
611 return NULL; | 609 return NULL; |
612 } | 610 } |
613 } | 611 } |
614 mode.format = desired_format; | 612 |
615 mode.w = width; | 613 /* Set up the desired display mode */ |
616 mode.h = height; | |
617 mode.refresh_rate = 0; | |
618 | |
619 /* Set the desired display mode */ | |
620 if (flags & SDL_FULLSCREEN) { | 614 if (flags & SDL_FULLSCREEN) { |
621 if (SDL_SetFullscreenDisplayMode(&mode) < 0) { | 615 SDL_DisplayMode mode; |
616 | |
617 SDL_zero(mode); | |
618 mode.format = desired_format; | |
619 if (SDL_SetWindowDisplayMode(SDL_VideoWindow, &mode) < 0) { | |
622 return NULL; | 620 return NULL; |
623 } | 621 } |
624 } | 622 } |
625 | 623 |
626 /* If we're in OpenGL mode, just create a stub surface and we're done! */ | 624 /* If we're in OpenGL mode, just create a stub surface and we're done! */ |