# NNS_G2dArrangeOBJ*

## Syntax

      #include <nnsys/g2d/g2d_CharCanvas.h>

      int NNS_G2dArrangeOBJ1D(
          GXOamAttr * oam,
          int areaWidth,
          int areaHeight,
          int x,
          int y,
          GXOamColorMode color,
          int charName,
          NNSG2dOBJVramMode vramMode
      );

      int NNS_G2dArrangeOBJ2DRect(
          GXOamAttr * oam,
          int areaWidth,
          int areaHeight,
          int x,
          int y,
          GXOamColorMode color,
          int charName
      );

## Arguments

`oam` | [OUT] Pointer to the OAM array of the OBJ to be used for displaying CharCanvas.
`areaWidth` | [IN] CharCanvas width (in characters)
`areaHeight` | [IN]CharCanvas height (in characters)
`x` | [IN] CharCanvas upper-left corner display location (in pixels)
`y` | [IN] CharCanvas upper-left corner display location (in pixels)
`color` | [IN] CharCanvas color mode
`charName` | [IN] Starting character name
`vramMode` | [IN] OBJ VRAM capacity

## Return Values

The number of OBJs being used.

## Description

Appropriately positions OBJs so that the CharCanvas initialized by the `NNS_G2dCharCanvasInitForOBJ1D` or `NNS_G2dCharCanvasInitForOBJ2DRect` function can actually display on the screen. To be specific, the function sets the OBJ parameters for location, size, starting-character name, and color mode. The other parameters must be set separately.

Specify one of the following for the OBJ VRAM capacity `vramMode`.

`NNS_G2D_OBJVRAMMODE_32K` | Maximum capacity of OBJ VRAM that can be used is 32 KB
`NNS_G2D_OBJVRAMMODE_64K` | Maximum capacity of OBJ VRAM that can be used is 64 KB
`NNS_G2D_OBJVRAMMODE_128K` | Maximum capacity of OBJ VRAM that can be used is 128 KB
`NNS_G2D_OBJVRAMMODE_256K` | Maximum capacity of OBJ VRAM that can be used is 256 KB

Depending on the color mode `color` and the OBJ VRAM capacity `vramMode`, there are some restrictions on the `areaWidth` and `areaHeight` that can be set with `NNS_G2dArrangeOBJ1D`. The restrictions are explained in the table below.

Color mode | OBJ VRAM Capacity
--- | ---
32 KB | 64 KB | 128 KB | 256 KB
16 colors | (No restrictions) | (No restrictions) | Cannot be an odd number that has a remainder of 3 when divided by 4 | Cannot be an odd number
256 colors | (No restrictions) | (No restrictions) | (No restrictions) | Cannot be an odd number that has a remainder of 3 when divided by 4

To find out how many OBJs are required before calling this function, use either `NNS_G2dCalcRequiredOBJ1D` or `NNS_G2dCalcRequiredOBJ2DRect`.

## See Also

`NNS_G2dCharCanvasInitForOBJ1D`
`NNS_G2dCharCanvasInitForOBJ2DRect`
`NNS_G2dCalcRequiredOBJ1D`
`NNS_G2dCalcRequiredOBJ2DRect`

## Revision History

2005/05/25 Initial version.

CONFIDENTIAL