comparison test/testalpha.c @ 1465:8dfa9a6d69a5

Updated WinCE support by Dmitry (with some tweaks) Converted the disk audio driver to SDL_RWops for portability
author Sam Lantinga <slouken@libsdl.org>
date Sat, 04 Mar 2006 08:24:35 +0000
parents 23b1ef7d003b
children 4d241ea8a1cd
comparison
equal deleted inserted replaced
1464:af30090c0330 1465:8dfa9a6d69a5
43 } 43 }
44 else 44 else
45 { 45 {
46 for ( i=0; i<screen->h; ++i ) { 46 for ( i=0; i<screen->h; ++i ) {
47 gradient=((i*255)/screen->h); 47 gradient=((i*255)/screen->h);
48 color = SDL_MapRGB(screen->format, gradient, gradient, gradient); 48 color = (Uint16)SDL_MapRGB(screen->format, gradient, gradient, gradient);
49 buffer16=(Uint16*)buffer; 49 buffer16=(Uint16*)buffer;
50 for (k=0; k<screen->w; k++) 50 for (k=0; k<screen->w; k++)
51 { 51 {
52 *(buffer16+k)=color; 52 *(buffer16+k)=color;
53 } 53 }
338 fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); 338 fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
339 return(1); 339 return(1);
340 } 340 }
341 341
342 /* Alpha blending doesn't work well at 8-bit color */ 342 /* Alpha blending doesn't work well at 8-bit color */
343 #ifdef _WIN32_WCE
344 /* Pocket PC */
345 w = 240;
346 h = 320;
347 #else
343 w = 640; 348 w = 640;
344 h = 480; 349 h = 480;
350 #endif
345 info = SDL_GetVideoInfo(); 351 info = SDL_GetVideoInfo();
346 if ( info->vfmt->BitsPerPixel > 8 ) { 352 if ( info->vfmt->BitsPerPixel > 8 ) {
347 video_bpp = info->vfmt->BitsPerPixel; 353 video_bpp = info->vfmt->BitsPerPixel;
348 } else { 354 } else {
349 video_bpp = 16; 355 video_bpp = 16;
384 argv[0]); 390 argv[0]);
385 quit(1); 391 quit(1);
386 } 392 }
387 } 393 }
388 394
389 /* Set 640x480 video mode */ 395 /* Set video mode */
390 #ifndef _WIN32_WCE
391 if ( (screen=SDL_SetVideoMode(w,h,video_bpp,videoflags)) == NULL ) { 396 if ( (screen=SDL_SetVideoMode(w,h,video_bpp,videoflags)) == NULL ) {
392 fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n", 397 fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n",
393 video_bpp, SDL_GetError()); 398 w, h, video_bpp, SDL_GetError());
394 quit(2); 399 quit(2);
395 } 400 }
396 #else
397 /* Pocket PC */
398 if ( (screen=SDL_SetVideoMode(240,320,video_bpp,SDL_FULLSCREEN)) == NULL ) {
399 fprintf(stderr, "Couldn't set 240x320x%d video mode: %s\n",
400 video_bpp, SDL_GetError());
401 quit(2);
402 }
403 #endif
404 FillBackground(screen); 401 FillBackground(screen);
405 402
406 /* Create the light */ 403 /* Create the light */
407 light = CreateLight(screen, 82); 404 light = CreateLight(screen, 82);
408 if ( light == NULL ) { 405 if ( light == NULL ) {