PAlib
|
Data Structures | |
struct | PA_BgStruct |
Background structure. More... | |
Macros | |
#define | _GFX_ALIGN __attribute__((aligned (4))) |
Graphics align define for PAGfx. | |
#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)) |
[DEPRECATED] Load a tileset into memory | |
#define | PA_LoadTiledBg(screen, bg_number, bg_name) |
[DEPRECATED] This will never get easier... Loads a background TiledBg converted with PAGfx, with its tiles, map, and palette. Only 256 color mode available. | |
#define | PA_LoadSimpleBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) |
[DEPRECATED] 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) |
[DEPRECATED] 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) |
[DEPRECATED] Easiest way to load a background converted with PAGfx... | |
#define | PA_EasyBgLoadPtr(screen, bg_number, bg_name) |
[DEPRECATED] Easiest way to load a background converted with PAGfx... Can take pointers ! | |
Enumerations | |
enum | { PA_BgInvalid , PA_BgNormal , PA_BgLarge , PA_BgUnlimited , PA_BgRot , PA_Font1bit , PA_Font4bit , PA_Font8bit } |
Types of background. More... | |
Functions | |
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. | |
static 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_LoadBackground (u8 screen, u8 bg_select, const PA_BgStruct *bg_name) |
Load a background (EasyBg or RotBg). | |
static void | PA_BGScrollX (u8 screen, u8 bg_number, s32 x) |
Scroll horizontaly a Tiled background. | |
static void | PA_BGScrollY (u8 screen, u8 bg_number, s32 y) |
Scroll vertically a Tiled background. | |
static 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. | |
static 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) | |
static void | PA_SetMapTileHflip (u8 screen, u8 bg_select, u8 x, u8 y, u8 hflip) |
Flip a given tile horizontaly. | |
static void | PA_SetMapTileVflip (u8 screen, u8 bg_select, u8 x, u8 y, u8 vflip) |
Flip a given tile verticaly. | |
static 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... | |
static void | PA_SetBgPrio (u8 screen, u8 bg, u8 prio) |
Change a backgrounds priority. | |
static void | PA_SetBgPrioSeq (u8 screen, u8 priority0, u8 priority1, u8 priority2, u8 priority3) |
Change all the background priorities to a given background order. | |
static 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. | |
static void | PA_EasyBgScrollXY (u8 screen, u8 bg_number, s32 x, s32 y) |
Scroll horizontaly and vertically any background. | |
static u8 | PA_EasyBgGetPixel (u8 screen, u8 bg_number, s32 x, s32 y) |
Returns the color (number in the palette) of the screen pixel... | |
static u16 | PA_EasyBgGetPixelCol (u8 screen, u8 bg_number, s32 x, s32 y) |
Returns the color (u16 value) of the screen pixel... | |
static void | PA_SetBgWrap (u8 screen, u8 bg, u8 wrap) |
Set on/off the background wrapping (for rotating, 8bit, and 16bit backgrounds) | |
static void | PA_InitParallaxX (u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) |
Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... | |
static void | PA_InitParallaxY (u8 screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) |
Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... | |
static void | PA_ParallaxScrollX (u8 screen, s32 x) |
Scroll the backgrounds. | |
static void | PA_ParallaxScrollY (u8 screen, s32 y) |
Scroll the backgrounds. | |
static void | PA_ParallaxScrollXY (u8 screen, s32 x, s32 y) |
Scroll the backgrounds. | |
Load a background, scroll it, etc...
#define PA_HideBg | ( | screen, | |
bg_select | |||
) | _REG16(REG_BGSCREEN(screen)) &= ~(0x100 << (bg_select)) |
Hide a screen's background.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
#define PA_ShowBg | ( | screen, | |
bg_select | |||
) | _REG16(REG_BGSCREEN(screen)) |= (0x100 << (bg_select)) |
Show a hidden background.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
#define PA_ResetBg | ( | screen | ) | _REG16(REG_BGSCREEN(screen)) &= ~(0xF00) |
Reinitialize de Bg system of a screen. It only hides all the backgrounds in reality...
screen | Choose the screen (0 or 1) |
#define PA_LoadBgTiles | ( | screen, | |
bg_select, | |||
bg_tiles | |||
) | PA_LoadBgTilesEx(screen, bg_select, (void*)bg_tiles, SIZEOF_16BIT(bg_tiles)) |
[DEPRECATED] Load a tileset into memory
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
bg_tiles | Name of the tiles' info (example: ship_Tiles) |
#define PA_LoadTiledBg | ( | screen, | |
bg_number, | |||
bg_name | |||
) |
[DEPRECATED] This will never get easier... Loads a background TiledBg converted with PAGfx, with its tiles, map, and palette. Only 256 color mode available.
screen | Choose the screen (0 or 1) |
bg_number | Background number to load (from 0 to 3) |
bg_name | Background name, like bg0 |
#define PA_LoadSimpleBg | ( | screen, | |
bg_select, | |||
bg_tiles, | |||
bg_map, | |||
bg_size, | |||
wraparound, | |||
color_mode | |||
) |
[DEPRECATED] Simple way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
bg_tiles | Name of the tiles' info (example: ship_Tiles) |
bg_map | Name of the map's info (example : ship_Map) |
bg_size | Background size. To use a normal background, use the macros BG_256X256, BG_256X512, etc... |
wraparound | If the background wraps around or not. More important for rotating backgrounds. |
color_mode | Color mode : 0 for 16 color mode, 1 for 256... |
#define PA_LoadBg | ( | screen, | |
bg_select, | |||
bg_tiles, | |||
tile_size, | |||
bg_map, | |||
bg_size, | |||
wraparound, | |||
color_mode | |||
) |
[DEPRECATED] Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
bg_tiles | Name of the tiles' info (example: ship_Tiles) |
tile_size | Size of your tileset |
bg_map | Name of the map's info (example : ship_Map) |
bg_size | Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... For a rotatable Bg, use the macros BG_ROT_128X128... |
wraparound | If the background wraps around or not. More important for rotating backgrounds. |
color_mode | Color mode : 0 for 16 color mode, 1 for 256... |
#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.
screen | Choose the screen (0 or 1) |
bg_select | Background number (0-3) |
x | X value of the tile to change |
y | Y value of the map tile to change |
tile_info | New tile to put (tile + palette + flips...) |
#define PA_EasyBgLoad | ( | screen, | |
bg_number, | |||
bg_name | |||
) |
[DEPRECATED] Easiest way to load a background converted with PAGfx...
screen | Choose de screen (0 or 1) |
bg_number | Background number... (0-3) |
bg_name | Background name |
#define PA_EasyBgLoadPtr | ( | screen, | |
bg_number, | |||
bg_name | |||
) |
[DEPRECATED] Easiest way to load a background converted with PAGfx... Can take pointers !
screen | Choose de screen (0 or 1) |
bg_number | Background number... (0-3) |
bg_name | Background, like &bg0 |
anonymous enum |
Types of background.
void PA_ResetBgSysScreen | ( | u8 | screen | ) |
Reset the background system on 1 screen.
screen | Choose the screen (0 or 1) |
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.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
bg_size | Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... For a rotatable Bg, use the macros BG_ROT_128X128... |
wraparound | If the background wraps around or not. More important for rotating backgrounds. |
color_mode | Color mode : 0 for 16 color mode, 1 for 256... |
void PA_LoadBgTilesEx | ( | u8 | screen, |
u8 | bg_select, | ||
void * | bg_tiles, | ||
u32 | size | ||
) |
Load a tileset into memory with a given size.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
bg_tiles | Name of the tiles' info (example: ship_Tiles) |
size | 16 bit size... |
void PA_ReLoadBgTiles | ( | u8 | screen, |
u8 | bg_select, | ||
void * | bg_tiles | ||
) |
ReLoad a tileset into memory.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
bg_tiles | Name of the tiles' info (example: ship_Tiles) |
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.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
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.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
|
inlinestatic |
Delete and reset a complete background.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
void PA_LoadBgMap | ( | u8 | screen, |
u8 | bg_select, | ||
void * | bg_map, | ||
u8 | bg_size | ||
) |
Load a background's map info.
screen | Choose the screen (0 or 1) |
bg_select | Background number to load (from 0 to 3) |
bg_map | Name of the map's info (example : (void*)ship_Map) Don't forget the void... |
bg_size | Background size. This is important, because it also determines whether the Bg is rotatable or not. To use a normal background, use the macros BG_256X256, BG_256X512, etc... |
void PA_LoadBackground | ( | u8 | screen, |
u8 | bg_number, | ||
const PA_BgStruct * | bg_name | ||
) |
Load a background (EasyBg or RotBg).
screen | Choose the screen (0 or 1) |
bg_number | Background number... (0-3) |
bg_name | Pointer to the background (struct) |
|
inlinestatic |
Scroll horizontaly a Tiled background.
screen | Choose the screen (0 or 1) |
bg_number | Background number (0-3) |
x | X value to scroll |
|
inlinestatic |
Scroll vertically a Tiled background.
screen | Choose the screen (0 or 1) |
bg_number | Background number (0-3) |
y | Y value to scroll |
|
inlinestatic |
Change the tile gfx used by a given tile in the map.
screen | Choose the screen (0 or 1) |
bg_select | Background number (0-3) |
x | X value of the tile to change |
y | Y value of the map tile to change |
tile_number | New tile number to put |
|
inlinestatic |
Change the tile info used by a given tile in the map, only for big background (512 large or wide)
screen | Choose the screen (0 or 1) |
bg_select | Background number (0-3) |
x | X value of the tile to change |
y | Y value of the map tile to change |
tile_info | New tile to put (tile + palette + flips...) |
|
inlinestatic |
Flip a given tile horizontaly.
screen | Choose the screen (0 or 1) |
bg_select | Background number (0-3) |
x | X value of the tile to change |
y | Y value of the map tile to change |
hflip | Set the map tile to horizontal flip |
|
inlinestatic |
Flip a given tile verticaly.
screen | Choose the screen (0 or 1) |
bg_select | Background number (0-3) |
x | X value of the tile to change |
y | Y value of the map tile to change |
vflip | Set the map tile to vertical flip |
|
inlinestatic |
Change the 16 color palette used by a tile. Works only if the Bg is in 16 colors...
screen | Choose the screen (0 or 1) |
bg_select | Background number (0-3) |
x | X value of the tile to change |
y | Y value of the map tile to change |
palette_number | Palette number (0-15) |
|
inlinestatic |
Change a backgrounds priority.
screen | Choose the screen (0 or 1) |
bg | Background... |
prio | Priority level (0-3, 0 being the highest) |
|
inlinestatic |
Change all the background priorities to a given background order.
screen | Choose the screen (0 or 1) |
priority0 | Background to show on top |
priority1 | Next one... |
priority2 | Next one... |
priority3 | Last one... |
|
inlinestatic |
Erase a given background (just the tilemap)
screen | Choose de screen (0 or 1) |
bg_select | Background... |
void PA_EasyBgScrollX | ( | u8 | screen, |
u8 | bg_number, | ||
s32 | x | ||
) |
Scroll horizontaly any background.
screen | Choose the screen (0 or 1) |
bg_number | Background number (0-3) |
x | X value to scroll |
void PA_EasyBgScrollY | ( | u8 | screen, |
u8 | bg_number, | ||
s32 | y | ||
) |
Scroll vertically any background.
screen | Choose the screen (0 or 1) |
bg_number | Background number (0-3) |
y | Y value to scroll |
|
inlinestatic |
Scroll horizontaly and vertically any background.
screen | Choose the screen (0 or 1) |
bg_number | Background number (0-3) |
x | X value to scroll |
y | Y value to scroll |
|
inlinestatic |
Returns the color (number in the palette) of the screen pixel...
screen | Choose the screen (0 or 1) |
bg_number | Background number (0-3) |
x | X screen pixel position |
y | Y screen pixel position |
|
inlinestatic |
Returns the color (u16 value) of the screen pixel...
screen | Choose the screen (0 or 1) |
bg_number | Background number (0-3) |
x | X screen pixel position |
y | Y screen pixel position |
|
inlinestatic |
Set on/off the background wrapping (for rotating, 8bit, and 16bit backgrounds)
screen | Choose the screen (0 or 1) |
bg | Background number (0-3) |
wrap | Wrap around on or off... |
|
inlinestatic |
Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll...
screen | Chose de screen (0 or 1) |
bg0 | Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background |
bg1 | Same thing for Background 1 |
bg2 | Same thing for Background 2 |
bg3 | Same thing for Background 3 |
|
inlinestatic |
Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll...
screen | Chose de screen (0 or 1) |
bg0 | Value for the first background (0). Set to 256 for normal scroll speed, lower for lower speed (128 is half speed...), higher for faster (512 is twice as fast...). You can set negative values. 0 inactivates parallax scrolling for this background |
bg1 | Same thing for Background 1 |
bg2 | Same thing for Background 2 |
bg3 | Same thing for Background 3 |
|
inlinestatic |
Scroll the backgrounds.
screen | Chose de screen (0 or 1) |
x | X value to scroll |
|
inlinestatic |
Scroll the backgrounds.
screen | Chose de screen (0 or 1) |
y | Y value to scroll |
|
inlinestatic |
Scroll the backgrounds.
screen | Chose de screen (0 or 1) |
x | X value to scroll |
y | Y value to scroll |