1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - MB - demos - multiboot-wfs - common 3 File: util.h 4 5 Copyright 2005-2008 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Date:: 2008-09-18#$ 14 $Rev: 8573 $ 15 $Author: okubata_ryoma $ 16 *---------------------------------------------------------------------------*/ 17 18 19 #if !defined(NITRO_DEMOS_MB_MULTIBOOT_WFS_UTIL_H_) 20 #define NITRO_DEMOS_MB_MULTIBOOT_WFS_UTIL_H_ 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /*===========================================================================*/ 27 28 #include <nitro/types.h> 29 30 /* 31 * These routines process the whole sample framework. 32 * These are not directly related to demonstrations provided by samples. 33 */ 34 35 36 /*---------------------------------------------------------------------------* 37 Structure Definitions 38 *---------------------------------------------------------------------------*/ 39 40 /* ASCII font data */ 41 extern const u32 d_CharData[8 * 256]; 42 extern const u32 d_PaletteData[8 * 16]; 43 44 /* Color palette */ 45 #define COLOR_BLACK 0x00 46 #define COLOR_RED 0x01 47 #define COLOR_GREEN 0x02 48 #define COLOR_BLUE 0x03 49 #define COLOR_YELLOW 0x04 50 #define COLOR_PURPLE 0x05 51 #define COLOR_LIGHT_BLUE 0x06 52 #define COLOR_DARK_RED 0x07 53 #define COLOR_DARK_GREEN 0x08 54 #define COLOR_DARK_BLUE 0x09 55 #define COLOR_DARK_YELLOW 0x0A 56 #define COLOR_DARK_PURPLE 0x0B 57 #define COLOR_DARK_LIGHT_BLUE 0x0C 58 #define COLOR_GRAY 0x0D 59 #define COLOR_DARK_GRAY 0x0E 60 #define COLOR_WHITE 0x0F 61 62 63 /*---------------------------------------------------------------------------* 64 Structure Definitions 65 *---------------------------------------------------------------------------*/ 66 67 /* Key input data */ 68 typedef struct KeyInfo 69 { 70 u16 cnt; /* Unprocessed input value */ 71 u16 trg; /* Push trigger input */ 72 u16 up; /* Release trigger input */ 73 u16 rep; /* Press and hold repeat input */ 74 75 } 76 KeyInfo; 77 78 79 /*---------------------------------------------------------------------------* 80 Function Declarations 81 *---------------------------------------------------------------------------*/ 82 83 /*---------------------------------------------------------------------------* 84 Name: UTIL_Init 85 86 Description: Initializes sample framework. 87 88 Arguments: None. 89 90 Returns: None. 91 *---------------------------------------------------------------------------*/ 92 void UTIL_Init(void); 93 94 95 /*---------------------------------------------------------------------------* 96 Name: KeyRead 97 98 Description: Gets key data. 99 100 Arguments: pKey: Address at which key information is stored 101 102 Returns: None. 103 *---------------------------------------------------------------------------*/ 104 void KeyRead(KeyInfo * pKey); 105 106 107 /*---------------------------------------------------------------------------* 108 Name: ClearString 109 110 Description: Initializes the virtual screen for display. 111 112 Arguments: None. 113 114 Returns: None. 115 *---------------------------------------------------------------------------*/ 116 void ClearString(void); 117 118 119 /*---------------------------------------------------------------------------* 120 Name: PrintString 121 122 Description: Displays a string of up to 32 characters on the virtual screen 123 124 Arguments: x - The x-coordinate that positions the start of the string / 8 dot 125 y - The y-coordinate that positions the start of the string / 8 dot 126 palette - The palette number that designates the character color 127 text - The displayed string 128 - Subsequent variable arguments 129 130 Returns: None. 131 *---------------------------------------------------------------------------*/ 132 void PrintString(int x, int y, int palette, const char *text, ...); 133 134 135 /*---------------------------------------------------------------------------* 136 Name: ColorString 137 138 Description: Changes the color of the string shown on the virtual screen. 139 140 Arguments: x - The x-coordinate for the beginning of the color change / 8 dot 141 y - The y-coordinate for the beginning of the color change / 8 dot 142 length - Number of characters to change the color of 143 palette - The palette number that designates the character color 144 145 Returns: None. 146 *---------------------------------------------------------------------------*/ 147 void ColorString(int x, int y, int length, int palette); 148 149 150 /*---------------------------------------------------------------------------* 151 Name: ClearLine 152 153 Description: Initializes string rendering. 154 155 Arguments: None. 156 157 Returns: None. 158 *---------------------------------------------------------------------------*/ 159 void ClearLine(void); 160 161 162 /*---------------------------------------------------------------------------* 163 Name: PrintLine 164 165 Description: In a specified line, renders a nonvolatile string that will remain for at least one frame. 166 167 Arguments: x Display position x grid. (8 pixel units) 168 y Display position y grid. (8 pixel units) 169 text Formatted string that receives the variable argument that follows. 170 171 Returns: None. 172 *---------------------------------------------------------------------------*/ 173 void PrintLine(int x, int y, const char *text, ...); 174 175 176 /*---------------------------------------------------------------------------* 177 Name: FlushLine 178 179 Description: Overwrites the nonvolatile string from PrintLine() to the normal string render. 180 181 Arguments: None. 182 183 Returns: None. 184 *---------------------------------------------------------------------------*/ 185 void FlushLine(void); 186 187 188 /*===========================================================================*/ 189 190 #ifdef __cplusplus 191 } /* extern "C" */ 192 #endif 193 194 #endif /* NITRO_DEMOS_WBT_WBT_FS_UTIL_H_ */ 195 196 197 /*---------------------------------------------------------------------------* 198 End of file 199 *---------------------------------------------------------------------------*/ 200