#ifndef __CHAR__ #define __CHAR__ /** * 文字列表示 * * @property str text * @property int posX * @property int posY * @property int size * @property bool exists */ #module \ Char #const CHAR_WIDTH 32 #const UNKNOWN 52 /** * コンストラクタ:文字列を生成する. * * @param int posX * @param int posY * @param str text */ #defcfunc local \ New \ int p_posX,\ int p_posY,\ str p_text If insNum <= 0 { SDim charDict, 384 SDim text, 1024 BLoad "dict.dat", charDict } text.insNum = p_text posX.insNum = p_posX posY.insNum = p_posY size.insNum = CHAR_WIDTH exists.insNum = True insNum++ Return insNum - 1 /** * 文字列を非表示にする. * * @return void */ #deffunc local \ Destroy \ int p_insId exists.p_insId = False Return /** * 文字列を描画する. * * @var int cnt * @var bool found * @var double zoom * @return void */ #deffunc local \ Draw \ local l_cnt,\ local l_found Repeat insNum If exists.cnt { l_cnt = cnt Repeat StrLen (text.l_cnt) / 3 l_found = MyInStr (charDict, 0, StrMid (text.l_cnt, cnt * 3, 3)) / 3 If darw_found < 0 { l_found = UNKNOWN } Pos posX.l_cnt + cnt * size.l_cnt, posY.l_cnt l_zoom = Double (size.l_cnt) / CHAR_WIDTH CelPut BUFFER_CHAR, l_found, l_zoom, l_zoom Loop } Loop Return #defcfunc local \ MyInStr \ str p_haystack,\ int p_offset,\ str p_needle myInStr_haystack = p_haystack myInStr_flag = True Repeat StrLen (myInStr_haystack) / 3 SDim myInStr_work, 3 myInStr_cnt = cnt Repeat 3 Poke myInStr_work, cnt, Peek (myInStr_haystack, myInStr_cnt * 3 + cnt) Loop If myInStr_work = p_needle { myInStr_flag = False Break } Loop If myInStr_flag { Return -1 } Return myInStr_cnt * 3 #defcfunc local \ MyStrMid \ str p_string,\ int p_offset,\ int p_length,\ int p_test myStrMid_string = p_string SDim myStrMid_return, p_length Return myStrMid_return #global #endif ; not __CHAR__