#include <demo.h>
typedef enum
{
DMTF_POINTSAMPLE, // Point sampling
DMTF_BILERP // Bilerp filtering
} DMTexFlt;
#define DM_FT_OPQ 0 // Opaque
#define DM_FT_RVS 1 // Reverse
#define DM_FT_XLU 2 // Translucent
void DEMOInitCaption( s32 ftype, s32 swidth, s32 sheight);
void DEMOPrintf ( s16 x, s16 y, s16 z, char* fmt, ... );
void DEMOPuts ( s16 x, s16 y, s16 z, char* str);
void DEMOSetFontType( s32 ftype );
void DEMOSetupScrnSpc( s32 swidth, s32 sheight, float depth);
void DEMOLoadFont ( GXTexMapID tmap, GXTexMtx tmat, DMTexFlt tflt);
void DEMOMtxScreen( Mtx mmtx, Mtx44 mprj, float vpw, float vph, float near);
| ftype | Font type. Determines the GX blend mode. |
|---|---|
| swidth | Screen width. |
| sheight | Screen height. |
| ... | Plans for future additions. |
None.
This DEMO font library provides a simple means for displaying text on screen. The text character set is defined using a texture map, and text characters are rendered by rendering texture rectangles.
The DEMOInitCaption function initializes the font system and the DEMOPrintf commands can immediately follow. DEMOInitCaption takes three arguments: font type, screen width, and screen height. The font type controls the GX blending mode and determines if the text is white on black, black on white, or white on transparent. Other text colors and backgrounds are available, but require that the TEV and color channels be set manually. The DEMOInitCaption function also initializes a projective transformation matrix that places the origin in the upper left corner of the screen and maps (X, Y) to absolute pixel coordinates relative to the origin. The default Z-value range is from 0 to 100.
The DEMOPrintf and DEMOPuts functions render text strings. Carriage returns are also read, but any other nondisplayable text characters are interpreted as EOL markers. The position passed to the function specifies the upper left corner for the first text character to display (also establishes the left margin for carriage returns). Each text character is defined by an 8 x 8 cell including spaces.
The DEMOSetFontType function can be used to change the font type (GX blend mode) without reinitializing everything. The DEMOSetupScrnSpc function can be used to modify projections and transformations. The DEMOLoadFont function may be used to modify texture filtering. DEMOMtxScreen function returns a matrix that specifies the screen to camera transformation.
The GX and other demos use this example program.
None.
2006/03/01 Initial version.
CONFIDENTIAL