NNS_G2dBGSetupEx

# NNS_G2dBGSetup*

## C Specification

      #include <nnsys/g2d/g2d_Screen.h>
      void NNS_G2dBGSetup(
      NNSG2dBGSelect bg,
      const NNSG2dScreenData* pScnData,
      const NNSG2dCharacterData* pChrData,
      const NNSG2dPaletteData* pPltData,
      GXBGScrBase scnBase,
      GXBGCharBase chrBase
      );

      void NNS_G2dBGSetupEx(
      NNSG2dBGSelect bg,
      const NNSG2dScreenData* pScnData,
      const NNSG2dCharacterData* pChrData,
      const NNSG2dPaletteData* pPltData,
      const NNSG2dCharacterPosInfo* pPosInfo,
      const NNSG2dPaletteCompressInfo* pCmpInfo,
      GXBGScrBase scnBase,
      GXBGCharBase chrBase
      );

## Arguments

`bg` | [IN] Target BG screen
pScnData | [IN] Pointer to the screen data used for the BG; NULL cannot be specified
pChrData | [IN] Pointer to the Character data used for the BG; NULL can be specified
pPltData | [IN] Pointer to the Palette data used for the BG; NULL can be specified
pPosInfo | [IN] Information about the character extraction region for pChrData. Specify NULL for this pointer if pChrData is not a partial character.
pCmpInfo | [IN] The palette compression information of pPltData. Specify NULL for this if pPltData is not a compressed palette.
scnBase | [IN] BG screen base
chrBase | [IN] BG character base

## Return Values

None.

## Description

This function configures the Character BG settings and loads the graphics data used for the BG into VRAM.

Specify one of the following for bg.

`NNS_G2D_BGSELECT_MAIN0` | Specifies BG0 of the main screen.
`NNS_G2D_BGSELECT_MAIN1` | Specifies BG1 of the main screen.
`NNS_G2D_BGSELECT_MAIN2` | Specifies BG2 of the main screen.
`NNS_G2D_BGSELECT_MAIN3` | Specifies BG3 of the main screen.
`NNS_G2D_BGSELECT_SUB0` | Specifies BG0 of the sub-screen.
`NNS_G2D_BGSELECT_SUB1` | Specifies BG1 of the sub-screen.
`NNS_G2D_BGSELECT_SUB2` | Specifies BG2 of the sub-screen.
`NNS_G2D_BGSELECT_SUB3` | Specifies BG3 of the sub-screen.

Performs BGControl according to the screen information in pScnData and loads each set of graphics data to the appropriate VRAM. For BGControl, the BG is set to the minimum size that can display pScnData. If pScnData is bigger than the maximum BG size, the BG is set to the maximum size. Changes the display mode, the BG mode, and the 3D allocation for main BG0 as needed. A warning is displayed when a change in this BG mode causes a change in the BG type of the BG screen other than the one specified in bg.

The values set by `NNS_G2dSetBGAreaOver()` are used for the out-of-area processes for Affine and Affine Extended BG. If the out-of-area process is not set, then `GX_BG_AREAOVER_XLU` is used.

If NULL is set for pPltData or pChrData, the corresponding graphics data is not loaded. This method is designed to be used for multiple BGs to share palettes and characters.

`NNS_G2dBGLoadElements()` is called internally.

This function changes the following settings.

- BG Control
- Display Mode
- BG mode
- The 2D allocation of the main screen BG0

The following settings are not changed; therefore, set them if necessary. Before calling this function, the VRAM allocation and the base offset must be set. BG is not visible by default; therefore, to display the BG, make sure that the BG is set to visible.

- VRAM allocations (excluding the LCDC allocation for loading the extended palette)
- Base offset
- BG visibility state
- BG level of priority
- BG mosaic
- BG scroll
- BG affine
- Color Special Effects

## See Also

`NNS_G2dBGLoadElements, NNS_G2dSetBGAreaOver, NNS_G2dGetBGAreaOver`

## Revision History

06/27/2005 Support for free size screen. 06/06/2005 Clearly indicated that free size screens are not supported. 09/02/2004 Initial version.