include/nds/arm9/PA_BgTiles.h File Reference

Everything concerning the Bg Tile modes. More...

#include <nds.h>
#include "../PA_Shared.h"
#include "PA_General.h"

Data Structures

struct  PA_BgDefaultInfos
struct  PA_BgInfos
struct  scrollpositions

Defines

#define BG_TILEDBG   2
#define BG_ROTBG   3
#define BG_LARGEMAP   4
#define BG_INFINITEMAP   5
#define CharBaseBlock(screen, n)   (((n)*0x4000) + 0x6000000 + (0x200000 * screen))
#define ScreenBaseBlock(screen, n)   (((n)*0x800) + 0x6000000 + (0x200000 * screen))
#define BG_COLOR16   0x00
#define BG_COLOR256   0x80
#define CHAR_SHIFT   2
#define SCREEN_SHIFT   8
#define WRAPAROUND   0x1
#define SCREEN_TILES   24576
#define REG_BGSCREEN0   0x04000000
#define REG_BGSCREEN1   0x04001000
#define REG_BGSCREEN(screen)   (0x04000000 + (screen * 0x1000))
#define REG_BGCNT(screen, bg_number)   (0x4000008 + (screen * 0x1000) + (bg_number << 1))
#define REG_BGSCROLLX   0x4000010
#define REG_BGSCROLLY   0x4000012
#define BG_256X256   0
#define BG_512X256   1
#define BG_256X512   2
#define BG_512X512   3
#define TILE_N   1023
#define TILE_PAL   61440
#define TILE_HFLIP   1024
#define TILE_VFLIP   2048
#define PA_HideBg(screen, bg_select)   _REG16(REG_BGSCREEN(screen)) &= ~(0x100 << (bg_select))
 Hide a screen's background.
#define PA_ShowBg(screen, bg_select)   _REG16(REG_BGSCREEN(screen)) |= (0x100 << (bg_select))
 Show a hidden background.
#define PA_ResetBg(screen)   _REG16(REG_BGSCREEN(screen)) &= ~(0xF00)
 Reinitialize de Bg system of a screen. It only hides all the backgrounds in reality...
#define PA_LoadBgTiles(screen, bg_select, bg_tiles)   PA_LoadBgTilesEx(screen, bg_select, (void*)bg_tiles, SIZEOF_16BIT(bg_tiles))
 Load a tileset into memory.
#define PA_LoadTiledBg(screen, bg_number, bg_name)
 This will never get easier... Loads a background TiledBg converted with PAGfx, with it's tiles, map, and palette. Only 256 color mode available.
#define PA_LoadSimpleBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode)
 Simple way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap.
#define PA_LoadBg(screen, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode)
 Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap.
#define PA_SetMapTileAll(screen, bg_select, x, y, tile_info)   *(u16*)(PA_BgInfo[screen][bg_select].Map + ((x) << 1) + ((y) << 6)) = (tile_info)
 Change the tile info used by a given tile in the map.
#define PA_EasyBgLoad(screen, bg_number, bg_name)
#define PA_EasyBgLoadPtr(screen, bg_number, bg_name)   PA_EasyBgLoadEx(screen, bg_number, (u32*)bg_name->Info, bg_name->Tiles, bg_name->TileSize, bg_name->Map, bg_name->MapSize, bg_name->Palette)
 Easiest way to load a background converted with PAGfx... Can take pointers !

Typedefs

typedef u8(* EasyBgPixels )(u8, u8, s32, s32)

Functions

void PA_EasyBgLoadEx (u8 screen, u8 bg_number, u32 *Infos, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette)
u8 PA_GetPAGfxBgSize (u16 width, u16 height)
u8 PA_GetPAGfxRotBgSize (u16 width)
void PA_ResetBgSys (void)
 Reset the background system.
void PA_ResetBgSysScreen (u8 screen)
 Reset the background system on 1 screen.
void PA_InitBg (u8 screen, u8 bg_select, u8 bg_size, u8 wraparound, u8 color_mode)
 Initialise a given background. Do this only after having loaded a tileset and a map.
