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 | SoBkg.c |
| file | SoBkg.h |
Defines | |
| #define | SO_BKG_MAX_NUM_BACKGROUNDS |
| The number of valid backgrounds. | |
| #define | SO_BKG_NONE |
| Invalid background index used in SoBkgMap to disassociate from any backgrounds. | |
| #define | SO_BKG_PRIORITY_0 |
| screen priority 0 (highest) | |
| #define | SO_BKG_PRIORITY_1 |
| screen priority 1 | |
| #define | SO_BKG_PRIORITY_2 |
| screen priority 2 | |
| #define | SO_BKG_PRIORITY_3 |
| screen priority 3 (lowest) | |
| #define | SO_BKG_CHARBASE(n) |
| starting tile offset in VRAM (n*16384) | |
| #define | SO_BKG_MOSAIC_DISABLE |
| mosaic mode disabled | |
| #define | SO_BKG_MOSAIC_ENABLE |
| mosaic mode enabled | |
| #define | SO_BKG_CLRMODE_MASK |
| mode bits for the color mode | |
| #define | SO_BKG_CLRMODE_16 |
| tile color mode (16 color) | |
| #define | SO_BKG_CLRMODE_256 |
| tile color mode (256 color) | |
| #define | SO_BKG_SCRBASE_MASK |
| mode bits for the screen base | |
| #define | SO_BKG_SCRBASE(n) |
| screen offset in VRAM (n*2048) | |
| #define | SO_BKG_SIZE_MASK |
| mode bits for the bkg size | |
| #define | SO_BKG_TEXTSIZE_256x256 |
| text screen size 256x256 pixels (32x32 tiles) | |
| #define | SO_BKG_TEXTSIZE_512x256 |
| text screen size 512x256 pixels (64x32 tiles) | |
| #define | SO_BKG_TEXTSIZE_256x512 |
| text screen size 256x512 pixels (32x64 tiles) | |
| #define | SO_BKG_TEXTSIZE_512x512 |
| text screen size 512x512 pixels (64x64 tiles) | |
| #define | SO_BKG_ROTSIZE_128x128 |
| rot/scale screen size 128x128 pixels (16x16 tiles) | |
| #define | SO_BKG_ROTSIZE_256x256 |
| rot/scale screen size 256x256 pixels (32x32 tiles) | |
| #define | SO_BKG_ROTSIZE_512x512 |
| rot/scale screen size 512x512 pixels (64x64 tiles) | |
| #define | SO_BKG_ROTSIZE |
| rot/scale screen size 1024x1024 pixels (128x128 tiles) | |
| #define | SoBkgPrintAt(a_Index, a_X, a_Y, a_String) |
| Print a string at a given location. | |
Functions | |
| void | SoBkgSetup (u32 a_Index, u32 a_Options) |
| Prepares a background for use. | |
| void | SoBkgEnable (u32 a_Index, bool a_Enable) |
| Turns off the given background. | |
| void | SoBkgSetMosaicEnable (u32 a_Index, bool a_Enable) |
| Enables or disables the mosaic effect for a particular background. | |
| void | SoBkgSetPriority (u32 a_Index, u32 a_Priority) |
| changes the display priority for a particular background | |
| bool | SoBkgIsEnabled (u32 a_Index) |
| Tests to see if a background is enabled. | |
| void | SoBkgSetOffset (u16 a_Index, u16 a_XPos, u16 a_YPos) |
| Sets the display offset of a background. | |
| u16 * | SoBkgGetData (u32 a_Index) |
| brief Gets a pointer to the BKG data in VRAM | |
| void | SoBkgLoadSolidColorTile (u16 a_Index, u32 a_Tilenum, u16 a_ColorIndex) |
| Loads data for a single solid color tile into background VRAM. | |
| void | SoBkgFill (u16 a_Index, u16 a_Data) |
| Fills the contents of a background. | |
| void | SoBkgFillBlock (u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Width, u16 a_Height, u16 a_Data) |
| Fills a rectangular block of a background. | |
| void | SoBkgWrite (u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Len, u16 *a_buffer) |
| Writes a horizontal strip of data to a background. | |
| void | SoBkgWriteV (u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Len, u16 *a_buffer) |
| Writes a vertical strip of data to a background. | |
| void | SoBkgWriteBlock (u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Width, u16 a_Height, u16 a_Pitch, u16 *a_buffer) |
| Writes a block of data to a background. | |
| 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) |
| Writes a block of data to a background while translating the data to use a specific background palette. | |
| void | SoBkgClearIndirect (u16 a_Index) |
| Clears the contents of an indirectly loaded background. | |
| void | SoBkgWriteIndirect (u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Len, u16 *a_buffer) |
| Writes a horizontal strip of data to a background. | |
| void | SoBkgWriteVIndirect (u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Len, u16 *a_buffer) |
| Writes a vertical strip of data to a background. | |
| void | SoBkgWriteBlockIndirect (u16 a_Index, u16 a_XIndex, u16 a_YIndex, u16 a_Width, u16 a_Height, u16 a_Pitch, u16 *a_buffer) |
| Writes data to a background. | |
| void | SoBkgPrint (u16 a_Index, const char *a_String) |
| Draws a string to a background. | |
| void | SoBkgPrintf (u16 a_Index, const char *a_Format,...) |
| Formatted print routine. | |
| void | SoBkgSetTextWindow (u16 a_Index, u16 a_UpperLeftX, u16 a_UpperLeftY, u16 a_LowerRightX, u16 a_LowerRightY) |
| Sets the window in which printing is restricted. | |
| void | SoBkgSetTextWrapping (u16 a_Index, bool a_DoWrapping) |
| enables or disables text wrapping | |
| void | SoBkgSetTextCursor (u16 a_Index, u16 a_X, u16 a_Y) |
| Sets the position that the next print will occur. | |
| const SoVector2 * | SoBkgGetTextCursor (u16 a_Index) |
| Gets the position that the next print will occur. | |
| void | SoBkgSetFont (u16 a_Index, const SoBkgFont *a_Font) |
| Sets the font associated with a background. | |
| const SoBkgFont * | SoBkgGetFont (u16 a_Index) |
| Gets the font associated with a background. | |
Singleton
This file handles everthing that has to do with a specific background instance. This module works together with the SoBkgManager, SoBkgMemManager and SoBkgMap modules.
Change to not do demand load for tiles that are not visible due to windowing.
Add support for mode 1, 2 screens
|
|
Print a string at a given location.
void SoBkgPrintAt(u16 a_Index, u16 a_X, u16 a_Y, const char *a_String); |
|
|
Clears the contents of an indirectly loaded background.
|
|
||||||||||||
|
Turns off the given background.
|
|
||||||||||||
|
Fills the contents of a background.
|
|
||||||||||||||||||||||||||||
|
Fills a rectangular block of a background.
|
|
|
brief Gets a pointer to the BKG data in VRAM
I should point out that modifying the contents of a background that was created using the *Indirect calls is a very big no-no. Doing this will result in tiles being loaded and unloaded at the wrong times since their use counts in SoBkgMemManager will be incorrect. |
|
|
Gets the font associated with a background.
|
|
|
Gets the position that the next print will occur.
|
|
|
Tests to see if a background is enabled.
|
|
||||||||||||||||
|
Loads data for a single solid color tile into background VRAM.
|
|
||||||||||||
|
Draws a string to a background.
|
|
||||||||||||||||
|
Formatted print routine.
|
|
||||||||||||
|
Sets the font associated with a background.
|
|
||||||||||||
|
Enables or disables the mosaic effect for a particular background.
|
|
||||||||||||||||
|
Sets the display offset of a background.
|
|
||||||||||||
|
changes the display priority for a particular background
When the priority of two backgrounds is the same, the background with the lower index number is displayed on top. When the priority of a sprite is the same as the priority of a background, the sprite is displayed on top. |
|
||||||||||||||||
|
Sets the position that the next print will occur.
|
|
||||||||||||||||||||||||
|
Sets the window in which printing is restricted.
|
|
||||||||||||
|
enables or disables text wrapping
|
|
||||||||||||
|
Prepares a background for use.
|
|
||||||||||||||||||||||||
|
Writes a horizontal strip of data to a background.
|
|
||||||||||||||||||||||||||||||||
|
Writes a block of data to a background.
|
|
||||||||||||||||||||||||||||||||||||
|
Writes a block of data to a background while translating the data to use a specific background palette.
|
|
||||||||||||||||||||||||||||||||
|
Writes data to a background.
|
|
||||||||||||||||||||||||
|
Writes a horizontal strip of data to a background.
|
|
||||||||||||||||||||||||
|
Writes a vertical strip of data to a background.
|
|
||||||||||||||||||||||||
|
Writes a vertical strip of data to a background.
|