PAlib
Macros | Functions
Bg Modes on 2 Screens

Macros

#define PA_DualLoadTiledBg(bg_number, bg_name)
 [DEPRECATED] This will never get easier... Loads a background TiledBg converted with PAGfx, with it's tiles, map, and palette. Only 256 color mode available. On 2 screens as 1...
 
#define PA_DualLoadSimpleBg(bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode)
 [DEPRECATED] Simplest way to load a Background on both screens
 
#define PA_DualLoadRotBg(bg_select, bg_tiles, bg_map, bg_size, wraparound)
 [DEPRECATED] Load a background fit for rotating/scaling ! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors
 
#define PA_DualLoadBg(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_DualLoadPAGfxLargeBg(bg_number, bg_name)
 [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), converted with PAGfx. Background on both screens, as one
 
#define PA_DualLoadLargeBg(bg_select, bg_tiles, bg_map, color_mode, lx, ly)
 [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), on both screens
 
#define PA_DualLoadLargeBgEx(bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly)
 [DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), but here you can put yourself the tile size...
 
#define PA_DualEasyBgLoad(bg_number, bg_name)
 [DEPRECATED] EasyBg load, but for Dual screen...
 

Functions

static void PA_DualHideBg (u8 bg_select)
 Hide a background on both screens.
 
static void PA_DualShowBg (u8 bg_select)
 Show a hidden background, on both screens.
 
static void PA_DualResetBg (void)
 Reinitialize de Bg system.
 
static void PA_DualDeleteBg (u8 bg_select)
 Delete a complete background (tiles + map + hide it...)
 
static void PA_DualBGScrollX (u8 bg_number, s16 x)
 Scroll horizontaly any background, on both screens.
 
static void PA_DualBGScrollY (u8 bg_number, s16 y)
 Scroll vertically any background.
 
static void PA_DualBGScrollXY (u8 bg_number, s16 x, s16 y)
 Scroll horizontaly and vertically any background.
 
static void PA_DualEasyBgScrollX (u8 bg_select, s32 x)
 Scroll an EasyBg horizontaly. It must have been initialised with PA_LoadLargeBg.
 
static void PA_DualEasyBgScrollY (u8 bg_select, s32 y)
 Scroll an EasyBg vertically.
 
static void PA_DualLoadBackground (u8 bg_number, const PA_BgStruct *bg)
 Load a background (EasyBg, RotBg or UnlimitedBg), but for Dual screen...
 
static void PA_DualEasyBgScrollXY (u8 bg_select, s32 x, s32 y)
 Scroll a Dual EasyBg.
 
static void PA_DualInfLargeScrollX (u8 bg_select, s32 x)
 Scroll a large infinite scrolling background horizontaly. It must have been initialised with PA_LoadLargeBg.
 
static void PA_DualInfLargeScrollY (u8 bg_select, s32 y)
 Scroll a large infinite scrolling background vertically. It must have been initialised with PA_LoadLargeBg.
 
static void PA_DualInfLargeScrollXY (u8 bg_select, s32 x, s32 y)
 Scroll a large infinite scrolling background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg.
 
static void PA_DualLargeScrollX (u8 bg_select, s32 x)
 Scroll a large background horizontaly. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll...
 
static void PA_DualLargeScrollY (u8 bg_select, s32 y)
 Scroll a large background vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll...
 
static void PA_DualLargeScrollXY (u8 bg_select, s32 x, s32 y)
 Scroll a large background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll...
 
