1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - WBT - demos - wbt-1 3 File: font.h 4 5 Copyright 2006-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 #ifndef _TEXT_H_ 19 #define _TEXT_H_ 20 21 #define NUM_OF_SCREEN 4 22 23 #define X_LINE_MAX (32) 24 #define Y_LINE_MAX (24) 25 26 #define LINE_BUF_X_SIZE 32 27 #define LINE_BUF_Y_SIZE 24 28 29 30 typedef struct LINE_BUF_s 31 { 32 int buf[LINE_BUF_X_SIZE]; 33 u16 col[LINE_BUF_X_SIZE]; 34 int last_count; 35 int cur_count; 36 struct LINE_BUF_s *prev; 37 struct LINE_BUF_s *next; 38 } 39 LINE_BUF; 40 41 typedef struct 42 { 43 int *num_x, *num_y; 44 LINE_BUF *start; 45 LINE_BUF *cur; 46 } 47 TEXT_BUF; 48 49 50 51 52 typedef struct 53 { 54 TEXT_BUF text_buf; 55 u16 *screen; 56 u16 x_line; 57 u16 y_line; 58 u16 palette; 59 u16 padding; 60 } 61 TEXT_CTRL; 62 63 64 int init_text_buf_sys(void *heap_start, void *heap_end); 65 66 67 void m_putchar(TEXT_CTRL * tc, int c); 68 void m_set_palette(TEXT_CTRL * tc, u16 num); 69 u16 m_get_palette(TEXT_CTRL * tc); 70 void init_text(TEXT_CTRL * tc, u16 *screen, u16 palette); 71 72 73 void text_buf_to_vram(TEXT_CTRL * tc); 74 75 76 extern TEXT_CTRL *tc[NUM_OF_SCREEN]; 77 78 void mfprintf(TEXT_CTRL * tc, const char *fmt, ...); 79 void mprintf(const char *fmt, ...); 80 81 #endif /* _TEXT_H_ */ 82