sgdk: pal.h Source File

sgdk

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

pal.h
Go to the documentation of this file.

    00001
    00012 #include "config.h"
    00013 #include "types.h"
    00014 #include "dma.h"
    00015
    00016 #ifndef _PAL_H_
    00017 #define _PAL_H_
    00018
    00019 #define VDPPALETTE_REDSFT           1
    00020 #define VDPPALETTE_GREENSFT         5
    00021 #define VDPPALETTE_BLUESFT          9
    00022
    00023 #define VDPPALETTE_REDMASK          0x000E
    00024 #define VDPPALETTE_GREENMASK        0x00E0
    00025 #define VDPPALETTE_BLUEMASK         0x0E00
    00026 #define VDPPALETTE_COLORMASK        0x0EEE
    00027
    00035 #define RGB24_TO_VDPCOLOR(color)    (((color >> ((2 * 8) + 4)) & VDPPALETTE_REDMASK) | ((color >> ((1 * 4) + 4)) & VDPPALETTE_GREENMASK) | ((color << 4) & VDPPALETTE_BLUEMASK))
    00036
    00037
    00047 typedef struct
    00048 {
    00049     u16 length;
    00050     u16* data;
    00051 } Palette;
    00052
    00053
    00058 extern const u16* const palette_black;
    00063 extern const u16 palette_grey[16];
    00068 extern const u16 palette_red[16];
    00073 extern const u16 palette_green[16];
    00078 extern const u16 palette_blue[16];
    00079
    00084 extern u16 fadeCurrentPal[64];
    00089 extern u16 fadeEndPal[64];
    00090
    00099 u16  PAL_getColor(u16 index);
    00111 void  PAL_getColors(u16 index, u16* dest, u16 count);
    00121 void PAL_getPalette(u16 numPal, u16* dest);
    00122
    00132 void PAL_setColor(u16 index, u16 value);
    00151 void PAL_setColors(u16 index, const u16* pal, u16 count, TransferMethod tm);
    00168 void PAL_setPaletteColors(u16 index, const Palette* pal, TransferMethod tm);
    00185 void PAL_setPalette(u16 numPal, const u16* pal, TransferMethod tm);
    00186
    00191 void PAL_setColorsDMA(u16 index, const u16* pal, u16 count);
    00196 void PAL_setPaletteColorsDMA(u16 index, const Palette* pal);
    00201 void PAL_setPaletteDMA(u16 numPal, const u16* pal);
    00202
    00203
    00204 // these functions should be private as they are called by PAL_fadeXXX functions internally
    00205 // but they can be useful sometime for better control on the fading processus
    00206 bool PAL_initFade(u16 fromCol, u16 toCol, const u16* palSrc, const u16* palDst, u16 numFrame);
    00207 bool PAL_doFadeStep();
    00208
    00209
    00232 void PAL_fade(u16 fromCol, u16 toCol, const u16* palSrc, const u16* palDst, u16 numFrame, bool async);
    00251 void PAL_fadeTo(u16 fromCol, u16 toCol, const u16* pal, u16 numFrame, bool async);
    00268 void PAL_fadeOut(u16 fromCol, u16 toCol, u16 numFrame, bool async);
    00287 void PAL_fadeIn(u16 fromCol, u16 toCol, const u16* pal, u16 numFrame, bool async);
    00288
    00308 void PAL_fadePalette(u16 numPal, const u16* palSrc, const u16* palDst, u16 numFrame, bool async);
    00325 void PAL_fadeToPalette(u16 numPal, const u16* pal, u16 numFrame, bool async);
    00340 void PAL_fadeOutPalette(u16 numPal, u16 numFrame, bool async);
    00357 void PAL_fadeInPalette(u16 numPal, const u16* pal, u16 numFrame, bool async);
    00358
    00375 void PAL_fadeAll(const u16* palSrc, const u16* palDst, u16 numFrame, bool async);
    00391 void PAL_fadeToAll(const u16* pal, u16 numFrame, bool async);
    00405 void PAL_fadeOutAll(u16 numFrame, bool async);
    00421 void PAL_fadeInAll(const u16* pal, u16 numFrame, bool async);
    00422
    00427 bool PAL_isDoingFade();
    00432 void PAL_waitFadeCompletion();
    00437 void PAL_interruptFade();
    00438
    00439
    00440 #endif // _VDP_PAL_H_

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines