[SDL] Using the same palette in multiple surfaces

Gerry JJ trick at icculus.org
Tue Dec 16 17:13:56 PST 2008


Den Mon, 15 Dec 2008 17:58:41 -0500
skrev "Donny Viszneki" <donny.viszneki at gmail.com>:
> On Mon, Dec 15, 2008 at 3:10 PM, Christian Meyer <tvgenial at web.de>
> wrote:
> > Anyone an idea how to solve this?
> 
> Yes, read what Pierre had to say!

Another option, if you can't/won't have an 8-bit screen for some
reason, is to just make a big surface with the same palette as the
tiles, and blit all the little tiles to that, remembering the offset
of each tile. (You could do this at startup, or when packaging, etc.)
Then you use the big surface as the source for all the tiles when
blitting, with different offsets for different tiles.  Since it's just
one surface there's just one palette to change.

- Gerry



More information about the SDL mailing list