# G2D Sample Demos

## Location

`$TwlSystem/build/demos/g2d/`

## Compilation

Move to the `$TwlSystem/build/demos/g2d/` directory and run:

> `% make`

Compiling begins, and the SRL executable file and the NEF or TEF files with the binary information are generated in:

> `$TwlSystem/build/demos/g2d/samples/[sample_name]/bin/[platform]/[target]/`

For example:

> `$TwlSystem/build/demos/g2d/samples/Cell_Simple/bin/ARM9-TS.HYB/Release/`

The executable file of the release version for the NITRO/TWL Hybrid of the `Cell_Simple` demo is generated in the path described above.

## Execution

Move to `$TwlSystem/build/demos/g2d/(samples|bg|Text)/(sample_name)/bin/(platform)/(target)/`. Depending on the type of the built ROM, one of the following methods is used for execution.

### For NITRO ROMs

When using the Ensata emulator:

- Execute the NEF and SRL files with `ensata`.

When using IS-NITRO-DEBUGGER:

- Load and execute an NLF file with IS-NITRO-DEBUGGER.
- Execute an SRL file with IS-NITRO-DEBUGGER.
- Execute an SRL file with IS-NITRO-DEBUGGER using the `loadrun.exe` tool from a command line.

When using IS-TWL-DEBUGGER:

- Load and execute an NLF file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER using the `loadrun.TWL.exe` tool from a command line.

### For TWL/NITRO Hybrid ROMs

When using IS-NITRO-DEBUGGER:

- Execute an SRL file with IS-NITRO-DEBUGGER.
- Execute an SRL file with IS-NITRO-DEBUGGER using the `loadrun.exe` tool from a command line.

When using IS-TWL-DEBUGGER:

- Load and execute a TLF file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER using the `loadrun.TWL.exe` tool from a command line.

### For TWL Limited ROMs

When using IS-TWL-DEBUGGER:

- Load and execute a TLF file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER using the `loadrun.TWL.exe` tool from a command line.

## Description

#### OBJ Samples

`Cell_Simple` | This sample performs simple rendering for a cell. It uses a low-level API.
`CellAnimation` | This sample draws and updates cell animation.
`Entity` | This sample uses an entity to display cell animation. It also switches the color palette.
`MultiCellAnimation` | This sample draws and updates multicell animation.
`OamManagerEx` | This is an extended OAM manager sample. It displays more than 128 OBJ in time division and displays OBJ using the OBJ drawing order specifications and the display priority.
`OamManagerEx2` | This is an extended OAM manager sample. This sample of the application combines the OAM manager and extended OAM manager.
`OamManagerEx3` | This sample uses the extended OAM manager in combination with the renderer.
`Renderer_2LCD` | This sample uses the renderer module to display two screens. The screen display area can be changed.
`Renderer_Simple` | This sample draws cell animation using the renderer module.
`SoftwareSprite` | This is a software sprite drawing sample. It displays many sprites on the screen.
`SoftwareSprite2` | This is a software sprite drawing sample. It uses various attributes to display sprites on the screen.
`VRamAnimation` | This sample draws VRAM transfer animation.
`Renderer_Callback1` | The user can customize this sample using the callback function of the renderer.
`Renderer_Callback2` | This sample performs visible calling of each OBJ by using the callback function of the renderer.
`Renderer_PerfCheck` | This sample evaluates the performance of the renderer.
`RendererCore` | This sample shows how to use the renderer core by itself.
`RendererCore2` | This sample shows how to use the renderer core API. It also evaluates performance.
`OamSoftwareSpriteDraw` | This sample compares the performance of each OAM for the software sprite drawing API.
`Renderer_CharChange` | This sample renders by changing image proxies used by the renderer. It also uses partial character-data conversion functionality with the converter's `-cr` option.
`UserExAttribute` | This demo uses the user-extended attributes.
`MultiCell_UILayout` | This demo uses multicell to perform user interface processing.

#### BG Samples

`MinimumBG` | Displays backgrounds on the top and bottom screens.
`ShareBG` | Displays backgrounds that share the same character data and color palette.
`BgEx` | Displays a background that uses the extended palette and partial character data.

#### Text Drawing Samples

`BGText` | Displays text strings on a text BG.
`BGAffine` | Displays text strings on an affine BG.
`OBJ1D` | Displays text strings on a 1D mapping OBJ.
`OBJ2DRect` | Displays text strings on a 2D mapping OBJ.
`CanvasCell` | Displays CharCanvas as a cell.
`ShiftJISText` | Displays ShiftJIS text strings.
`UTF16Text` | Displays UTF16 text strings.
`UTF8Text` | Displays UTF8 text strings.
`CP1252Text` | Displays CP1252 text strings.
`DoubleBuffering` | Displays text strings using an off-screen buffer.
`DrawLetter` | Uses text-drawing function.
`DrawLetters` | Uses text-string drawing function.
`DrawTaggedText` | Uses `NNS_G2dTextCanvasDrawTaggedText`.
`MinimumCanvas` | Dynamically constructs CharCanvas to match the text strings.
`PortraitHW` | Performs a vertical hold display by rotating the background.
`PortraitSW` | Performs a vertical hold display by using a font for holding the Nintendo DS system vertically.
`DrawVertical` | This is a sample of drawing vertically. A Japanese Windows environment is required in order to build this sample.
`SimpleFontView` | Simply displays of glyph image in the font resource.

## Operating Environment

Normal operation for all of the samples using IS-TWL-DEBUGGER, IS-NITRO-EMULATOR, and Ensata has been confirmed.

## See Also

G2D Function List

## Revision History

2008/06/20 Updated compile method and execution method for TWL.
2007/03/14 Added the `PortraitHW`, `PortraitSW`, and `DrawVertical` samples.
2006/05/29 Added the `CP1252Text` sample.
2005/09/01 Added the `Renderer_CharChange`, `UserExAttribute`, and `MultiCell_UILayout` samples.
2005/07/12 Added the `CanvasCell` sample.
2005/06/27 Added the `BgEx` sample.
2005/06/06 Added the `Renderer_CharChange` sample.
2005/05/25 Added text rendering samples.
2005/03/28 Added `OamManagerEx3`.
2005/01/24 Deleted the description of IS-NITRO-EMULATOR in Execution, deleted the description of TEG in Operating Environment, and changed TS to IS-NITRO-EMULATOR. Changed to IS-NITRO-EMULATOR.
2004/12/06 Added the `OamManagerEx2` sample.
2004/11/10 Added six samples: `Renderer_Callback1`, `Renderer_Callback2`, `Renderer_PerfCheck`, `RendererCore`, `RendererCore2`, and `OamSoftwareSpriteDraw`.
2004/09/02 Added `BG` samples.
2004/08/02 Initial version.

CONFIDENTIAL