TwlIPL/build/tests/DispOwnerInfo/include/fnt/fnt_struct.h
yosiokat 52325f1afa DispOwnerInfoテストプログラムの追加。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2820 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2009-05-20 10:14:53 +00:00

225 lines
7.1 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef FNT_STRUCT_H_
#define FNT_STRUCT_H_
/** --------------------------------------------------------------------
セル情報構造体
----------------------------------------------------------------------*/
typedef struct tagFntCellInfo
{
u16 width : 5; // 最大32
u16 height : 5; // 最大32
u16 dummy : 6;
} tFntCellInfo;
/** --------------------------------------------------------------------
幅情報構造体
----------------------------------------------------------------------*/
typedef struct tagFntWidthEntry
{
u16 offset : 8; // オフセット(書きはじめまでのピクセル数)
u16 width : 8; // 幅
} tFntWidthEntry;
/** --------------------------------------------------------------------
フォントCMAPの連続領域用構造体
----------------------------------------------------------------------*/
typedef struct tagFntCtEntry
{
u16 start;
u16 end;
} tFntCtEntry;
/** --------------------------------------------------------------------
フォント管理構造体
----------------------------------------------------------------------*/
typedef struct tagFntEntry
{
const u16* font_image; // フォントイメージへのポインタ
const u16* cmap; // コード->glyph変換用cmapへのポインタ
tFntCtEntry* ctmap; // コード->glyph変換用cmapへのポインタ
tFntWidthEntry* width_table; // 幅テーブル
u16 glyph_num; // glyph数
u16 default_glyph; // 見つからなかったときに使われる文字のglyph
s16 cell_size; // 一文字のセルサイズ(ワード単位)
tFntCellInfo cell_info; // セルの情報
u16 cmap_num; // glyph_comp == 1のときのcmapの数
u16 ctmap_num; // glyph_comp == 1のときのctmapの数
u32 glyph_sort : 1; // グリフがソートされているかどうか
u32 glyph_comp : 1; // グリフの連続されている部分が圧縮されているかどうか
} tFntEntry;
/** --------------------------------------------------------------------
描画する先のデバイスコンテキスト管理構造体
----------------------------------------------------------------------*/
typedef struct tagFntDrawContext
{
u16* canvas;
u16 width;
u16 height;
u16 canvas_type;
u8 pad[2];
tFntEntry* font;
} tFntDrawContext;
/** --------------------------------------------------------------------
レイアウト表示用の構造体
----------------------------------------------------------------------*/
/** --------------------------------------------------------------------
レイアウトヘッダー
----------------------------------------------------------------------*/
typedef struct tagFntLayoutHeader
{
u8 name[4];
u16 version;
u16 table_num;
} tFntLayoutHeader;
/** --------------------------------------------------------------------
CMAPヘッダー
----------------------------------------------------------------------*/
typedef struct tagFntCmapHeader
{
u32 ct_offset;
u32 cm_offset;
} tFntCmapHeader;
/** --------------------------------------------------------------------
レイアウト表示のためのメッセージ構造体
----------------------------------------------------------------------*/
typedef struct tagFntPosition
{
s16 pos : 12;
u16 pos_origin : 2;
u16 text_align : 2;
} tFntPosition; // この宣言でも、2Bytesにきちんと収まる。処理系によっては、sizeof()でチェックすること。
/** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
文字レイアウトを表示するための構造体。
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/** --------------------------------------------------------------------
メッセージ構造体
メッセージデータは、
tFntLayoutHeader header;
tFntMessage message[header.table_num];
で構成されます。
----------------------------------------------------------------------*/
typedef struct tagFntMessage
{
// 位置
tFntPosition x;
tFntPosition y;
// 文字間隔
s16 spacing_x : 8;
s16 spacing_y : 8;
// 色
u16 color : 8;
u16 palette : 4;
u16 font : 4;
// メッセージへのオフセット
u32 offset;
} tFntMessage;
/** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
OBJのセルを扱うための構造体
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/** --------------------------------------------------------------------
セル情報構造体
セルデータは、
tFntLayoutHeader header;
tFntCell cell[header.table_num];
で構成されます。
----------------------------------------------------------------------*/
typedef struct tagFntCell
{
// 位置
tFntPosition x;
tFntPosition y;
// セルキャラクタへのインデックス
u32 cell_index;
} tFntCell;
/** --------------------------------------------------------------------
セルキャラクタ情報構造体
セルキャラクタデータは、
tFntLayoutHeader header;
tFntCellCharHeader char_header;
tFntCellCharInfo cellchar_info[header.table_num];
tFntCellCharOam cellchar_oam[];
u16 char_data[];
で構成されます。
----------------------------------------------------------------------*/
/** --------------------------------------------------------------------
セルキャラクタヘッダ
----------------------------------------------------------------------*/
typedef struct tagFntCellCharHeader
{
u32 cell_offset; // tFntCellChar配列へのオフセット
u32 oam_offset; // tFntOamChar配列へのオフセット
u32 char_offset; // キャラクタデータへのオフセット
u32 char_size; // キャラクタデータのサイズ
u32 char_mode : 3; // OBJVRAMMODE_CHAR_1DのEXOBJフラグ
} tFntCellCharHeader;
/** --------------------------------------------------------------------
セルキャラクタ情報
----------------------------------------------------------------------*/
typedef struct tagFntCellCharInfo
{
u16 width : 8; // セルの大きさ情報。
u16 height : 8;
u16 oam_index; // oam_offset[oam_index] から、
u16 oam_num; // oam_num分だけのoamを使用します。
} tFntCellCharInfo;
/** --------------------------------------------------------------------
OAM情報
----------------------------------------------------------------------*/
typedef struct tagFntCellCharOam
{
GXOamAttr attr; // CharNameの部分は、使用しません。ロード位置をユーザ定義にするため。
u16 char_index; // キャラクタデータのインデックス。
u16 char_num; // キャラクタデータの数。最大、64ぐらい
} tFntCellCharOam;
/** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
タッチの場所を取得するための構造体
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/** --------------------------------------------------------------------
リージョン情報
----------------------------------------------------------------------*/
typedef struct tagFntRegion
{
// 位置
tFntPosition x;
tFntPosition y;
// サイズ
u16 width : 8; // セルの大きさ情報。
u16 height : 8;
} tFntRegion;
#endif // FNT_STRUCT_H_