#include <nnsys/g2d/g2d_CharCanvas.h>
int NNS_G2dCalcRequiredOBJ1D(
int areaWidth,
int areaHeight
);
int NNS_G2dCalcRequiredOBJ2DRect(
int areaWidth,
int areaHeight
);
areaWidth |
[IN] CharCanvas width (in characters) |
areaHeight |
[IN]CharCanvas height (in characters) |
The number of OBJs required to display the CharCanvas.
Uses NNS_G2dArrangeOBJ1D
and NNS_G2dArrangeOBJ2DRect
to calculate the required number of OBJs.
See also the computation result of NNS_G2dCalcRequiredOBJ*
.
/*
* 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.
*/
NNS_G2dArrangeOBJ1D
NNS_G2dArrangeOBJ2DRect
2005/05/25 Initial version.
CONFIDENTIAL