SGDK
A free and open development kit for the Sega Mega Drive
Toggle main menu visibility
Loading...
Searching...
No Matches
pal.h
Go to the documentation of this file.
1
11
12
#include "
config.h
"
13
#include "
types.h
"
14
#include "
dma.h
"
15
16
#ifndef _PAL_H_
17
#define _PAL_H_
18
19
#define VDPPALETTE_REDSFT 1
20
#define VDPPALETTE_GREENSFT 5
21
#define VDPPALETTE_BLUESFT 9
22
23
#define VDPPALETTE_REDMASK 0x000E
24
#define VDPPALETTE_GREENMASK 0x00E0
25
#define VDPPALETTE_BLUEMASK 0x0E00
26
#define VDPPALETTE_COLORMASK 0x0EEE
27
35
#define RGB24_TO_VDPCOLOR(color) ((((((color) + 0x100000) < 0xFF0000 ? (color) + 0x100000 : 0xFF0000) >> (20)) & VDPPALETTE_REDMASK) | ((((((color) & 0xff00) + 0x1000) < 0xFF00 ? ((color) & 0xff00) + 0x1000 : 0xFF00) >> ((1 * 4) + 4)) & VDPPALETTE_GREENMASK) | ((((((color) & 0xff) + 0x10) < 0xFF ? ((color) & 0xff) + 0x10 : 0xFF) << 4) & VDPPALETTE_BLUEMASK))
36
48
#define RGB3_3_3_TO_VDPCOLOR(r, g, b) ((((r) & 7) << VDPPALETTE_REDSFT) | (((g) & 7) << VDPPALETTE_GREENSFT) | (((b) & 7) << VDPPALETTE_BLUESFT))
49
61
#define RGB8_8_8_TO_VDPCOLOR(r, g, b) RGB24_TO_VDPCOLOR(((((b) << 0) & 0xFF) | (((g) & 0xFF) << 8) | (((r) & 0xFF) << 16)))
62
72
typedef
struct
73
{
74
u16
length;
75
u16
* data;
76
}
Palette
;
77
78
83
extern
const
u16
*
const
palette_black;
88
extern
const
u16
palette_grey[16];
93
extern
const
u16
palette_red[16];
98
extern
const
u16
palette_green[16];
103
extern
const
u16
palette_blue[16];
104
109
extern
u16
fadeCurrentPal[64];
114
extern
u16
fadeEndPal
[64];
115
124
u16
PAL_getColor(
u16
index);
136
void
PAL_getColors(
u16
index,
u16
* dest,
u16
count);
146
void
PAL_getPalette(
u16
numPal,
u16
* dest);
147
157
void
PAL_setColor(
u16
index,
u16
value);
176
void
PAL_setColors(
u16
index,
const
u16
* pal,
u16
count,
TransferMethod
tm);
193
void
PAL_setPaletteColors(
u16
index,
const
Palette
* pal,
TransferMethod
tm);
210
void
PAL_setPalette(
u16
numPal,
const
u16
* pal,
TransferMethod
tm);
211
216
#define PAL_setColorsDMA(index, pal, count) _Pragma("GCC error \"This method is deprecated, use PAL_setColors(..) instead.\"")
221
#define PAL_setPaletteColorsDMA(index, pal) _Pragma("GCC error \"This method is deprecated, use PAL_setPaletteColors(..) instead.\"")
226
#define PAL_setPaletteDMA(numPal, pal) _Pragma("GCC error \"This method is deprecated, use PAL_setPalette(..) instead.\"")
227
247
bool
PAL_initFade(
u16
fromCol,
u16
toCol,
const
u16
* palSrc,
const
u16
* palDst,
u16
numFrame);
258
bool
PAL_doFadeStep(
void
);
267
bool
PAL_isManualFadeDone(
void
);
268
291
void
PAL_fade(
u16
fromCol,
u16
toCol,
const
u16
* palSrc,
const
u16
* palDst,
u16
numFrame,
bool
async);
310
void
PAL_fadeTo(
u16
fromCol,
u16
toCol,
const
u16
* pal,
u16
numFrame,
bool
async);
327
void
PAL_fadeOut(
u16
fromCol,
u16
toCol,
u16
numFrame,
bool
async);
346
void
PAL_fadeIn(
u16
fromCol,
u16
toCol,
const
u16
* pal,
u16
numFrame,
bool
async);
347
367
void
PAL_fadePalette(
u16
numPal,
const
u16
* palSrc,
const
u16
* palDst,
u16
numFrame,
bool
async);
384
void
PAL_fadeToPalette(
u16
numPal,
const
u16
* pal,
u16
numFrame,
bool
async);
399
void
PAL_fadeOutPalette(
u16
numPal,
u16
numFrame,
bool
async);
416
void
PAL_fadeInPalette(
u16
numPal,
const
u16
* pal,
u16
numFrame,
bool
async);
417
434
void
PAL_fadeAll(
const
u16
* palSrc,
const
u16
* palDst,
u16
numFrame,
bool
async);
450
void
PAL_fadeToAll(
const
u16
* pal,
u16
numFrame,
bool
async);
464
void
PAL_fadeOutAll(
u16
numFrame,
bool
async);
480
void
PAL_fadeInAll(
const
u16
* pal,
u16
numFrame,
bool
async);
481
487
bool
PAL_isDoingFade(
void
);
492
void
PAL_waitFadeCompletion(
void
);
497
void
PAL_interruptFade(
void
);
498
499
500
#endif
// _VDP_PAL_H_
config.h
Basic SGDK library configuration file.
dma.h
DMA support.
TransferMethod
TransferMethod
VRAM transfer method.
Definition
dma.h:52
fadeEndPal
u16 fadeEndPal[64]
End fade palette.
Palette
Palette structure contains color data.
Definition
pal.h:73
types.h
Types definition.
u16
unsigned short u16
Definition
types.h:100
SGDK
inc
pal.h
Generated by
1.18.0