libnds
|
Enumerations |
Functions | |
static void | bgClearControlBits (int id, u16 bits) |
Clears the specified bits from the backgrounds control register. More... | |
static void | bgExtPaletteDisable (void) |
Disable extended palettes. More... | |
static void | bgExtPaletteDisableSub (void) |
Disable extended palettes. More... | |
static void | bgExtPaletteEnable (void) |
Enable extended palettes. More... | |
static void | bgExtPaletteEnableSub (void) |
Enable extended palettes. More... | |
static u16 * | bgGetGfxPtr (int id) |
Gets a pointer to the background graphics. More... | |
static int | bgGetMapBase (int id) |
Gets the current map base for the supplied background. More... | |
static u16 * | bgGetMapPtr (int id) |
Gets a pointer to the background map. More... | |
static int | bgGetPriority (int id) |
Gets the background priority. More... | |
static int | bgGetTileBase (int id) |
Gets the background tile base. More... | |
static void | bgHide (int id) |
Hides the current background via the display control register. More... | |
static int | bgInit (int layer, BgType type, BgSize size, int mapBase, int tileBase) |
Initializes a background on the main display Sets up background control register with specified settings and defaults to 256 color mode for tiled backgrounds. Sets the rotation/scale attributes for rot/ex rot backgrounds to 1:1 scale and 0 angle of rotation. More... | |
static int | bgInitSub (int layer, BgType type, BgSize size, int mapBase, int tileBase) |
Initializes a background on the sub display Sets up background control register with specified settings and defaults to 256 color mode for tiled backgrounds. Sets the rotation/scale attributes for rot/ex rot backgrounds to 1:1 scale and 0 angle of rotation. More... | |
static void | bgMosaicDisable (int id) |
Disables mosaic on the specified background. More... | |
static void | bgMosaicEnable (int id) |
Enables mosaic on the specified background. More... | |
static void | bgRotate (int id, int angle) |
Rotates the background counter clockwise by the specified angle. (this rotation is cumulative) More... | |
static void | bgScroll (int id, int dx, int dy) |
Scrolls the background by the specified relative values. More... | |
static void | bgScrollf (int id, s32 dx, s32 dy) |
Scrolls the background by the specified relative values (fixed point) More... | |
static void | bgSet (int id, int angle, s32 sx, s32 sy, s32 scrollX, s32 scrollY, s32 rotCenterX, s32 rotCenterY) |
Sets the rotation and scale of the background and update background control registers. More... | |
static void | bgSetAffineMatrixScroll (int id, int hdx, int vdx, int hdy, int vdy, int scrollx, int scrolly) |
directly sets the affine matrix and scroll registers of a background. More... | |
static void | bgSetCenter (int id, int x, int y) |
Sets the center of rotation for the supplied background. More... | |
static void | bgSetCenterf (int id, s32 x, s32 y) |
Sets the center of rotation for the supplied background (fixed point) More... | |
static vuint16 * | bgSetControlBits (int id, u16 bits) |
allows direct access to background control for the chosen layer, returns a pointer to the current control bits More... | |
static void | bgSetMapBase (int id, unsigned int base) |
Sets the background map base. More... | |
static void | bgSetMosaic (unsigned int dx, unsigned int dy) |
Sets the horizontal and vertical mosaic values for all backgrounds. More... | |
static void | bgSetMosaicSub (unsigned int dx, unsigned int dy) |
Sets the horizontal and vertical mosaic values for all backgrounds (Sub Display) More... | |
static void | bgSetPriority (int id, unsigned int priority) |
Sets the background priority. More... | |
static void | bgSetRotate (int id, int angle) |
Sets the rotation angle of the specified background and updates the transform matrix. More... | |
static void | bgSetRotateScale (int id, int angle, s32 sx, s32 sy) |
Sets the rotation and scale of the background and update background control registers. More... | |
static void | bgSetScale (int id, s32 sx, s32 sy) |
Sets the scale of the specified background. More... | |
static void | bgSetScroll (int id, int x, int y) |
Sets the scroll hardware to the specified location. More... | |
static void | bgSetScrollf (int id, s32 x, s32 y) |
Sets the scroll hardware to the specified location (fixed point) More... | |
static void | bgSetTileBase (int id, unsigned int base) |
Sets the background map base. More... | |
static void | bgShow (int id) |
Shows the current background via the display control register. More... | |
void | bgUpdate (void) |
Must be called once per frame to update scroll/scale/and rotation of backgrounds. | |
static void | bgWrapOff (int id) |
turns wrap off for a background. has no effect on text backgrounds, which are always wrapped. More... | |
static void | bgWrapOn (int id) |
turns wrap on for a background. has no effect on text backgrounds, which are always wrapped. More... | |
enum BgSize |
Allowed background Sizes The lower 16 bits of these defines can be used directly to set the background control register bits.
enum BgType |
Allowed background types, used in bgInit and bgInitSub.
|
inlinestatic |
Clears the specified bits from the backgrounds control register.
id | background id returned from bgInit or bgInitSub |
bits | sets the specified bits to clear in the backgrounds control register |
|
inlinestatic |
Disable extended palettes.
When extended palettes are enabled all tiled backgrounds which utilize 16 bit map entries will use extended palettes. Everything else will continue to use standard palette memory.
Each tile on the screen may chose one of 16 256-color palettes. Each background has its own set of 16 palettes meaning you can have 4*16*256 colors on screen
Each background uses 8K of palette memory starting at the base of the vram bank you allocate (which bank is up to you within limits, see the vram usage table to determine which banks can be mapped for textures). These 8K blocks are often refered to as "slots" with each background getting its own slot.
By default, Background 0 uses slot 0 ... Background 3 uses slot 3. It is possible to assign Background 0 to slot 2 and Background 1 to slot 3 (only these two are configurable)
For more information: gbatek
|
inlinestatic |
Disable extended palettes.
When extended palettes are enabled all tiled backgrounds which utilize 16 bit map entries will use extended palettes. Everything else will continue to use standard palette memory.
Each tile on the screen may chose one of 16 256-color palettes. Each background has its own set of 16 palettes meaning you can have 4*16*256 colors on screen
Each background uses 8K of palette memory starting at the base of the vram bank you allocate (which bank is up to you within limits, see the vram usage table to determine which banks can be mapped for textures). These 8K blocks are often refered to as "slots" with each background getting its own slot.
By default, Background 0 uses slot 0 ... Background 3 uses slot 3. It is possible to assign Background 0 to slot 2 and Background 1 to slot 3 (only these two are configurable)
For more information: gbatek
|
inlinestatic |
Enable extended palettes.
When extended palettes are enabled all tiled backgrounds which utilize 16 bit map entries will use extended palettes. Everything else will continue to use standard palette memory.
Each tile on the screen may chose one of 16 256-color palettes. Each background has its own set of 16 palettes meaning you can have 4*16*256 colors on screen
Each background uses 8K of palette memory starting at the base of the vram bank you allocate (which bank is up to you within limits, see the vram usage table to determine which banks can be mapped for textures). These 8K blocks are often refered to as "slots" with each background getting its own slot.
By default, Background 0 uses slot 0 ... Background 3 uses slot 3. It is possible to assign Background 0 to slot 2 and Background 1 to slot 3 (only these two are configurable)
For more information: gbatek
|
inlinestatic |
Enable extended palettes.
When extended palettes are enabled all tiled backgrounds which utilize 16 bit map entries will use extended palettes. Everything else will continue to use standard palette memory.
Each tile on the screen may chose one of 16 256-color palettes. Each background has its own set of 16 palettes meaning you can have 4*16*256 colors on screen
Each background uses 8K of palette memory starting at the base of the vram bank you allocate (which bank is up to you within limits, see the vram usage table to determine which banks can be mapped for textures). These 8K blocks are often refered to as "slots" with each background getting its own slot.
By default, Background 0 uses slot 0 ... Background 3 uses slot 3. It is possible to assign Background 0 to slot 2 and Background 1 to slot 3 (only these two are configurable)
For more information: gbatek
|
inlinestatic |
Gets a pointer to the background graphics.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
Gets the current map base for the supplied background.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
Gets a pointer to the background map.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
Gets the background priority.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
Gets the background tile base.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
Hides the current background via the display control register.
id | background id returned from bgInit or bgInitSub |
Initializes a background on the main display Sets up background control register with specified settings and defaults to 256 color mode for tiled backgrounds. Sets the rotation/scale attributes for rot/ex rot backgrounds to 1:1 scale and 0 angle of rotation.
layer | background hardware layer to init. Must be 0 - 3 |
type | the type of background to init |
size | the size of the background |
mapBase | the 2k offset into vram the tile map will be placed –OR– the 16k offset into vram the bitmap data will be placed for bitmap backgrounds |
tileBase | the 16k offset into vram the tile graphics data will be placed |
|
inlinestatic |
Initializes a background on the sub display Sets up background control register with specified settings and defaults to 256 color mode for tiled backgrounds. Sets the rotation/scale attributes for rot/ex rot backgrounds to 1:1 scale and 0 angle of rotation.
layer | background hardware layer to init. Must be 0 - 3 |
type | the type of background to init |
size | the size of the background |
mapBase | the 2k offset into vram the tile map will be placed –OR– the 16k offset into vram the bitmap data will be placed for bitmap backgrounds |
tileBase | the 16k offset into vram the tile graphics data will be placed |
|
inlinestatic |
Disables mosaic on the specified background.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
Enables mosaic on the specified background.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
Rotates the background counter clockwise by the specified angle. (this rotation is cumulative)
id | background id returned from bgInit or bgInitSub |
angle | the angle of counter clockwise rotation (-32768 to 32767) |
|
inlinestatic |
Scrolls the background by the specified relative values.
id | background id returned from bgInit or bgInitSub |
dx | horizontal scroll |
dy | vertical scroll |
Scrolls the background by the specified relative values (fixed point)
id | background id returned from bgInit or bgInitSub |
dx | the 8 bits fractional fixed point horizontal scroll |
dy | the 8 bits fractional fixed point vertical scroll |
|
inlinestatic |
Sets the rotation and scale of the background and update background control registers.
id | background id returned from bgInit or bgInitSub |
angle | the angle of counter clockwise rotation (-32768 to 32767) |
sx | the 24.8 bit fractional fixed point inverse horizontal scaling to apply |
sy | the 24.8 bit fractional fixed point inverse vertical scaling to apply |
scrollX | the 24.8 bit fractional fixed point horizontal scroll to apply |
scrollY | the 24.8 bit fractional fixed point vertical scroll to apply |
rotCenterX | the 24.8 bit fractional fixed point center of rotation x component |
rotCenterY | the 24.8 bit fractional fixed point center of rotation y component |
|
inlinestatic |
directly sets the affine matrix and scroll registers of a background.
With this, you have more freedom to set the matrix, but it might be more difficult to use if you're not used to affine transformation matrix. This will ignore (but not erase) any values set using the bg rotating, scaling or center functions.
id | The id returned by bgInit or bgInitSub. |
hdx | The change in x per horizontal pixel. |
vdx | The change in x per vertical pixel. |
hdy | The change in y per horizontal pixel. |
vdy | The change in y per vertical pixel. |
scrollx | The horizontal scroll/offset value of the background. |
scrolly | The vertical scroll/offset value of the background. |
|
inlinestatic |
Sets the center of rotation for the supplied background.
id | background id returned from bgInit or bgInitSub |
x | center x |
y | center y |
Sets the center of rotation for the supplied background (fixed point)
id | background id returned from bgInit or bgInitSub |
x | the 8 bits fractional center x |
y | the 8 bits fractional center y |
allows direct access to background control for the chosen layer, returns a pointer to the current control bits
id | background id returned from bgInit or bgInitSub |
bits | sets the specified bits to set in the backgrounds control register |
|
inlinestatic |
Sets the background map base.
id | background id returned from bgInit or bgInitSub |
base | the 2k offset into vram for the backgrounds tile map or the 16k offset for bitmap graphics |
|
inlinestatic |
Sets the horizontal and vertical mosaic values for all backgrounds.
dx | horizontal mosaic value (between 0 and 15) |
dy | vertical mosaic value (between 0 and 15) |
|
inlinestatic |
Sets the horizontal and vertical mosaic values for all backgrounds (Sub Display)
dx | horizontal mosaic value (between 0 and 15) |
dy | vertical mosaic value (between 0 and 15) |
|
inlinestatic |
Sets the background priority.
id | background id returned from bgInit or bgInitSub |
priority | background priority (0-3), higher level priority will result in background rendering on top of lower level |
|
inlinestatic |
Sets the rotation angle of the specified background and updates the transform matrix.
id | background id returned from bgInit or bgInitSub |
angle | the angle of counter clockwise rotation (0 to 511) |
Sets the rotation and scale of the background and update background control registers.
id | background id returned from bgInit or bgInitSub |
angle | the angle of counter clockwise rotation (-32768 to 32767) |
sx | the 24.8 bit fractional fixed point horizontal scaling to apply |
sy | the 24.8 bit fractional fixed point vertical scaling to apply |
Sets the scale of the specified background.
id | background id returned from bgInit or bgInitSub |
sx | the 24.8 bit fractional fixed point horizontal scaling to apply |
sy | the 24.8 bit fractional fixed point vertical scaling to apply |
|
inlinestatic |
Sets the scroll hardware to the specified location.
id | background id returned from bgInit or bgInitSub |
x | the horizontal scroll |
y | the vertical scroll |
Sets the scroll hardware to the specified location (fixed point)
id | background id returned from bgInit or bgInitSub |
x | the 8 bits fractional fixed point horizontal scroll |
y | the 8 bits fractional fixed point vertical scroll |
|
inlinestatic |
Sets the background map base.
id | background id returned from bgInit or bgInitSub |
base | the 16k offset into vram for the backgrounds tile map ignored for bitmap graphics |
|
inlinestatic |
Shows the current background via the display control register.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
turns wrap off for a background. has no effect on text backgrounds, which are always wrapped.
id | background id returned from bgInit or bgInitSub |
|
inlinestatic |
turns wrap on for a background. has no effect on text backgrounds, which are always wrapped.
id | background id returned from bgInit or bgInitSub |