void PA_LoadBgTilesEx (u8 screen, u8 bg_select, void *bg_tiles, u32 size)
 Load a tileset into memory with a given size.
void PA_ReLoadBgTiles (u8 screen, u8 bg_select, void *bg_tiles)
 ReLoad a tileset into memory.
void PA_DeleteTiles (u8 screen, u8 bg_select)
 Delete a tilest in memory. Note that loading a tileset automatically deletes the preceding one, so you won't need to use this function often.
void PA_DeleteMap (u8 screen, u8 bg_select)
 Delete a map in memory. Note that loading a map automatically deletes the preceding one, so you won't need to use this function often.
void PA_DeleteBg (u8 screen, u8 bg_select)
 Delete and reset a complete background.
void PA_LoadBgMap (u8 screen, u8 bg_select, void *bg_map, u8 bg_size)
 Load a background's map info.
void PA_BGScrollX (u8 screen, u8 bg_number, s32 x)
 Scroll horizontaly a Tiled background.
void PA_BGScrollY (u8 screen, u8 bg_number, s32 y)
 Scroll vertically a Tiled background.
void PA_BGScrollXY (u8 screen, u8 bg_number, s32 x, s32 y)
void PA_SetMapTile (u8 screen, u8 bg_select, s16 x, s16 y, s16 tile_number)
 Change the tile gfx used by a given tile in the map.
void PA_SetLargeMapTile (u8 screen, u8 bg_select, s32 x, s32 y, u32 tile_info)
 Change the tile info used by a given tile in the map, only for big background (512 large or wide).
void PA_SetMapTileHflip (u8 screen, u8 bg_select, u8 x, u8 y, u8 hflip)
 Flip a given tile horizontaly.
void PA_SetMapTileVflip (u8 screen, u8 bg_select, u8 x, u8 y, u8 vflip)
void PA_SetMapTilePal (u8 screen, u8 bg_select, u8 x, u8 y, u8 palette_number)
 Change the 16 color palette used by a tile. Works only if the Bg is in 16 colors...
void PA_SetMapTileEx (u8 screen, u8 bg_select, s16 x, s16 y, u16 tile_number, u8 hflip, u8 vflip, u8 palette_number)
void PA_SetBgPrio (u8 screen, u8 bg, u8 prio)
 Change a backgrounds priority.
void PA_CreateBgFromTiles (u8 screen, u8 bg_select, u8 bg_tiles, void *bg_map, u8 bg_size)
void PA_SetBgPrioSeq (u8 screen, u8 priority0, u8 priority1, u8 priority2, u8 priority3)
 Change all the background priorities to a given background order.
void PA_ClearBg (u8 screen, u8 bg_select)
 Erase a given background (just the tilemap).
void PA_EasyBgScrollX (u8 screen, u8 bg_number, s32 x)
 Scroll horizontaly any background.
void PA_EasyBgScrollY (u8 screen, u8 bg_number, s32 y)
 Scroll vertically any background.
void PA_EasyBgScrollXY (u8 screen, u8 bg_number, s32 x, s32 y)
 Scroll horizontaly and vertically any background.
u8 PA_EasyBgGetPixel (u8 screen, u8 bg_number, s32 x, s32 y)
 Returns the color (number in the palette) of the screen pixel...
u16 PA_EasyBgGetPixelCol (u8 screen, u8 bg_number, s32 x, s32 y)
 Returns the color (u16 value) of the screen pixel...
void PA_SetBgWrap (u8 screen, u8 bg, u8 wrap)
 Set on/off the background wrapping (for rotating, 8bit, and 16bit backgrounds).
