Charge
Member
Hi,
Can someone please tell me how to set the colour palette in 8 bit mode.
Cheers.
				
			Can someone please tell me how to set the colour palette in 8 bit mode.
Cheers.
GP_PALETTEENTRY arda_Pal[256] = {
      0x1, 0xFFFF, 0xDF7F, 0xBEFB.... <fill your palette entries here>}  	GP_HPALETTE  h_pal, old_pal;
  	h_pal = GpPaletteCreate(256, arda_Pal);
  	GpPaletteSelect(h_pal);  	
  	GpPaletteRealize();void Palette(int index, int red, int grn, int blu, int lgt)
{
        // Palette Wrapper Procedure
        //
        // For easier setup of palette.
        // index = color (0...255)
        // red = red value (0...31)
        // grn = green value (0...31)
        // blu = blue value (0...31)
        // lgt = Intensity bit (0 or 1)
        GP_PALETTEENTRY color;
        color = lgt + blu*2 + grn*64 + red*2048;
        GpPaletteEntryChange(index,1,&color,0);
}Palette(1,31,0,0,1); // Sets colour 1 to bright red
Palette(2,31,31,31,1); // Sets colour 2 to bright whiteany idea what the Mirko SDK translation of this would be??don posted on Feb 1 2004 at 01:20 PM said:I wrote a palette wrapper function for my game flipover:
Code:void Palette(int index, int red, int grn, int blu, int lgt) { // Palette Wrapper Procedure // // For easier setup of palette. // index = color (0...255) // red = red value (0...31) // grn = green value (0...31) // blu = blue value (0...31) // lgt = Intensity bit (0 or 1) GP_PALETTEENTRY color; color = lgt + blu*2 + grn*64 + red*2048; GpPaletteEntryChange(index,1,&color,0); }
It's quite easy to use:
Code:Palette(1,31,0,0,1); // Sets colour 1 to bright red Palette(2,31,31,31,1); // Sets colour 2 to bright white
Hope this is useful for you.
void Palette(int index, int red, int grn, int blu, int lgt)
{
         //...
         gp_SetPaletteColor(255, color);
         color = lgt +blu*2 +grn*64 +red&2048;
         // okay, I just realised I have no idea what to do about the
         // 'GpPaletteEntryChange()' thing... and yes, I do know that 
         // (as far as I know) I am nowhere near the right thing here... 
	