PAlib: Palette system for Dual Screen

Main Page | Modules | File List | Globals | Search for

# Palette system for Dual Screen

## Defines

#define | PA_DualLoadPal(palette, source)
| Load a 256 color palette in the Bg or Sprite palette of both screens
#define | PA_DualLoadPal16(palette, n_palette, source)
| Load a 16 color palette in the Bg or Sprite palette of both screens

## Functions

void | PA_DualSetPalNeg (u32 palette)
| Set all the palette's color to negative. To undo this, simply negative again...
void | PA_DualSetPal16Neg (u32 palette, u8 n_palette)
| Set 16 color palette to negative. To undo this, simply negative again...
void | PA_DualLoadSpritePal (u8 palette_number, void *palette)
| Load a 256 color palette in the Sprite palettes
void | PA_DualLoadBgPal (u8 bg_number, void *palette)
| Load a 256 color palette for a given background
void | PA_DualSetBgColor (u16 color)
| Change the background color of both screens

## Detailed Description

Load palettes, change palette colors, set the gamma, etc... on both screens !

## Define Documentation

#define PA_DualLoadPal | ( | palette,
|  | source |  | ) |

Value:

    {\
           DMA_Copy((void*)source, (void*)palette, 256, DMA_16NOW);\
           DMA_Copy((void*)(source+1024), (void*)palette, 256, DMA_16NOW);\
           if(palette == PAL_SPRITE){\
                  PA_DualLoadSpriteExtPal(0, (void*)palette);\
           }\
    }

Load a 256 color palette in the Bg or Sprite palette of both screens

Parameters:

  | palette | Set the Bg palette or Sprite palette : PAL_BG or PAL_SPRITE
  | source | Palette name (ex : master_Palette)

#define PA_DualLoadPal16 | ( | palette,
|  | n_palette,
|  | source |  | ) |

Value:

    {\
    DMA_Copy((void*)source, (void*)(palette + (n_palette << 5)), 16, DMA_16NOW);\
    DMA_Copy((void*)source, (void*)(palette + 1024 + (n_palette << 5)), 16, DMA_16NOW);}

Load a 16 color palette in the Bg or Sprite palette of both screens

Parameters:

  | palette | Set the Bg palette or Obj palette : PAL_BG or PAL_SPRITE
  | n_palette | Number of the 16 color palette to load (0-15)
  | source | Palette name (ex : master_Palette)

## Function Documentation

inline void PA_DualLoadBgPal | ( | u8 | bg_number,
|  | void * | palette
| ) | `[inline]`

Load a 256 color palette for a given background

Parameters:

  | bg_number | Background number (0-3)
  | palette | Palette to load ((void*)palette_name)

inline void PA_DualLoadSpritePal | ( | u8 | palette_number,
|  | void * | palette
| ) | `[inline]`

Load a 256 color palette in the Sprite palettes

Parameters:

  | palette_number | Palette number (0-15)
  | palette | Palette to load ((void*)palette_name)

inline void PA_DualSetBgColor | ( | u16 | color | ) | `[inline]`

Change the background color of both screens

Parameters:

  | color | RGB value, like PA_RGB(31, 31, 31) for white

inline void PA_DualSetPal16Neg | ( | u32 | palette,
|  | u8 | n_palette
| ) | `[inline]`

Set 16 color palette to negative. To undo this, simply negative again...

Parameters:

  | palette | Set the Bg palette or Obj palette : PAL_BG, PAL_SPRITE
  | n_palette | Number of the 16 color palette (0-15)

inline void PA_DualSetPalNeg | ( | u32 | palette | ) | `[inline]`

Set all the palette's color to negative. To undo this, simply negative again...

Parameters:

  | palette | Set the Bg palette or Obj palette : PAL_BG, PAL_SPRITE