u8 PAEasyBgGetPixelTiled (u8 screen, u8 bg_number, s32 x, s32 y)
u8 PAEasyBgGetPixelLarge (u8 screen, u8 bg_number, s32 x, s32 y)
u8 PAEasyBgGetPixelInf (u8 screen, u8 bg_number, s32 x, s32 y)
u8 PANoPixel (u8 screen, u8 bg_number, s32 x, s32 y)
void PA_UpdateBgTile (u8 screen, u8 bg_select, u16 tilepos, void *tile)
void PA_StoreEasyBgInfos (u8 screen, u8 bg_number, u32 Type, u32 Width, u32 Height, void *Tiles, u32 TileSize, void *Map, u32 MapSize, void *Palette)

Variables

EasyBgPixels PA_EasyBgPixel [6]
PA_BgInfos PA_BgInfo [2][4]
u8 charblocks [2][70]
u16 * PA_DrawBg [2]
u16 bg_sizes [4]
u8 bg_place [4]
u8 charsetstart [2]
s32 PA_parallaxX [2][4]
s32 PA_parallaxY [2][4]
scrollpositions scrollpos [2][4]


Detailed Description

Everything concerning the Bg Tile modes.

This file contains all the macros and variables regarding Tile modes, loading tiles and Bg, etc...


Define Documentation

#define BG_256X256   0

#define BG_256X512   2

#define BG_512X256   1

#define BG_512X512   3

#define BG_COLOR16   0x00

#define BG_COLOR256   0x80

#define BG_INFINITEMAP   5

#define BG_LARGEMAP   4

#define BG_ROTBG   3

#define BG_TILEDBG   2

#define CHAR_SHIFT   2

#define CharBaseBlock ( screen,
 )     (((n)*0x4000) + 0x6000000 + (0x200000 * screen))

#define REG_BGCNT ( screen,
bg_number   )     (0x4000008 + (screen * 0x1000) + (bg_number << 1))

#define REG_BGSCREEN ( screen   )     (0x04000000 + (screen * 0x1000))

#define REG_BGSCREEN0   0x04000000

#define REG_BGSCREEN1   0x04001000

#define REG_BGSCROLLX   0x4000010

#define REG_BGSCROLLY   0x4000012

#define SCREEN_SHIFT   8

#define SCREEN_TILES   24576

#define ScreenBaseBlock ( screen,
 )     (((n)*0x800) + 0x6000000 + (0x200000 * screen))

#define TILE_HFLIP   1024

#define TILE_N   1023

#define TILE_PAL   61440

#define TILE_VFLIP   2048

#define WRAPAROUND   0x1


Typedef Documentation

typedef u8(* EasyBgPixels)(u8, u8, s32, s32)


Function Documentation

void PA_EasyBgLoadEx ( u8  screen,
u8  bg_number,
u32 *  Infos,
void *  Tiles,
u32  TileSize,
void *  Map,
u32  MapSize,
void *  Palette 
)

u8 PA_GetPAGfxBgSize ( u16  width,
u16  height 
) [inline]

u8 PA_GetPAGfxRotBgSize ( u16  width  )  [inline]

void PA_StoreEasyBgInfos ( u8  screen,
u8  bg_number,
u32  Type,
u32  Width,
u32  Height,
void *  Tiles,
u32  TileSize,
void *  Map,
u32  MapSize,
void *  Palette 
)

void PA_UpdateBgTile ( u8  screen,
u8  bg_select,
u16  tilepos,
void *  tile 
) [inline]

u8 PAEasyBgGetPixelInf ( u8  screen,
u8  bg_number,
s32  x,
s32  y 
)

u8 PAEasyBgGetPixelLarge ( u8  screen,
u8  bg_number,
s32  x,
s32  y 
)

u8 PAEasyBgGetPixelTiled ( u8  screen,
u8  bg_number,
s32  x,
s32  y 
)

u8 PANoPixel ( u8  screen,
u8  bg_number,
s32  x,
s32  y 
)


Variable Documentation

u8 bg_place[4]

u16 bg_sizes[4]

u8 charblocks[2][70]

u8 charsetstart[2]

u16* PA_DrawBg[2]

s32 PA_parallaxX[2][4]

s32 PA_parallaxY[2][4]


Generated on Sat Jun 13 12:55:13 2009 for PAlib - Programmer's Arsenal by  doxygen 1.5.8