PAlib: Bg Modes on 2 Screens

Main Page | Modules | File List | Globals | Search for

# Bg Modes on 2 Screens

## Defines

#define | PA_DualLoadTiledBg(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. On 2 screens as 1...
#define | PA_DualLoadSimpleBg(bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode)
| Simplest way to load a Background on both screens
#define | PA_DualLoadRotBg(bg_select, bg_tiles, bg_map, bg_size, wraparound)
| 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)
| Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap
#define | PA_DualLoadPAGfxLargeBg(bg_number, bg_name)
| 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)
| 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)
| 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...

## Functions

void | PA_DualHideBg (u8 bg_select)
| Hide a background on both screens
void | PA_DualShowBg (u8 bg_select)
| Show a hidden background, on both screens
void | PA_DualResetBg (void)
| Reinitialize de Bg system
void | PA_DualDeleteBg (u8 bg_select)
| Delete a complete background (tiles + map + hide it...)
void | PA_DualSetBgRot (u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom)
void | PA_DualBGScrollX (u8 bg_number, s16 x)
| Scroll horizontaly any background, on both screens
void | PA_DualBGScrollY (u8 bg_number, s16 y)
| Scroll vertically any background
void | PA_DualBGScrollXY (u8 bg_number, s16 x, s16 y)
| Scroll horizontaly and vertically any background
void | PA_DualInfLargeScrollX (u8 bg_select, s32 x)
| Scroll a large infinite scrolling background horizontaly. It must have been initialised with PA_LoadLargeBg.
void | PA_DualInfLargeScrollY (u8 bg_select, s32 y)
| Scroll a large infinite scrolling background vertically. It must have been initialised with PA_LoadLargeBg.
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.
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...
void | PA_DualLargeScrollY (u8 bg_select, s32 y)
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...
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...
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...
void | PA_DualParallaxScrollX (s32 x)
| Scroll the backgrounds
void | PA_DualParallaxScrollY (s32 y)
| Scroll the backgrounds
void | PA_DualParallaxScrollXY (s32 x, s32 y)
| Scroll the backgrounds
void | PA_DualSetBgPrio (u8 bg, u8 prio)
| Change a backgrounds priority

## Detailed Description

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

## Define Documentation

#define PA_DualLoadBg | ( | bg_select,
|  | bg_tiles,
|  | tile_size,
|  | bg_map,
|  | bg_size,
|  | wraparound,
|  | color_mode |  | ) |

Value:

    {\
    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);}

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

Parameters:

  | 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_DualLoadLargeBg | ( | bg_select,
|  | bg_tiles,
|  | bg_map,
|  | color_mode,
|  | lx,
|  | ly |  | ) |

Value:

    {\
    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);}

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

Parameters:

  | 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)
  | color_mode | Color mode : 0 for 16 color mode, 1 for 256...
  | lx | Width, in tiles. So a 512 pixel wide map is 64 tiles wide...
  | ly | Height, in tiles. So a 512 pixel high map is 64 tiles high...

#define PA_DualLoadLargeBgEx | ( | bg_select,
|  | bg_tiles,
|  | tile_size,
|  | bg_map,
|  | color_mode,
|  | lx,
|  | ly |  | ) |

Value:

    {\
    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);}

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...

Parameters:

  | 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)
  | color_mode | Color mode : 0 for 16 color mode, 1 for 256...
  | lx | Width, in tiles. So a 512 pixel wide map is 64 tiles wide...
  | ly | Height, in tiles. So a 512 pixel high map is 64 tiles high...

#define PA_DualLoadPAGfxLargeBg | ( | bg_number,
|  | bg_name |  | ) |

Value:

    {\
           PA_LoadPAGfxLargeBg(0, bg_number, bg_name);\
           PA_LoadPAGfxLargeBg(1, bg_number, bg_name);\
           PA_DualInfLargeScrollY(bg_number, 0);}

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

Parameters:

  | bg_number | Background number to load (from 0 to 3)
  | bg_name | Background name, in PAGfx

#define PA_DualLoadRotBg | ( | bg_select,
|  | bg_tiles,
|  | bg_map,
|  | bg_size,
|  | wraparound |  | ) |

Value:

    {\
    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);}

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

Parameters:

  | bg_select | Background number to load
  | 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. Use the following macros : BG_ROT_128X128, or 256X256, 512X512, or 1024X1024
  | wraparound | If the background wraps around or not.

