The Socrates Gameboy Advance Development Engine
The SGADE is a development library for the Nintendo Gameboy
Advance. It's free for all uses and is distributed without guarantees.
For more information visit
the SGADE page.
Files | |
| file | SoPalette.c |
| file | SoPalette.h |
Defines | |
| #define | SO_SPRITE_PALETTE |
| Sprite palette. | |
| #define | SO_SCREEN_PALETTE |
| Screen palette. | |
| #define | SO_SPRITE_PALETTE_0 |
| Sprite palette 0 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_1 |
| Sprite palette 1 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_2 |
| Sprite palette 2 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_3 |
| Sprite palette 3 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_4 |
| Sprite palette 4 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_5 |
| Sprite palette 5 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_6 |
| Sprite palette 6 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_7 |
| Sprite palette 7 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_8 |
| Sprite palette 8 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_9 |
| Sprite palette 9 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_10 |
| Sprite palette 10 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_11 |
| Sprite palette 11 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_12 |
| Sprite palette 12 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_13 |
| Sprite palette 13 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_14 |
| Sprite palette 14 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_15 |
| Sprite palette 15 (16 color mode). | |
| #define | SO_SPRITE_PALETTE_GET(_n_) |
| Select the sprite palette n (16 color mode). | |
| #define | SO_BKG_PALETTE |
| Background palette (same as screen palette). | |
| #define | SO_BKG_PALETTE_0 |
| Background palette 0 (16 color mode). | |
| #define | SO_BKG_PALETTE_1 |
| Background palette 1 (16 color mode). | |
| #define | SO_BKG_PALETTE_2 |
| Background palette 2 (16 color mode). | |
| #define | SO_BKG_PALETTE_3 |
| Background palette 3 (16 color mode). | |
| #define | SO_BKG_PALETTE_4 |
| Background palette 4 (16 color mode). | |
| #define | SO_BKG_PALETTE_5 |
| Background palette 5 (16 color mode). | |
| #define | SO_BKG_PALETTE_6 |
| Background palette 6 (16 color mode). | |
| #define | SO_BKG_PALETTE_7 |
| Background palette 7 (16 color mode). | |
| #define | SO_BKG_PALETTE_8 |
| Background palette 8 (16 color mode). | |
| #define | SO_BKG_PALETTE_9 |
| Background palette 9 (16 color mode). | |
| #define | SO_BKG_PALETTE_10 |
| Background palette 10 (16 color mode). | |
| #define | SO_BKG_PALETTE_11 |
| Background palette 11 (16 color mode). | |
| #define | SO_BKG_PALETTE_12 |
| Background palette 12 (16 color mode). | |
| #define | SO_BKG_PALETTE_13 |
| Background palette 13 (16 color mode). | |
| #define | SO_BKG_PALETTE_14 |
| Background palette 14 (16 color mode). | |
| #define | SO_BKG_PALETTE_15 |
| Background palette 15 (16 color mode). | |
| #define | SO_BKG_PALETTE_GET(_n_) |
| Select the background palette n (16 color mode). | |
| #define | SoColor(r, g, b) |
| construct 15-bit BGR color value | |
| #define | SoColorGetRed(rgb) |
| Extract 5-bit red component of color value. | |
| #define | SoColorGetGreen(rgb) |
| Extract 5-bit green component of color value. | |
| #define | SoColorGetBlue(rgb) |
| Extract 5-bit blue component of color value. | |
Functions | |
| void | SoPaletteSetColor (u16 *a_This, u32 a_PalIndex, u32 a_16BitColor) |
| Sets an individual color into the given palette. | |
| void | SoPaletteSetBlack (u16 *a_This, bool a_256ColorPalette) |
| Makes the entire palette fully black (every color equals zero). | |
| void | SoPaletteSetGreyScale (u16 *a_This, bool a_256ColorPalette) |
| Greyscales the palette. | |
| void | SoPaletteSetRandom (u16 *a_This, bool a_256ColorPalette) |
| Just throws random colors in the palette;. | |
| void | SoPaletteSetPalette (u16 *a_This, const u16 *a_Palette, bool a_256ColorPalette) |
| Copies an entire palette into another one. | |
| void | SoPaletteFadeGreyScale (u16 *a_This, u32 a_Fade, bool a_256ColorPalette) |
| Makes the pallette a faded greyscale palette;. | |
| void | SoPaletteFadePalette (u16 *a_This, const u16 *a_Palette, u32 a_Fade, bool a_256ColorPalette) |
| Makes the pallette a faded version of another palette. | |
| void | SoPaletteAddToPalette (u16 *a_This, u32 a_Red, u32 a_Green, u32 a_Blue, bool a_256ColorPalette) |
| Saturated addition to each color of the given palette. | |
| void | SoPaletteSubtractFromPalette (u16 *a_This, u32 a_Red, u32 a_Green, u32 a_Blue, bool a_256ColorPalette) |
| Saturated subtraction from each color of the given palette. | |
This module takes care of everything that has to do with palettes.
A palette is just an array of 15 bit BGR color values, each in a 16 bit word. So we're just using u16*'s for palettes.
A palette contains either 16 or 256 colors. This information is not stored inside the palette. Most of the time you know it when using it anyway.
Because a palette is already a pointer in itself, we can directly use the SoPalette object as a this pointer.
You can use the SoPaletteConverter.exe tool in the /tools/ directory to convert Jasc palettes to a Socrates compatible header file. Ready to be included in a socrates project.
|
||||||||||||||||||||||||
|
Saturated addition to each color of the given palette.
|
|
||||||||||||||||
|
Makes the pallette a faded greyscale palette;.
|
|
||||||||||||||||||||
|
Makes the pallette a faded version of another palette.
|
|
||||||||||||
|
Makes the entire palette fully black (every color equals zero).
|
|
||||||||||||||||
|
Sets an individual color into the given palette.
|
|
||||||||||||
|
Greyscales the palette.
|
|
||||||||||||||||
|
Copies an entire palette into another one.
|
|
||||||||||||
|
Just throws random colors in the palette;.
|
|
||||||||||||||||||||||||
|
Saturated subtraction from each color of the given palette.
|