NNS_G2dCalcRequiredOBJ*

C Specification

#include <nnsys/g2d/g2d_CharCanvas.h>

int NNS_G2dCalcRequiredOBJ1D(
int areaWidth,
int areaHeight
);

int NNS_G2dCalcRequiredOBJ2DRect(
int areaWidth,
int areaHeight
);

Arguments

areaWidth [IN] CharCanvas width (in character units)
areaHeight [IN]CharCanvas height (in character units)

Return Values

The number of OBJ required to display CharCanvas.

Description

Uses NNS_G2dArrangeOBJ1D and NNS_G2dArrangeOBJ2DRect to calculate the required number of OBJ.

Also refer to the computation result of NNS_G2dCalcRequiredOBJ*.

Sample code


/*
*  In this sample code, OBJ are assigned from the end of a set of 128 OBJ for display of CharCanvas.
 */

NNSG2dCharCanvas cc;
GXCharFmt16* const charBase = (GXCharFmt16*)G2_GetOBJCharPtr();
GXOamAttr* const oamBase = (GXOamAttr*)HW_OAM;
const int width = 15;
const int height = 10;
const int x = 30;
const int y = 20;
const int charNo = 4;
int objNo;

// Initialize CharCanvas
NNS_G2dCharCanvasInitForOBJ1D(
&cc, //
charBase + charNo, // Pointer to character
width, // Width
height, // Height
NNS_G2D_CHARA_COLORMODE_16 // Color mode
); // Calculate the required number of OBJ and request the OBJ starting position
objNo = 128 - NNS_G2dCalcRequiredOBJ1D(width, height);

// Place OBJ
NNS_G2dArrangeOBJ1D(
oamBase + objNo, // Pointer to OAM
width, // Width
height, // Height
x, // X coordinate
y, // Y coordinate
GX_OAM_COLORMODE_16, // Color mode
charNo // Character name
); /* After this comes configuration of OBJ and building of TextCanvas, etc.
*/

See Also

NNS_G2dArrangeOBJ1D(), NNS_G2dArrangeOBJ2DRect()

Revision History

05/25/2005 Initial version.