#define PA_DualLoadSimpleBg | ( | bg_select,
|  | bg_tiles,
|  | bg_map,
|  | bg_size,
|  | wraparound,
|  | color_mode |  | ) |

Value:

    {\
    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);}

Simplest way to load a Background on both screens

Parameters:

  | 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_DualLoadTiledBg | ( | bg_number,
|  | bg_name |  | ) |

Value:

    {\
           PA_LoadTiledBg(0, bg_number, bg_name);\
           PA_LoadTiledBg(1, bg_number, bg_name);\
           PA_DualBGScrollY(bg_number, 0);}

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...

Parameters:

  | bg_number | Background number to load (from 0 to 3)
  | bg_name | Background name, like bg0

## Function Documentation

inline void PA_DualBGScrollX | ( | u8 | bg_number,
|  | s16 | x
| ) | `[inline]`

Scroll horizontaly any background, on both screens

Parameters:

  | bg_number | Background number (0-3)
  | x | X value to scroll

inline void PA_DualBGScrollXY | ( | u8 | bg_number,
|  | s16 | x,
|  | s16 | y
| ) | `[inline]`

Scroll horizontaly and vertically any background

Parameters:

  | bg_number | Background number (0-3)
  | x | X value to scroll
  | y | Y value to scroll

inline void PA_DualBGScrollY | ( | u8 | bg_number,
|  | s16 | y
| ) | `[inline]`

Scroll vertically any background

Parameters:

  | bg_number | Background number (0-3)
  | y | Y value to scroll

inline void PA_DualDeleteBg | ( | u8 | bg_select | ) | `[inline]`

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

Parameters:

  | bg_select | Background number to load (from 0 to 3)

inline void PA_DualHideBg | ( | u8 | bg_select | ) | `[inline]`

Hide a background on both screens

Parameters:

  | bg_select | Background number to load (from 0 to 3)

inline void PA_DualInfLargeScrollX | ( | u8 | bg_select,
|  | s32 | x
| ) | `[inline]`

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

Parameters:

  | bg_select | Background number to load (from 0 to 3)
  | x | X value to scroll

inline void PA_DualInfLargeScrollXY | ( | u8 | bg_select,
|  | s32 | x,
|  | s32 | y
| ) | `[inline]`

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

Parameters:

  | bg_select | Background number to load (from 0 to 3)
  | x | X value to scroll
  | y | Y value to scroll

inline void PA_DualInfLargeScrollY | ( | u8 | bg_select,
|  | s32 | y
| ) | `[inline]`

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

Parameters:

  | bg_select | Background number to load (from 0 to 3)
  | y | Y value to scroll

inline void PA_DualInitParallaxX | ( | s32 | bg0,
|  | s32 | bg1,
|  | s32 | bg2,
|  | s32 | bg3
| ) | `[inline]`

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:

  | 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

inline void PA_DualInitParallaxY | ( | s32 | bg0,
|  | s32 | bg1,
|  | s32 | bg2,
|  | s32 | bg3
| ) | `[inline]`

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:

  | 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

inline void PA_DualLargeScrollX | ( | u8 | bg_select,
|  | s32 | x
| ) | `[inline]`

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_select | Background number to load (from 0 to 3)
  | x | X value to scroll

inline void PA_DualLargeScrollXY | ( | u8 | bg_select,
|  | s32 | x,
|  | s32 | y
| ) | `[inline]`

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_select | Background number to load (from 0 to 3)
  | x | X value to scroll
  | y | Y value to scroll

inline void PA_DualParallaxScrollX | ( | s32 | x | ) | `[inline]`

Scroll the backgrounds

Parameters:

  | x | X value to scroll

inline void PA_DualParallaxScrollXY | ( | s32 | x,
|  | s32 | y
| ) | `[inline]`

Scroll the backgrounds

Parameters:

  | x | X value to scroll
  | y | Y value to scroll

inline void PA_DualParallaxScrollY | ( | s32 | y | ) | `[inline]`

Scroll the backgrounds

Parameters:

  | y | Y value to scroll

inline void PA_DualSetBgPrio | ( | u8 | bg,
|  | u8 | prio
| ) | `[inline]`

Change a backgrounds priority

Parameters:

  | bg | Background...
  | prio | Priority level (0-3, 0 being the highest)

inline void PA_DualShowBg | ( | u8 | bg_select | ) | `[inline]`

Show a hidden background, on both screens

Parameters:

  | bg_select | Background number to load (from 0 to 3)