just went and read some code…as long as I set the pixel format, I am
fine (I will not support 8 bit or palettized, blah…who has that
nowadays ;> ). so just set it to 15 or 16 or 24 or 32 bit, and
convert my data equivalently, and shove it all into
SDL_surface.pixels, am I correct ?
Pretty close:
Since you save your artwork as RGB 5/6/5 format, allocate your surfaces
like this:
(pseudo-code)
Initialize, Set video mode
For art in artwork
Read art width and height
/* Masks for 5/6/5 RGB format are given here… */
surface = SDL_AllocSurface(0, width, height, 16, 0xF8, 0x7E, 0x1F, 0);
if surface
while height
copy row from art to surface
art_surface = SDL_DisplayFormat(surface);
SDL_FreeSurface(surface);
Use art_surface in blits, etc.
You can also allocate your own surface memory and adjust a zero sized
surface allocated with SDL_AllocSurface(), but I don’t recommend it
unless you’re willing to track down your bugs through the SDL code.
It’s safest to use the API functions.