comparison src/SDL_compat.c @ 1720:a1ebb17f9c52 SDL-1.3

Cleaned up a bunch of warnings, started adding Win32 event support
author Sam Lantinga <slouken@libsdl.org>
date Fri, 30 Jun 2006 05:42:49 +0000
parents 6ab5e712e642
children 5daa04d862f1
comparison
equal deleted inserted replaced
1719:5b9f50c957ed 1720:a1ebb17f9c52
24 /* This file contains functions for backwards compatibility with SDL 1.2 */ 24 /* This file contains functions for backwards compatibility with SDL 1.2 */
25 25
26 #include "SDL.h" 26 #include "SDL.h"
27 #include "SDL_syswm.h" 27 #include "SDL_syswm.h"
28 28
29 #include "video/SDL_sysvideo.h"
29 #include "video/SDL_pixels_c.h" 30 #include "video/SDL_pixels_c.h"
30 31
31 32
32 static SDL_WindowID SDL_VideoWindow; 33 static SDL_WindowID SDL_VideoWindow;
33 static SDL_TextureID SDL_VideoTexture; 34 static SDL_TextureID SDL_VideoTexture;
92 const SDL_DisplayMode *mode = SDL_GetDisplayMode(i); 93 const SDL_DisplayMode *mode = SDL_GetDisplayMode(i);
93 if (!mode->w || !mode->h || (width == mode->w && height == mode->h)) { 94 if (!mode->w || !mode->h || (width == mode->w && height == mode->h)) {
94 if (!mode->format) { 95 if (!mode->format) {
95 return bpp; 96 return bpp;
96 } 97 }
97 if (SDL_BITSPERPIXEL(mode->format) >= bpp) { 98 if (SDL_BITSPERPIXEL(mode->format) >= (Uint32) bpp) {
98 actual_bpp = SDL_BITSPERPIXEL(mode->format); 99 actual_bpp = SDL_BITSPERPIXEL(mode->format);
99 } 100 }
100 } 101 }
101 } 102 }
102 return actual_bpp; 103 return actual_bpp;
116 return (SDL_Rect **) (-1); 117 return (SDL_Rect **) (-1);
117 } 118 }
118 119
119 /* Memory leak, but this is a compatibility function, who cares? */ 120 /* Memory leak, but this is a compatibility function, who cares? */
120 nmodes = 0; 121 nmodes = 0;
122 modes = NULL;
121 for (i = 0; i < SDL_GetNumDisplayModes(); ++i) { 123 for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
122 const SDL_DisplayMode *mode = SDL_GetDisplayMode(i); 124 const SDL_DisplayMode *mode = SDL_GetDisplayMode(i);
123 if (!mode->w || !mode->h) { 125 if (!mode->w || !mode->h) {
124 return (SDL_Rect **) (-1); 126 return (SDL_Rect **) (-1);
125 } 127 }
241 } 243 }
242 } 244 }
243 if (userdata == SDL_VideoSurface) { 245 if (userdata == SDL_VideoSurface) {
244 return SDL_SetDisplayPalette(palette->colors, 0, palette->ncolors); 246 return SDL_SetDisplayPalette(palette->colors, 0, palette->ncolors);
245 } 247 }
248 return 0;
246 } 249 }
247 250
248 SDL_Surface * 251 SDL_Surface *
249 SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) 252 SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
250 { 253 {
251 int (*filter) (SDL_Event * event); 254 int (*filter) (SDL_Event * event);
252 const SDL_DisplayMode *desktop_mode; 255 const SDL_DisplayMode *desktop_mode;
253 SDL_DisplayMode mode; 256 SDL_DisplayMode mode;
254 int i;
255 Uint32 window_flags; 257 Uint32 window_flags;
256 Uint32 desktop_format; 258 Uint32 desktop_format;
257 Uint32 desired_format; 259 Uint32 desired_format;
258 Uint32 texture_format;
259 Uint32 surface_flags; 260 Uint32 surface_flags;
260 261
261 if (!SDL_GetVideoDevice()) { 262 if (!SDL_GetVideoDevice()) {
262 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { 263 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
263 return NULL; 264 return NULL;
639 640
640 int 641 int
641 SDL_WM_IconifyWindow(void) 642 SDL_WM_IconifyWindow(void)
642 { 643 {
643 SDL_MinimizeWindow(SDL_VideoWindow); 644 SDL_MinimizeWindow(SDL_VideoWindow);
645 return 0;
644 } 646 }
645 647
646 int 648 int
647 SDL_WM_ToggleFullScreen(SDL_Surface * surface) 649 SDL_WM_ToggleFullScreen(SDL_Surface * surface)
648 { 650 {
693 695
694 int 696 int
695 SDL_SetPalette(SDL_Surface * surface, int flags, const SDL_Color * colors, 697 SDL_SetPalette(SDL_Surface * surface, int flags, const SDL_Color * colors,
696 int firstcolor, int ncolors) 698 int firstcolor, int ncolors)
697 { 699 {
698 SDL_SetColors(surface, colors, firstcolor, ncolors); 700 return SDL_SetColors(surface, colors, firstcolor, ncolors);
699 } 701 }
700 702
701 int 703 int
702 SDL_SetColors(SDL_Surface * surface, const SDL_Color * colors, int firstcolor, 704 SDL_SetColors(SDL_Surface * surface, const SDL_Color * colors, int firstcolor,
703 int ncolors) 705 int ncolors)
1331 SDL_TextureBlendMode_None, 1333 SDL_TextureBlendMode_None,
1332 SDL_TextureScaleMode_Fast) < 0) { 1334 SDL_TextureScaleMode_Fast) < 0) {
1333 return -1; 1335 return -1;
1334 } 1336 }
1335 SDL_RenderPresent(); 1337 SDL_RenderPresent();
1338 return 0;
1336 } 1339 }
1337 1340
1338 void 1341 void
1339 SDL_FreeYUVOverlay(SDL_Overlay * overlay) 1342 SDL_FreeYUVOverlay(SDL_Overlay * overlay)
1340 { 1343 {