Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 3518:abefdc334970
Added support for SDL 1.2 environment variables:
SDL_VIDEO_FULLSCREEN_DISPLAY, SDL_VIDEO_FULLSCREEN_HEAD
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 03 Dec 2009 08:43:12 +0000 |
parents | 4b594623401b |
children | 15eea7a1fa97 |
comparison
equal
deleted
inserted
replaced
3517:e7eec78e4b92 | 3518:abefdc334970 |
---|---|
62 return namebuf; | 62 return namebuf; |
63 } | 63 } |
64 return NULL; | 64 return NULL; |
65 } | 65 } |
66 | 66 |
67 static void | |
68 SelectVideoDisplay() | |
69 { | |
70 const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY"); | |
71 if ( !variable ) { | |
72 variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD"); | |
73 } | |
74 if ( variable ) { | |
75 SDL_SelectVideoDisplay(SDL_atoi(variable)); | |
76 } | |
77 } | |
78 | |
67 const SDL_VideoInfo * | 79 const SDL_VideoInfo * |
68 SDL_GetVideoInfo(void) | 80 SDL_GetVideoInfo(void) |
69 { | 81 { |
70 static SDL_VideoInfo info; | 82 static SDL_VideoInfo info; |
71 SDL_DisplayMode mode; | 83 SDL_DisplayMode mode; |
84 | |
85 SelectVideoDisplay(); | |
72 | 86 |
73 /* Memory leak, compatibility code, who cares? */ | 87 /* Memory leak, compatibility code, who cares? */ |
74 if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) { | 88 if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) { |
75 int bpp; | 89 int bpp; |
76 Uint32 Rmask, Gmask, Bmask, Amask; | 90 Uint32 Rmask, Gmask, Bmask, Amask; |
90 int i, actual_bpp = 0; | 104 int i, actual_bpp = 0; |
91 | 105 |
92 if (!SDL_GetVideoDevice()) { | 106 if (!SDL_GetVideoDevice()) { |
93 return 0; | 107 return 0; |
94 } | 108 } |
109 | |
110 SelectVideoDisplay(); | |
95 | 111 |
96 if (!(flags & SDL_FULLSCREEN)) { | 112 if (!(flags & SDL_FULLSCREEN)) { |
97 SDL_DisplayMode mode; | 113 SDL_DisplayMode mode; |
98 SDL_GetDesktopDisplayMode(&mode); | 114 SDL_GetDesktopDisplayMode(&mode); |
99 return SDL_BITSPERPIXEL(mode.format); | 115 return SDL_BITSPERPIXEL(mode.format); |
121 SDL_Rect **modes; | 137 SDL_Rect **modes; |
122 | 138 |
123 if (!SDL_GetVideoDevice()) { | 139 if (!SDL_GetVideoDevice()) { |
124 return NULL; | 140 return NULL; |
125 } | 141 } |
142 | |
143 SelectVideoDisplay(); | |
126 | 144 |
127 if (!(flags & SDL_FULLSCREEN)) { | 145 if (!(flags & SDL_FULLSCREEN)) { |
128 return (SDL_Rect **) (-1); | 146 return (SDL_Rect **) (-1); |
129 } | 147 } |
130 | 148 |
493 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { | 511 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { |
494 return NULL; | 512 return NULL; |
495 } | 513 } |
496 } | 514 } |
497 | 515 |
516 SelectVideoDisplay(); | |
517 | |
498 SDL_GetDesktopDisplayMode(&desktop_mode); | 518 SDL_GetDesktopDisplayMode(&desktop_mode); |
499 | 519 |
500 if (width == 0) { | 520 if (width == 0) { |
501 width = desktop_mode.w; | 521 width = desktop_mode.w; |
502 } | 522 } |