1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 9<title>DEMO Font Functions</title> 10</head> 11 12<body> 13 14<h1 align="left">DEMO Font Functions</h1> 15 16 17<h2>C Specification</h2> 18 19<dl> 20<dd><pre><CODE>#include <demo.h> 21 22typedef enum 23{ 24DMTF_POINTSAMPLE, // Point sampling 25DMTF_BILERP // Bilerp filtering 26} DMTexFlt; 27 28#define DM_FT_OPQ 0 // Opaque 29#define DM_FT_RVS 1 // Reverse 30#define DM_FT_XLU 2 // Translucent 31 32void DEMOInitCaption( s32 ftype, s32 swidth, s32 sheight); 33void DEMOPrintf ( s16 x, s16 y, s16 z, char* fmt, ... ); 34void DEMOPuts ( s16 x, s16 y, s16 z, char* str); 35 36void DEMOSetFontType( s32 ftype ); 37void DEMOSetupScrnSpc( s32 swidth, s32 sheight, float depth); 38void DEMOLoadFont ( GXTexMapID tmap, GXTexMtx tmat, DMTexFlt tflt); 39void DEMOMtxScreen( Mtx mmtx, Mtx44 mprj, float vpw, float vph, float near);</CODE></pre> 40 </dd> 41</dl> 42 43 44<h2>Arguments</h2> 45<TABLE border="1" cellpadding="3" cellspacing="0.1"> 46 <tr> 47<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>ftype</font></strong></em></TD> 48<TD width="520">Font type. Determines the GX blend mode.</TD> 49 </tr> 50 <tr> 51<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>swidth</font></strong></em></TD> 52<TD width="520">Screen width.</TD> 53 </tr> 54 <tr> 55<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>sheight</font></strong></em></TD> 56<TD width="520">Screen height.</TD> 57 </tr> 58 <tr> 59 <TD width="120" bgcolor="#ffffe8"><em><strong><CODE>...</font></strong></em></TD> 60<TD width="520">Plans for future additions.</TD> 61 </tr> 62</TABLE> 63<h2>Return Values</h2> 64 65<P>None.</P> 66<H2>Description</H2> 67<P>This function 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.</P> 68<P>The <code>DEMOInitCaption</code> function initializes the font system and the <code>DEMOPrintf</code> commands can immediately follow. <code>DEMOInitCaption</code> 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. <code>DEMOInitCaption</code> also initializes projection and transform matrices 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 values range from 0 to 100.</P> 69<P>The <code>DEMOPrintf</code> and <code>DEMOPuts</code> 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.</P> 70<P>The <code>DEMOSetFontType</code> function can be used to change the font type (GX blend mode) without reinitializing everything. The <code>DEMOSetupScrnSpc</code> function can be used to modify projections and transformations. The <code>DEMOLoadFont</code> function may be used to modify texture filtering. <code>DEMOMtxScreen</code> returns a matrix that specifies the screen to camera transformation.</P> 71<H3>Example Program</H3> 72<P>The GX and other demos use this example program.</P> 73 74 75 76<h2>See Also</h2> 77<H2>Revision History</H2> 78<P>03/01/2006 Initial version.</P> 79</body> 80</html>