PAlib: PA_PaletteDual.h Source File

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

# PA_PaletteDual.h

Go to the documentation of this file.

    00001 #ifndef _PA_PaletteDual
    00002 #define _PA_PaletteDual
    00003
    00004
    00005 // Left for backwards compatibility
    00006 #define PA_DualLoadSpriteExtPal(palette_number, palette) PA_DualLoadSpritePal(u8 palette_number, void* palette)
    00007
    00008
    00015 #include "PA_Palette.h"
    00016
    00017 #define PAL_BG PAL_BG0
    00018 #define PAL_SPRITE PAL_SPRITE0
    00019
    00020
    00038 #define PA_DualLoadPal(palette, source)  {\
    00039        DMA_Copy((void*)source, (void*)palette, 256, DMA_16NOW);\
    00040        DMA_Copy((void*)(source+1024), (void*)palette, 256, DMA_16NOW);\
    00041        if(palette == PAL_SPRITE){\
    00042               PA_DualLoadSpriteExtPal(0, (void*)palette);\
    00043        }\
    00044 }
    00045
    00046
    00047
    00048
    00064 #define PA_DualLoadPal16(palette, n_palette, source) {\
    00065 DMA_Copy((void*)source, (void*)(palette + (n_palette << 5)), 16, DMA_16NOW);\
    00066 DMA_Copy((void*)source, (void*)(palette + 1024 + (n_palette << 5)), 16, DMA_16NOW);}
    00067
    00068
    00069
    00070
    00079 extern inline void PA_DualSetPalNeg(u32 palette) {
    00080 u16* pal = (u16*)palette;
    00081 u16 i;
    00082        for (i = 0; i < 256; i++) {
    00083               pal[i+512] = pal[i] = ~pal[i]; // On fout le négatif...
    00084        }
    00085 }
    00086
    00087
    00088
    00089
    00101 extern inline void PA_DualSetPal16Neg(u32 palette, u8 n_palette) {
    00102 u16* pal = (u16*)palette;
    00103 u16 i;
    00104        for (i = (n_palette << 4); i < ((n_palette + 1) << 4); i++) {
    00105               pal[i+512] = pal[i] = ~pal[i]; // On fout le négatif...
    00106        }
    00107 }
    00108
    00109
    00110
    00111
    00123 extern inline void PA_DualLoadSpritePal(u8 palette_number, void* palette){
    00124        PA_LoadSpriteExtPal(0, palette_number, palette);
    00125        PA_LoadSpriteExtPal(1, palette_number, palette);
    00126 }
    00127
    00139 extern inline void PA_DualLoadBgPal(u8 bg_number, void* palette){
    00140        PA_LoadBgPal(0, bg_number, palette);
    00141        PA_LoadBgPal(1, bg_number, palette);
    00142 }
    00143
    00144
    00145
    00146
    00155 extern inline void PA_DualSetBgColor(u16 color){
    00156        BG_PALETTE[512] = BG_PALETTE[0] = color;
    00157 }
    00158
    00159  // end of Palette
    00162
    00163
    00164
    00165 #endif
    00166
    00167