sgdk
pal.h
Go to the documentation of this file.
00001 
00012 #ifndef _PAL_H_
00013 #define _PAL_H_
00014 
00015 
00016 #define VDPPALETTE_REDSFT           1
00017 #define VDPPALETTE_GREENSFT         5
00018 #define VDPPALETTE_BLUESFT          9
00019 
00020 #define VDPPALETTE_REDMASK          0x000E
00021 #define VDPPALETTE_GREENMASK        0x00E0
00022 #define VDPPALETTE_BLUEMASK         0x0E00
00023 #define VDPPALETTE_COLORMASK        0x0EEE
00024 
00032 #define RGB24_TO_VDPCOLOR(color)    (((color >> ((2 * 8) + 4)) & VDPPALETTE_REDMASK) | ((color >> ((1 * 4) + 4)) & VDPPALETTE_GREENMASK) | ((color << 4) & VDPPALETTE_BLUEMASK))
00033 
00034 
00044 typedef struct
00045 {
00046     u16 length;
00047     u16* data;
00048 } Palette;
00049 
00050 
00055 extern const u16* const palette_black;
00060 extern const u16 palette_grey[16];
00065 extern const u16 palette_red[16];
00070 extern const u16 palette_green[16];
00075 extern const u16 palette_blue[16];
00076 
00077 
00086 u16  PAL_getColor(u16 index);
00098 void  PAL_getColors(u16 index, u16* dest, u16 count);
00108 void PAL_getPalette(u16 numPal, u16* dest);
00109 
00119 void PAL_setColor(u16 index, u16 value);
00131 void PAL_setColors(u16 index, const u16* pal, u16 count);
00141 void PAL_setPaletteColors(u16 index, const Palette* pal);
00151 void PAL_setPalette(u16 numPal, const u16* pal);
00152 
00164 void PAL_setColorsDMA(u16 index, const u16* pal, u16 count);
00174 void PAL_setPaletteColorsDMA(u16 index, const Palette* pal);
00184 void PAL_setPaletteDMA(u16 numPal, const u16* pal);
00185 
00186 
00187 // these functions should be private as they are called by PAL_fadeXXX functions internally
00188 // but they can be useful sometime for better control on the fading processus
00189 bool PAL_initFade(u16 fromCol, u16 toCol, const u16* palSrc, const u16* palDst, u16 numFrame);
00190 bool PAL_doFadeStep();
00191 
00192 
00215 void PAL_fade(u16 fromCol, u16 toCol, const u16* palSrc, const u16* palDst, u16 numFrame, bool async);
00234 void PAL_fadeTo(u16 fromCol, u16 toCol, const u16* pal, u16 numFrame, bool async);
00251 void PAL_fadeOut(u16 fromCol, u16 toCol, u16 numFrame, bool async);
00270 void PAL_fadeIn(u16 fromCol, u16 toCol, const u16* pal, u16 numFrame, bool async);
00271 
00291 void PAL_fadePalette(u16 numPal, const u16* palSrc, const u16* palDst, u16 numFrame, bool async);
00308 void PAL_fadeToPalette(u16 numPal, const u16* pal, u16 numFrame, bool async);
00323 void PAL_fadeOutPalette(u16 numPal, u16 numFrame, bool async);
00340 void PAL_fadeInPalette(u16 numPal, const u16* pal, u16 numFrame, bool async);
00341 
00358 void PAL_fadeAll(const u16* palSrc, const u16* palDst, u16 numFrame, bool async);
00374 void PAL_fadeToAll(const u16* pal, u16 numFrame, bool async);
00388 void PAL_fadeOutAll(u16 numFrame, bool async);
00404 void PAL_fadeInAll(const u16* pal, u16 numFrame, bool async);
00405 
00410 bool PAL_isDoingFade();
00415 void PAL_waitFadeCompletion();
00420 void PAL_interruptFade();
00421 
00422 
00423 #endif // _VDP_PAL_H_
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines