just started converting my Xlib game “Rocks’n’Diamonds”
(http://www.artsoft.org/rocksndiamonds/) to SDL and directly
ran into the first problem:
In the current (non-SDL) version, I use my own PCX file loader
which returns two Pixmaps: one with the actual picture that has
the same depth as the X server’s display, and one with depth 1
that contains a clipmask for all pixels in the PCX image which
have an index != 0 (that means that the first color in the palette
is transparent, where all other colors should be actually drawn).
I can then use XSetClipMask, XSetClipOrigin and XCopyArea
to blit the non-transparent pixels to the destination (Pixmap or
SDL offers the function SDL_SetColorKey which seems to do
something similar with the one important exception: It takes a
color value (as 32-bit RGB value) and not the index of the color
in the color palette. If I would use this function, I would not only
set the color with palette index 0 to transparent (which is usually
black in my PCX images), but also those pixels which have the
same color but should be non-transparent.
Is there a solution for this in SDL which does not require
modification of the PCX images?
Or am I forced to use a filter to set color 0 to an unused color
to mark it later as the transparent pixel?
Thanks in advance!
Holger.Schemel at mediaWays.net ++49 +5241 80-1438