static void PA_DualInitParallaxX (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_DualInitParallaxY (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_DualParallaxScrollX (s32 x)
 Scroll the backgrounds.
 
static void PA_DualParallaxScrollY (s32 y)
 Scroll the backgrounds.
 
static void PA_DualParallaxScrollXY (s32 x, s32 y)
 Scroll the backgrounds.
 
static void PA_DualSetBgPrio (u8 bg, u8 prio)
 Change a backgrounds priority.
 

Detailed Description

Load tiles, a map, scroll it... and 2 screens automatically

Macro Definition Documentation

◆ PA_DualLoadTiledBg

#define PA_DualLoadTiledBg (   bg_number,
  bg_name 
)
Value:
do{\
PA_DEPRECATED_MACRO;\
PA_LoadTiledBg(0, bg_number, bg_name);\
PA_LoadTiledBg(1, bg_number, bg_name);\
PA_DualBGScrollY(bg_number, 0);}while(0)

[DEPRECATED] This will never get easier... Loads a background TiledBg converted with PAGfx, with it's tiles, map, and palette. Only 256 color mode available. On 2 screens as 1...

Deprecated:
Parameters
bg_numberBackground number to load (from 0 to 3)
bg_nameBackground name, like bg0

◆ PA_DualLoadSimpleBg

#define PA_DualLoadSimpleBg (   bg_select,
  bg_tiles,
  bg_map,
  bg_size,
  wraparound,
  color_mode 
)
Value:
do{\
PA_DEPRECATED_MACRO;\
PA_LoadSimpleBg(0, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode);\
PA_LoadSimpleBg(1, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode);\
PA_DualBGScrollY(bg_select, 0);}while(0)

[DEPRECATED] Simplest way to load a Background on both screens

Deprecated:
Parameters
bg_selectBackground number to load (from 0 to 3)
bg_tilesName of the tiles' info (example: ship_Tiles)
bg_mapName of the map's info (example : ship_Map)
bg_sizeBackground size. To use a normal background, use the macros BG_256X256, BG_256X512, etc...
wraparoundIf the background wraps around or not. More important for rotating backgrounds.
color_modeColor mode : 0 for 16 color mode, 1 for 256...

◆ PA_DualLoadRotBg

#define PA_DualLoadRotBg (   bg_select,
  bg_tiles,
  bg_map,
  bg_size,
  wraparound 
)
Value:
do{\
PA_DEPRECATED_MACRO;\
PA_LoadRotBg(0, bg_select, bg_tiles, bg_map, bg_size, wraparound);\
PA_LoadRotBg(1, bg_select, bg_tiles, bg_map, bg_size, wraparound);\
PA_DualBGScrollY(bg_select, 0);}while(0)

[DEPRECATED] Load a background fit for rotating/scaling ! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors

Deprecated:
Parameters
bg_selectBackground number to load
bg_tilesName of the tiles' info (example: ship_Tiles)
bg_mapName of the map's info (example : ship_Map)
bg_sizeBackground size. Use the following macros : BG_ROT_128X128, or 256X256, 512X512, or 1024X1024
wraparoundIf the background wraps around or not.

◆ PA_DualLoadBg

#define PA_DualLoadBg (   bg_select,
  bg_tiles,
  tile_size,
  bg_map,
  bg_size,
  wraparound,
  color_mode 
)
Value:
do{\
PA_DEPRECATED_MACRO;\
PA_LoadBg(0, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode);\
PA_LoadBg(1, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode);\
PA_DualBGScrollY(bg_select, 0);}while(0)

[DEPRECATED] Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap

Deprecated:
Parameters
bg_selectBackground number to load (from 0 to 3)
bg_tilesName of the tiles' info (example: ship_Tiles)
tile_sizeSize of your tileset
bg_mapName of the map's info (example : ship_Map)
bg_sizeBackground 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...
wraparoundIf the background wraps around or not. More important for rotating backgrounds.
color_modeColor mode : 0 for 16 color mode, 1 for 256...

◆ PA_DualLoadPAGfxLargeBg

#define PA_DualLoadPAGfxLargeBg (   bg_number,
  bg_name 
)
Value:
do{\
PA_DEPRECATED_MACRO;\
PA_LoadPAGfxLargeBg(0, bg_number, bg_name);\
PA_LoadPAGfxLargeBg(1, bg_number, bg_name);\
PA_DualInfLargeScrollY(bg_number, 0);}while(0)

[DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), converted with PAGfx. Background on both screens, as one

Deprecated:
Parameters
bg_numberBackground number to load (from 0 to 3)
bg_nameBackground name, in PAGfx

◆ PA_DualLoadLargeBg

#define PA_DualLoadLargeBg (   bg_select,
  bg_tiles,
  bg_map,
  color_mode,
  lx,
  ly 
)
Value:
do{\
PA_DEPRECATED_MACRO;\
PA_LoadLargeBg(0, bg_select, bg_tiles, bg_map, color_mode, lx, ly);\
PA_LoadLargeBg(1, bg_select, bg_tiles, bg_map, color_mode, lx, ly);\
PA_DualInfLargeScrollY(bg_select, 0);}while(0)

[DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), on both screens

Deprecated:
Parameters
bg_selectBackground number to load (from 0 to 3)
bg_tilesName of the tiles' info (example: ship_Tiles)
bg_mapName of the map's info (example : ship_Map)
color_modeColor mode : 0 for 16 color mode, 1 for 256...
lxWidth, in tiles. So a 512 pixel wide map is 64 tiles wide...
lyHeight, in tiles. So a 512 pixel high map is 64 tiles high...

◆ PA_DualLoadLargeBgEx

#define PA_DualLoadLargeBgEx (   bg_select,
  bg_tiles,
  tile_size,
  bg_map,
  color_mode,
  lx,
  ly 
)
Value:
do{\
PA_DEPRECATED_MACRO;\
PA_LoadLargeBgEx(0, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly);\
PA_LoadLargeBgEx(1, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly);\
PA_DualInfLargeScrollY(bg_select, 0);}while(0)

[DEPRECATED] Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), but here you can put yourself the tile size...

Deprecated:
Parameters
bg_selectBackground number to load (from 0 to 3)
bg_tilesName of the tiles' info (example: ship_Tiles)
tile_sizeSize of your tileset
bg_mapName of the map's info (example : ship_Map)
color_modeColor mode : 0 for 16 color mode, 1 for 256...
lxWidth, in tiles. So a 512 pixel wide map is 64 tiles wide...
lyHeight, in tiles. So a 512 pixel high map is 64 tiles high...

◆ PA_DualEasyBgLoad

#define PA_DualEasyBgLoad (   bg_number,
  bg_name 
)
Value:
do{\
PA_DEPRECATED_MACRO;\
PA_EasyBgLoad(0, bg_number, bg_name);\
PA_EasyBgLoad(1, bg_number, bg_name);\
PA_DualEasyBgScrollY(bg_number, 0);}while(0)

[DEPRECATED] EasyBg load, but for Dual screen...

Deprecated:
Parameters
bg_numberBackground number to load (from 0 to 3)
bg_nameBackground name, in PAGfx

Function Documentation

◆ PA_DualHideBg()

static inline void PA_DualHideBg ( u8  bg_select)
inlinestatic

Hide a background on both screens.

Parameters
bg_selectBackground number to load (from 0 to 3)

◆ PA_DualShowBg()

static inline void PA_DualShowBg ( u8  bg_select)
inlinestatic

Show a hidden background, on both screens.

Parameters
bg_selectBackground number to load (from 0 to 3)

◆ PA_DualDeleteBg()

static inline void PA_DualDeleteBg ( u8  bg_select)
inlinestatic

Delete a complete background (tiles + map + hide it...)

Parameters
bg_selectBackground number to load (from 0 to 3)

◆ PA_DualBGScrollX()

static inline void PA_DualBGScrollX ( u8  bg_number,
s16  x 
)
inlinestatic

Scroll horizontaly any background, on both screens.

Parameters
bg_numberBackground number (0-3)
xX value to scroll

◆ PA_DualBGScrollY()

static inline void PA_DualBGScrollY ( u8  bg_number,
s16  y 
)
inlinestatic

Scroll vertically any background.

Parameters
bg_numberBackground number (0-3)
yY value to scroll

◆ PA_DualBGScrollXY()

static inline void PA_DualBGScrollXY ( u8  bg_number,
s16  x,
s16  y 
)
inlinestatic

Scroll horizontaly and vertically any background.

Parameters
bg_numberBackground number (0-3)
xX value to scroll
yY value to scroll

◆ PA_DualEasyBgScrollX()

static inline void PA_DualEasyBgScrollX ( u8  bg_select,
s32  x 
)
inlinestatic

Scroll an EasyBg horizontaly. It must have been initialised with PA_LoadLargeBg.

Parameters
bg_selectBackground number to load (from 0 to 3)
xX value to scroll

◆ PA_DualEasyBgScrollY()

static inline void PA_DualEasyBgScrollY ( u8  bg_select,
s32  y 
)
inlinestatic

