The SGADE Documentation

the SGADE 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.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoPalette.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00013 // ----------------------------------------------------------------------------
00014 
00015 #ifndef SO_PALETTE_H
00016 #define SO_PALETTE_H
00017 
00018 #ifdef __cplusplus
00019     extern "C" {
00020 #endif
00021 
00022 
00023 // ---------------------------------------------------------------------------- //! @{
00044 // ----------------------------------------------------------------------------
00045 
00046 // ----------------------------------------------------------------------------
00047 // Includes
00048 // ----------------------------------------------------------------------------
00049 
00050 #include "SoSystem.h"
00051 
00052 // --------------------------------------------------------------------------
00053 // Defines
00054 // --------------------------------------------------------------------------
00055 
00056 // Start of sprite palette;
00057 #define SO_SPRITE_PALETTE       ((u16*)0x5000200)       
00058 
00059 // Start of screen palette;         
00060 #define SO_SCREEN_PALETTE       ((u16*)0x5000000)       
00061         
00062 // For use with 16-color Sprite palettes
00063 // These defines point to each of the 16 sprite palettes available when using 16-color palettes
00064 // Can be used as follows: SoPaletteSetColor(SO_SPRITE_PALETTE_3, &myPalette, true);
00065 // to set a 16-color palette defined in myPalette to slot 3 (fourth slot)
00066 #define SO_SPRITE_PALETTE_0     ((u16*)0x5000200)       
00067 #define SO_SPRITE_PALETTE_1     ((u16*)0x5000220)       
00068 #define SO_SPRITE_PALETTE_2     ((u16*)0x5000240)       
00069 #define SO_SPRITE_PALETTE_3     ((u16*)0x5000260)       
00070 #define SO_SPRITE_PALETTE_4     ((u16*)0x5000280)       
00071 #define SO_SPRITE_PALETTE_5     ((u16*)0x50002A0)       
00072 #define SO_SPRITE_PALETTE_6     ((u16*)0x50002C0)       
00073 #define SO_SPRITE_PALETTE_7     ((u16*)0x50002E0)       
00074 #define SO_SPRITE_PALETTE_8     ((u16*)0x5000300)       
00075 #define SO_SPRITE_PALETTE_9     ((u16*)0x5000320)       
00076 #define SO_SPRITE_PALETTE_10    ((u16*)0x5000340)       
00077 #define SO_SPRITE_PALETTE_11    ((u16*)0x5000360)       
00078 #define SO_SPRITE_PALETTE_12    ((u16*)0x5000380)       
00079 #define SO_SPRITE_PALETTE_13    ((u16*)0x50003A0)       
00080 #define SO_SPRITE_PALETTE_14    ((u16*)0x50003C0)       
00081 #define SO_SPRITE_PALETTE_15    ((u16*)0x50003E0)       
00082 #define SO_SPRITE_PALETTE_GET(_n_) SO_SPRITE_PALETTE_##_n_  
00083 
00084 // For use with 16-color Background palettes
00085 // These defines point to each of the 16 background palettes available when using 16-color palettes
00086 // Can be used as follows: SoPaletteSetColor(SO_BKG_PALETTE_3, &myBkgPalette, true);
00087 // to set a 16-color palette defined in myBkgPalette to slot 3 (fourth slot)
00088 #define SO_BKG_PALETTE          ((u16*)0x5000000)       
00089 #define SO_BKG_PALETTE_0        ((u16*)0x5000000)       
00090 #define SO_BKG_PALETTE_1        ((u16*)0x5000020)       
00091 #define SO_BKG_PALETTE_2        ((u16*)0x5000040)       
00092 #define SO_BKG_PALETTE_3        ((u16*)0x5000060)       
00093 #define SO_BKG_PALETTE_4        ((u16*)0x5000080)       
00094 #define SO_BKG_PALETTE_5        ((u16*)0x50000A0)       
00095 #define SO_BKG_PALETTE_6        ((u16*)0x50000C0)       
00096 #define SO_BKG_PALETTE_7        ((u16*)0x50000E0)       
00097 #define SO_BKG_PALETTE_8        ((u16*)0x5000100)       
00098 #define SO_BKG_PALETTE_9        ((u16*)0x5000120)       
00099 #define SO_BKG_PALETTE_10       ((u16*)0x5000140)       
00100 #define SO_BKG_PALETTE_11       ((u16*)0x5000160)       
00101 #define SO_BKG_PALETTE_12       ((u16*)0x5000180)       
00102 #define SO_BKG_PALETTE_13       ((u16*)0x50001A0)       
00103 #define SO_BKG_PALETTE_14       ((u16*)0x50001C0)       
00104 #define SO_BKG_PALETTE_15       ((u16*)0x50001E0)       
00105 #define SO_BKG_PALETTE_GET(_n_)     SO_BKG_PALETTE_##_n_        
00106         
00107 #define SoColor(r,g,b)  ((r)+(g<<5)+(b<<10))            
00108 
00109 //you can have 0-31 levels of each red,green,blue component.
00110 #define SoColorGetRed(rgb)    (rgb &0x1f)               
00111 #define SoColorGetGreen(rgb)  ((rgb>>5) & 0x1f)         
00112 #define SoColorGetBlue(rgb)   ((rgb>>10) & 0x1f)        
00113 
00114 
00115 // --------------------------------------------------------------------------
00116 // Public methods;
00117 // --------------------------------------------------------------------------
00118 
00119 void SoPaletteSetColor( u16* a_This, u32 a_PalIndex, u32 a_16BitColor );
00120 
00121 void SoPaletteSetBlack(     u16* a_This, bool a_256ColorPalette );
00122 void SoPaletteSetGreyScale( u16* a_This, bool a_256ColorPalette );
00123 void SoPaletteSetRandom(    u16* a_This, bool a_256ColorPalette );
00124 void SoPaletteSetPalette(   u16* a_This, const u16* a_Palette, bool a_256ColorPalette );
00125 
00126 void SoPaletteFadeGreyScale( u16* a_This, u32 a_Fade, bool a_256ColorPalette );
00127 void SoPaletteFadePalette(   u16* a_This, const u16* a_Palette, u32 a_Fade, bool a_256ColorPalette );
00128 
00129 void SoPaletteAddToPalette(         u16* a_This, u32 a_Red, u32 a_Green, u32 a_Blue, bool a_256ColorPalette );
00130 void SoPaletteSubtractFromPalette(  u16* a_This, u32 a_Red, u32 a_Green, u32 a_Blue, bool a_256ColorPalette );
00131 
00132 // ----------------------------------------------------------------------------
00133 // EOF;
00134 // ----------------------------------------------------------------------------
00135 
00137 
00138 #ifdef __cplusplus
00139 } // extern "C"
00140 #endif
00141 
00142 #endif

Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.