NNS_G2dCharCanvasInitForBG

C Specification


#include <nnsys/g2d/g2d_CharCanvas.h>

void NNS_G2dCharCanvasInitForBG(
	NNSG2dCharCanvas* pCC,
	void* charBase,
	int areaWidth,
	int areaHeight,
	NNSG2dCharaColorMode colorMode
);

Arguments

pCC [OUT] Pointer to CharCanvas.
charBase [IN] Pointer to starting point of characters assigned to CharCanvas. Must have 4-byte alignment.
areaWidth [IN] Number of characters in the horizontal direction of CharCanvas
areaHeight [IN] Number of characters in the vertical direction of CharCanvas
colorMode [IN] Color mode of target BG

Return Values

None.

Description

Initializes the NNSG2dCharCanvas structure in order to build CharCanvas on Character BG screen.

With this function, the CharCanvas gets built with n number of characters, assigned starting from charBase, where n = areaWidth * areaHeight. Note that the maximum number of characters that can be assigned to CharCanvas is 256 for an Affine BG, and 1024 for Text BG and Affine Extended BG.

Conceptual Diagram

colorMode takes either of these values:

NNS_G2D_CHARA_COLORMODE_16 Use 16-color characters
NNS_G2D_CHARA_COLORMODE_256 Use 256-color characters

Sample code

    const int width = 24;
    const int height = 8;
    const int offset = 0x40;

    NNSG2dCharCanvas cc;
    GXCharFmt16* pCharBase = (GXCharFmt16*)G2_GetBG0CharPtr();


    // Build CharCanvas using main BG0 characters.
    NNS_G2dCharCanvasInitForBG(
        &cc,                            // 
        pCharBase + offset              // Build CharCanvas using (width * height) 
        width,                          // number of characters that are
        height,                         // "offset" from the character base.
        NNS_G2D_CHARA_COLORMODE_16      // 
    );

See Also

Revision History

2007/01/11 Changed the type of the fifth argument from NNSG2dColorMode to NNSG2dCharaColorMode.
2005/09/29 Corrected IN/OUT indications for arguments.
2005/05/25 Initial version


CONFIDENTIAL