Scroll an EasyBg vertically.

Parameters
bg_selectBackground number to load (from 0 to 3)
yY value to scroll

◆ PA_DualLoadBackground()

static inline void PA_DualLoadBackground ( u8  bg_number,
const PA_BgStruct bg 
)
inlinestatic

Load a background (EasyBg, RotBg or UnlimitedBg), but for Dual screen...

Parameters
bg_numberBackground number to load (from 0 to 3)
bgPointer to the background (struct)

◆ PA_DualEasyBgScrollXY()

static inline void PA_DualEasyBgScrollXY ( u8  bg_select,
s32  x,
s32  y 
)
inlinestatic

Scroll a Dual EasyBg.

Parameters
bg_selectBackground number to load (from 0 to 3)
xX value to scroll
yY value to scroll

◆ PA_DualInfLargeScrollX()

static inline void PA_DualInfLargeScrollX ( u8  bg_select,
s32  x 
)
inlinestatic

Scroll a large infinite scrolling background horizontaly. It must have been initialised with PA_LoadLargeBg.

Parameters
bg_selectBackground number to load (from 0 to 3)
xX value to scroll

◆ PA_DualInfLargeScrollY()

static inline void PA_DualInfLargeScrollY ( u8  bg_select,
s32  y 
)
inlinestatic

Scroll a large infinite scrolling background vertically. It must have been initialised with PA_LoadLargeBg.

Parameters
bg_selectBackground number to load (from 0 to 3)
yY value to scroll

◆ PA_DualInfLargeScrollXY()

static inline void PA_DualInfLargeScrollXY ( u8  bg_select,
s32  x,
s32  y 
)
inlinestatic

Scroll a large infinite scrolling background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg.

Parameters
bg_selectBackground number to load (from 0 to 3)
xX value to scroll
yY value to scroll

◆ PA_DualLargeScrollX()

static inline void PA_DualLargeScrollX ( u8  bg_select,
s32  x 
)
inlinestatic

Scroll a large background horizontaly. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll...

Parameters
bg_selectBackground number to load (from 0 to 3)
xX value to scroll

◆ PA_DualLargeScrollY()

static inline void PA_DualLargeScrollY ( u8  bg_select,
s32  y 
)
inlinestatic

Scroll a large background vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll...

Parameters
bg_selectBackground number to load (from 0 to 3)
yY value to scroll

◆ PA_DualLargeScrollXY()

static inline void PA_DualLargeScrollXY ( u8  bg_select,
s32  x,
s32  y 
)
inlinestatic

Scroll a large background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll...

Parameters
bg_selectBackground number to load (from 0 to 3)
xX value to scroll
yY value to scroll

◆ PA_DualInitParallaxX()

static inline void PA_DualInitParallaxX ( s32  bg0,
s32  bg1,
s32  bg2,
s32  bg3 
)
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...

Parameters
bg0Value 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
bg1Same thing for Background 1
bg2Same thing for Background 2
bg3Same thing for Background 3

◆ PA_DualInitParallaxY()

static inline void PA_DualInitParallaxY ( s32  bg0,
s32  bg1,
s32  bg2,
s32  bg3 
)
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...

Parameters
bg0Value 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
bg1Same thing for Background 1
bg2Same thing for Background 2
bg3Same thing for Background 3

◆ PA_DualParallaxScrollX()

static inline void PA_DualParallaxScrollX ( s32  x)
inlinestatic

Scroll the backgrounds.

Parameters
xX value to scroll

◆ PA_DualParallaxScrollY()

static inline void PA_DualParallaxScrollY ( s32  y)
inlinestatic

Scroll the backgrounds.

Parameters
yY value to scroll

◆ PA_DualParallaxScrollXY()

static inline void PA_DualParallaxScrollXY ( s32  x,
s32  y 
)
inlinestatic

Scroll the backgrounds.

Parameters
xX value to scroll
yY value to scroll

◆ PA_DualSetBgPrio()

static inline void PA_DualSetBgPrio ( u8  bg,
u8  prio 
)
inlinestatic

Change a backgrounds priority.

Parameters
bgBackground...
prioPriority level (0-3, 0 being the highest)