[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Forcing sprites to use specific palette entries?



yes, I have, unfortunatley that still doesnt mean I can specify where the colours are placed on even the sprite's palette.  For example, I have a particular sprite with a slightly coloured outline, in the sprite's palette, entries from 0 - 15 are empty, and the outline is entry 16.  I'm not even sure where any of the other colours are, and that position might change with an excess of differently coloured sprites on screen, or worse, even disappear entirely.  What I would like to do is have the palette fill from the bottom, or preferably from a specified index with new palette entries loaded from .gif files, rather than try and find a close approximate colour on the existing palette, is this possible to do without changing the surface implementation in pygame, or even SDL?

On Fri, Aug 13, 2010 at 4:59 AM, Thiago Chaves <shundread@xxxxxxxxx> wrote:
Have you looked at the palette functions on surfaces?

http://www.pygame.org/docs/ref/surface.html#Surface.get_palette

-Thiago

On Thu, Aug 12, 2010 at 8:56 PM, John Anderson
<corporalmustard@xxxxxxxxx> wrote:
> Hi, I was wondering if it was possible to force an 8-bit colour sprite to
> use a very particular set of palette entries, like say, Sprite A uses colour
> indicies 0 - 16, and Sprite B uses 17 - 32.  As it stands, pygame
> automatically assigns the colours in a sprite to the closest colour on the
> main palette, meaning that it is very hard to predict which colours are
> where, and thus makes palette swapping a nightmare, is there any way around
> this?
>