Originally in SDL, the following code could be used to setup a surface:
SDL_Surface *screen = SDL_SetVideoMode(800, 600, 8, 0);
Now, in SDL2 the following code must be used:
SDL_Window *window = SDL_CreateWindow("Title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, 0); SDL_Surface *surface = SDL_GetWindowSurface(window);
My problem is that SDL_CreateWindow offers no way to set the bbp of the window or surface. It seems to default to 32 bit. I've tried using
surface->format->BitsPerPixel stays at 32.
How can I create a 8 bit surface in SDL 2? I realize I will need a color palette.