/*
 * $Id: bg_attr1.h,v 1.1 2003/02/07 18:15:44 wheeler Exp $
 * $Log: bg_attr1.h,v $
 * Revision 1.1  2003/02/07 18:15:44  wheeler
 * Fox's version of libultra and friends.
 *
 * Revision 1.3  1996/11/21  05:20:19  hayakawa
 * 型定義を別ヘッダに移動
 *
 * Revision 1.2  1996/10/24  01:04:51  hayakawa
 * c++対応
 *
 */

#ifndef __BG_ATTR1_H_
#define __BG_ATTR1_H_

#include "bg_attr_sc.h"
#include "bg_bitmap1x.h"	/* BG_Bitmap1x */
#include "zpos_t.h"		/* zpos_t */
#include "u64types.h"		/* size_t */

/*
 * ＢＧアトリビュート定義構造体
 * 
 */
typedef struct bg_attr1_s {
    void 		*scData; /* ＳＣデータへのポインタ */
    BG_Bitmap1x 	*bitmap; /* ビットマップ属性へのポインタ */
    unsigned int 	scType:1; /* ＳＣデータのタイプ 16/32 */
    unsigned char 	xSiz:8;	/* 横キャラクタ数 1-255 */
    unsigned char 	ySiz:8;	/* 縦キャラクタ数 1-255 */
    signed short 	xPos:16; /* *ホットスポットの座標  */
    signed short 	yPos:16; /* *ホットスポットの座標  */
    zpos_t 		zPos;	/* 優先度(Z座標) */
    unsigned long 	attr;	/* ＢＧのアトリビュート */
    float 		xScale;	/* *縮尺X: 1.0 = 原寸 */
    float 		yScale;	/* *縮尺Y: 1.0 = 原寸 */
    void 		*expand; /* 拡張アトリビュートへのポインタ */
} BG_Attribute1;


#ifdef __cplusplus
extern "C" {
#endif

void
bg1_draw(
    BG_Attribute1 *const bg1,
    Gfx **glistpp		/* ディスプレイリストへのポインタのポインタ */
);
#define bg1_isenable(p1) 	(!((p1)->attr & BG_HIDDEN))
#define bg1_enable(p1) 		((p1)->attr &= ~BG_HIDDEN)
#define bg1_disable(p1) 	((p1)->attr |= BG_HIDDEN)
#define bg1_setPosition(p1, x1, y1)\
				((p1)->xPos = (signed short)(x1), (p1)->yPos = (signed short)(y1))
#define bg1_setScale(p1, x1, y1)\
    				((p1)->xScale = (x1), (p1)->yScale = (y1))
#define bg1_SetAttribute( bg1, attr1 ) ( (bg1)->attr = (attr1) )
#define bg1_GetAttribute( bg1 ) ( (bg1)->attr )
#define bg1_AddAttribute( bg1, attr1 ) ( (bg1)->attr |= (attr1) )
#define bg1_SubAttribute( bg1, attr1 ) ( (bg1)->attr &= ~(attr1) )
void
bg1_flip(
    BG_Attribute1 *const bg1,
    const int fliph,		/* 左右反転フラグ 0/1 */
    const int flipv		/* 上下反転フラグ 0/1 */
);
void
bg1_init(
    BG_Attribute1 *const bg1,	
    const int hsize,		/* 横のキャラクタ数 */
    const int vsize,		/* 縦のキャラクタ数 */
    BG_Bitmap1x	*const bm1,	/* 対応するビットマップ番号 */
    void *const sc1,		/*  */
    const int z			/*  */
);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* __BG_ATTR1_H_ */
