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  

SoBkg.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00013 // ----------------------------------------------------------------------------
00014 
00015 #ifndef SO_BKG_H
00016 #define SO_BKG_H
00017 
00018 #ifdef __cplusplus
00019     extern "C" {
00020 #endif
00021 
00022 // ---------------------------------------------------------------------------- //! @{
00041 // ----------------------------------------------------------------------------
00042 
00043 // ----------------------------------------------------------------------------
00044 // Includes
00045 // ----------------------------------------------------------------------------
00046 
00047 #include "SoSystem.h"
00048 #include "SoBkgMap.h"
00049 #include "SoBkgFont.h"
00050 #include "SoVector.h"
00051 
00052 // ----------------------------------------------------------------------------
00053 // Defines
00054 // ----------------------------------------------------------------------------
00055 
00057 #define SO_BKG_MAX_NUM_BACKGROUNDS  4
00058 
00060 #define SO_BKG_NONE 0xffff
00061 
00062 // Background option bits
00063 #define SO_BKG_PRIORITY_0         0x0000        
00064 #define SO_BKG_PRIORITY_1         0x0001        
00065 #define SO_BKG_PRIORITY_2         0x0002        
00066 #define SO_BKG_PRIORITY_3         0x0003        
00067 
00068 #define SO_BKG_CHARBASE(n)        (((n)&0x3)<<2)    
00069 
00070 #define SO_BKG_MOSAIC_DISABLE     0x0000        
00071 #define SO_BKG_MOSAIC_ENABLE      0x0040        
00072 
00073 #define SO_BKG_CLRMODE_MASK       0x0080        
00074 #define SO_BKG_CLRMODE_16         0x0000        
00075 #define SO_BKG_CLRMODE_256        0x0080        
00076 
00077 #define SO_BKG_SCRBASE_MASK       0x1f00        
00078 #define SO_BKG_SCRBASE(n)         (((n)&0x1f)<<8)   
00079 
00080 #define SO_BKG_SIZE_MASK          0xc000        
00081 #define SO_BKG_TEXTSIZE_256x256   0x0000        
00082 #define SO_BKG_TEXTSIZE_512x256   0x4000        
00083 #define SO_BKG_TEXTSIZE_256x512   0x8000        
00084 #define SO_BKG_TEXTSIZE_512x512   0xc000        
00085 
00086 #define SO_BKG_ROTSIZE_128x128    0x0000        
00087 #define SO_BKG_ROTSIZE_256x256    0x4000        
00088 #define SO_BKG_ROTSIZE_512x512    0x8000        
00089 #define SO_BKG_ROTSIZE 1024x1024  0xc000        
00090 
00091 // ----------------------------------------------------------------------------
00092 // Public methods;
00093 // ----------------------------------------------------------------------------
00094 
00095 void SoBkgSetup(u32 a_Index, u32 a_Options);
00096 void SoBkgEnable(u32 a_Index, bool a_Enable);
00097 
00098 void SoBkgSetMosaicEnable( u32 a_Index, bool a_Enable );
00099 void SoBkgSetPriority(u32 a_Index, u32 a_Priority);
00100 
00101 bool SoBkgIsEnabled(u32 a_Index);
00102 //bool SoBkgGetMosaicEnable(u32 a_Index);
00103 //u32  SoBkgGetPriority(u32 a_Index);
00104 
00105 void SoBkgSetOffset(u16 a_Index, u16 a_XPos, u16 a_YPos);
00106 
00107 u16 *SoBkgGetData(u32 a_Index);
00108 
00109 void SoBkgLoadSolidColorTile(u16 a_Index, u32 a_Tilenum, u16 a_ColorIndex);
00110 
00111 
00112 // Direct mode functions
00113 void SoBkgFill(u16 a_Index, u16 a_Data);
00114 void SoBkgFillBlock(u16 a_index, u16 a_XIndex, u16 a_YIndex, u16 a_Width, u16 a_Height, u16 a_Data);
00115 void SoBkgWrite(u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Len, u16 *a_buffer);
00116 void SoBkgWriteV(u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Len, u16 *a_buffer);
00117 void SoBkgWriteBlock(u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Width, u16 a_Height, u16 a_Pitch,
00118                      u16 *a_buffer);
00119 void SoBkgWriteBlock16Color(u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Width, u16 a_Height, u16 a_Pitch, u16 a_PalIndex, u16 *a_buffer);
00120 
00121 // Indirect mode functions (dynamically loaded tiles)
00122 void SoBkgClearIndirect(u16 a_Index);
00123 void SoBkgWriteIndirect(u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Len, u16 *a_buffer);
00124 void SoBkgWriteVIndirect(u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Len, u16 *a_buffer);
00125 void SoBkgWriteBlockIndirect(u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Width, u16 a_Height,
00126                              u16 a_Pitch, u16 *a_buffer);
00127 
00128 // Printing functions
00129 void SoBkgPrint(u16 a_Index, const char *a_String);
00130 void SoBkgPrintf(u16 a_Index, const char *a_Format, ...);
00131 
00145 #define SoBkgPrintAt(a_Index, a_X, a_Y, a_String) \
00146     (SoBkgSetTextCursor(a_Index, a_X, a_Y), SoBkgPrint(a_Index, a_String))
00147 
00148 void SoBkgSetTextWindow(u16 a_Index, u16 a_UpperLeftX, u16 a_UpperLeftY, u16 a_LowerRightX, u16 a_LowerRightY);
00149 void SoBkgSetTextWrapping(u16 a_Index, bool a_DoWrapping);
00150 
00151 void SoBkgSetTextCursor(u16 a_Index, u16 a_X, u16 a_Y);
00152 const SoVector2* SoBkgGetTextCursor(u16 a_Index);
00153 void SoBkgSetFont(u16 a_Index, const SoBkgFont *a_Font);
00154 const SoBkgFont *SoBkgGetFont(u16 a_Index);
00155 
00156 
00157 // ----------------------------------------------------------------------------
00158 // EOF
00159 // ----------------------------------------------------------------------------
00160 
00162 
00163 #ifdef __cplusplus
00164 } // extern "C"
00165 #endif
00166 
00167 #endif // SO_BKG_H

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