/*
 * $Id: gfxprint.h,v 1.1 2003/02/07 18:15:44 wheeler Exp $
 *
 * 画面への端末風文字表示
 *
 * $Log: gfxprint.h,v $
 * Revision 1.1  2003/02/07 18:15:44  wheeler
 * Fox's version of libultra and friends.
 *
 * Revision 1.2  1997/03/05  05:31:39  hayakawa
 * 虹色文字に対応
 *
 * Revision 1.1  1997/02/14  00:53:26  hayakawa
 * Initial revision
 *
 */

#ifndef __GFXPRINT_H_
#define __GFXPRINT_H_

#include "ultra64.h"
#include "u64types.h"
#include <stdarg.h>		/* va_list, va_start, va_end */

#ifdef __cplusplus
extern "C" {
#endif

typedef struct gfxprint_s {
    void (*prout_func)(void *, const char *, int);
    /* この後ろは描画関数用のデータ */
    Gfx *glistp;
    int opened;			/* !0:オープンされている */
    int position_x;		/* サブピクセル単位の表示座標 */
    int position_y;		/* サブピクセル単位の表示座標 */
    rgba8888_u_t color;
    int hiragana_mode;		/* !0:半角カタカナを半角ひらがなにする */
    int gradetion;		/* グラデーション表示 */
} gfxprint_t;

void gfxprint_color( gfxprint_t *this, unsigned int r, unsigned int g, unsigned int b, unsigned int a );

void gfxprint_locate( gfxprint_t *this, int x, int y );
void gfxprint_locate8x8( gfxprint_t *this, int x, int y );

void gfxprint_putc( gfxprint_t *this, char c );
void gfxprint_write( gfxprint_t *this, const void *buffer, size_t size, size_t n );
void gfxprint_puts( gfxprint_t *this, char *string );

void gfxprint_init(gfxprint_t *this);
void gfxprint_cleanup(gfxprint_t *this);

void gfxprint_open(gfxprint_t *this, Gfx *glistp);
Gfx *gfxprint_close(gfxprint_t *this);

int gfxprint_vprintf(gfxprint_t *this, const char *fmt, va_list ap);
int gfxprint_printf(gfxprint_t *this, const char *fmt, ...);

#define Gfxprint_color(r, g, b, a)	gfxprint_color(gfxprint, r, g, b, a)  
#define Gfxprint_locate(x, y)		gfxprint_locate(gfxprint, x, y)     
#define Gfxprint_locate8x8(x, y)	gfxprint_locate8x8(gfxprint, x, y)  

#define Gfxprint_putc(c)		gfxprint_putc(gfxprint, c)         
#define Gfxprint_write(b, s, n)		gfxprint_write(gfxprint, b, s, n)    
#define Gfxprint_puts(s)		gfxprint_puts(gfxprint, s)         

#define Gfxprint_init()			gfxprint_init(gfxprint)          
#define Gfxprint_cleanup()		gfxprint_cleanup(gfxprint)       
#define Gfxprint_open(glistp)		gfxprint_open(gfxprint, glistp)    
#define Gfxprint_close()		gfxprint_close(gfxprint)         

#define Gfxprint_vprintf(fmt, ap)	gfxprint_vprintf(gfxprint, fmt, ap)
#define Gfxprint_printf(fmt)		gfxprint_printf(gfxprint, fmt)

#define GP_KATA "\214"
#define GP_HIRA "\215"
#define GP_GRADETION_ON "\213"
#define GP_GRADETION_OFF "\212"

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* __GFXPRINT_H_ */
