solved it myself
here's the function i use now, in case someone ever needs it. Is the function good written ? i really have no clue, i'm happy most of the time when it works If someone has some comments please tell !
Code:
function SDL_movepallete(Surface : PSDL_Surface; Movedown : boolean) : boolean;
var
Pal : TSDL_ColorArray;
Temp : TSDL_Color;
Tel : integer;
begin
//check if surface has 8 bits per pixel
if surface.format.BitsPerPixel <> 8 then
begin
SDL_movepallete := false;
exit;
end;
// Get the current palette from the surface
CopyMemory(@Pal,Surface.Format.Palette.Colors,256*sizeof(TSDL_Color));
if Movedown then
begin
Temp := Pal[255];
for Tel := 254 downto 0 do Pal[Tel+1] := Pal[Tel];
Pal[0] := Temp;
end
else
begin
Temp := Pal[0];
for Tel := 0 to 254 do Pal[tel] := Pal[tel+1];
Pal[255] := Temp;
end;
//return true if the pallete has been succesfully set & rotated
SDL_movepallete := (SDL_SetPalette(Surface,SDL_LOGPAL or SDL_PHYSPAL,@Pal,0,256) = 1)
end;
Bookmarks