Hi.
I have been using SDL for RGB stuff for a while. Now I am trying to port
an old vga game that uses palette indexed graphics, and I am having lots
of trouble even creating a singe SDL_Surface from my palette and some
unsigned char’s. I believe I create the palette right, but so far all my
pictures come out black, when I try to do something like this:
void PutPix (int x, int y, int width, int height, const byte *sprt) {
//gl_putboxmask(x, y, width, height, sprt);
SDL_Rect dest;
printf(“PutPix\n”);
tmp = SDL_CreateRGBSurfaceFrom((void *) sprt, width, height, 8,
CurrentScreen->format->BitsPerPixel,
CurrentScreen->format->Rmask,
CurrentScreen->format->Gmask,
CurrentScreen->format->Bmask,
0);
SDL_SetPalette(tmp, SDL_LOGPAL, Colors, 0, 256);
SDL_SetPalette(tmp, SDL_PHYSPAL, Colors, 0, 256);
But, it does not work.
Is there some more info on working with palettes in SDL somewhere?
Mads–
Mads Bondo Dydensborg. @Mads_Bondo_Dydensbor
Each generation has the right to determine its own culture. Culture isn’t
just symphony orchestras, movies about dead British royalty and hard-bound
books. For some, culture is now also gaming, websites, chat and messaging
systems, TV shows, music and movies.
- Jon Katz, Slashdot, on youth culture.