test/testpalette.c
changeset 1516 4d241ea8a1cd
parent 1429 aff0170f9f1b
child 1659 14717b52abc0
equal deleted inserted replaced
1515:1e18097b1d7a 1516:4d241ea8a1cd
   165 	    quit(1);
   165 	    quit(1);
   166 	}
   166 	}
   167     }
   167     }
   168 
   168 
   169     /* Ask explicitly for 8bpp and a hardware palette */
   169     /* Ask explicitly for 8bpp and a hardware palette */
   170     if(!(screen = SDL_SetVideoMode(SCRW, SCRH, 8, vidflags | SDL_HWPALETTE))) {
   170     if((screen = SDL_SetVideoMode(SCRW, SCRH, 8, vidflags | SDL_HWPALETTE)) == NULL) {
   171 	fprintf(stderr, "error setting %dx%d 8bpp indexed mode: %s\n",
   171 	fprintf(stderr, "error setting %dx%d 8bpp indexed mode: %s\n",
   172 		SCRW, SCRH, SDL_GetError());
   172 		SCRW, SCRH, SDL_GetError());
   173 	quit(1);
   173 	quit(1);
   174     }
   174     }
   175 
   175 
   176     if (vidflags & SDL_FULLSCREEN) SDL_ShowCursor (SDL_FALSE);
   176     if (vidflags & SDL_FULLSCREEN) SDL_ShowCursor (SDL_FALSE);
   177 
   177 
   178     if(!(boat[0] = SDL_LoadBMP("sail.bmp")))
   178     if((boat[0] = SDL_LoadBMP("sail.bmp")) == NULL)
   179 	sdlerr("loading sail.bmp");
   179 	sdlerr("loading sail.bmp");
   180     /* We've chosen magenta (#ff00ff) as colour key for the boat */
   180     /* We've chosen magenta (#ff00ff) as colour key for the boat */
   181     SDL_SetColorKey(boat[0], SDL_SRCCOLORKEY | SDL_RLEACCEL,
   181     SDL_SetColorKey(boat[0], SDL_SRCCOLORKEY | SDL_RLEACCEL,
   182 		    SDL_MapRGB(boat[0]->format, 0xff, 0x00, 0xff));
   182 		    SDL_MapRGB(boat[0]->format, 0xff, 0x00, 0xff));
   183     boatcols = boat[0]->format->palette->ncolors;
   183     boatcols = boat[0]->format->palette->ncolors;