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.
#include "SoSystem.h"#include "SoBkg.h"#include "SoBkgMap.h"#include "SoBkgFont.h"#include "SoBkgMemManager.h"#include "SoDisplay.h"#include "SoMath.h"#include "SoDebug.h"#include "SoVector.h"#include "SoDMA.h"Defines | |
| #define | SO_REG_BKG_CNT |
| #define | SO_BKG_DATA |
| this is BKG Video Ram where the screens and tiles are stored for display | |
| #define | SO_BKG_PRIORITY_MASK |
| #define | SO_BKG_CHARBASE_MASK |
| #define | SO_REG_BG0HOFS |
| #define | SO_REG_BG1HOFS |
| #define | SO_REG_BG2HOFS |
| #define | SO_REG_BG3HOFS |
| #define | SO_REG_BG0VOFS |
| #define | SO_REG_BG1VOFS |
| #define | SO_REG_BG2VOFS |
| #define | SO_REG_BG3VOFS |
| #define | OPTION_BITS |
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. | |
| bool | SoBkgIsEnabled (u32 a_Index) |
| Tests to see if a background is enabled. | |
| 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 | |
| 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 | 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. | |
| void | SoBkgSetTextWrapping (u16 a_Index, bool a_DoWrapping) |
| enables or disables text wrapping | |
| 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 | 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. | |
Variables | |
| struct { | |
| const SoBkgFont * m_Font | |
| SoVector2 m_TextCursor | |
| bool m_TextWrapping | |
| u16 m_TextWindowLeft | |
| u16 m_TextWindowRight | |
| u16 m_TextWindowTop | |
| u16 m_TextWindowBottom | |
| u16 * m_Screen | |
| u16 m_Width | |
| u16 m_Height | |
| } | s_Bkg [SO_BKG_MAX_NUM_BACKGROUNDS] |
| Holds current state of each background. | |
|
|
For internal use only.
|
|
|
this is BKG Video Ram where the screens and tiles are stored for display
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only.
|
|
|
For internal use only. Array of the four background control registers. Use like SO_REG_BKG_CNT[ 1 ], to access the control register for background number one. |
|
|
active font for this background
For internal use only.
|
|
|
height of the BG's screen memory, in tiles
For internal use only.
|
|
|
points to the BG's screen memory (here for convenience only)
For internal use only.
|
|
|
the location that the next print will occur
For internal use only.
|
|
|
flag: text wrapping is enabled
For internal use only.
|
|
|
width of the BG's screen memory, in tiles
For internal use only.
|
|
|
Holds current state of each background.
For internal use only.
This array is used to hold the current state information of each background. Most of these values could be calculated by reading the GBA control registers, but it's faster and more convenient to keep them here. |