diff --git a/assets/dict.dat b/assets/dict.dat index 3fe368d..687184f 100644 --- a/assets/dict.dat +++ b/assets/dict.dat @@ -1,90 +1 @@ -あ -い -う -え -お -か -き -く -け -こ -さ -し -す -せ -そ -た -ち -つ -て -と -な -に -ぬ -ね -の -は -ひ -ふ -へ -ほ -ま -み -む -め -も -や -( -ゆ -) -よ -ら -り -る -れ -ろ -わ -ゐ -ー -ゑ -を -ん -! -? -・ -… -が -ぎ -ぐ -げ -ご -ざ -じ -ず -ぜ -ぞ -だ -ぢ -づ -で -ど -ば -び -ぶ -べ -ぼ -ぱ -ぴ -ぷ -ぺ -ぽ -ぁ -ぃ -ぅ -ぇ -ぉ -ゃ -, -ゅ -. -ょ +あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもや(ゆ)よらりるれろわゐーゑをん!?・…がぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽぁぃぅぇぉゃ,ゅ.ょ diff --git a/main.hsp b/main.hsp index 0cf9b15..322dc30 100644 --- a/main.hsp +++ b/main.hsp @@ -43,6 +43,8 @@ ChDir "assets" #endif ; not _DEBUG + Font MSGOTHIC, 96 + ViewCalc VPTYPE_2D, Double (gInfo_winX) / DISPLAY_WIDTH, Double (gInfo_winY) / DISPLAY_HEIGHT ; 背景 @@ -87,10 +89,7 @@ Show@Keyboard Pos 100, 100 - NoteSel test - NoteLoad "test.txt" - NoteUnsel - Text = New@Char (test) + Text = New@Char ("") size@Char.Text = 240 Repeat @@ -101,6 +100,9 @@ Draw@Goatoh Goatoh Draw@Char Draw@Keyboard + + a = GetChar@Keyboard () + text@Char.Text = text@Keyboard ReDraw True Await LOOP_INTERVAL diff --git a/modules/char.mod.hsp b/modules/char.mod.hsp index ff2c7b1..9e5a37b 100644 --- a/modules/char.mod.hsp +++ b/modules/char.mod.hsp @@ -8,9 +8,10 @@ Char New \ str p_text If insNum <= 0 { - NoteSel charDict - NoteLoad "dict.dat" - NoteUnsel + SDim charDict, 384 + SDim text, 1024 + + BLoad "dict.dat", charDict } text.insNum = p_text @@ -34,31 +35,68 @@ Destroy \ #deffunc local \ Draw \ - local cnt_,\ - local found,\ - local zoom + local l_cnt,\ + local l_found Repeat insNum If exists.cnt { - cnt_ = cnt - - NoteSel charDict - Repeat StrLen (text.cnt_) / 3 - Pos posX.cnt_ + cnt * size.cnt_, posY.cnt_ + l_cnt = cnt - found = NoteFind (StrMid (text.cnt_, cnt * 3, 3)) + Repeat StrLen (text.l_cnt) / 3 + l_found = MyInStr (charDict, 0, StrMid (text.l_cnt, cnt * 3, 3)) / 3 - If found = -1 { - found = UNKNOWN - } + If darw_found < 0 { + l_found = UNKNOWN + } - zoom = Double (size.cnt_) / CHAR_WIDTH - CelPut BUFFER_CHAR, found, zoom, zoom - Loop - NoteUnsel + 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 diff --git a/modules/keyboard.mod.hsp b/modules/keyboard.mod.hsp index 596266e..e6effbc 100644 --- a/modules/keyboard.mod.hsp +++ b/modules/keyboard.mod.hsp @@ -15,33 +15,37 @@ Hide Return #defcfunc local \ -GetChar \ - local l_ids,\ - local l_touchInfo,\ - local l_charId,\ - local l_char +GetChar if showing = False { Return "" } - MTList l_id + MTList getChar_id If stat = 0 { + touching = False + + Return "" + } + + If touching { Return "" } - MTInfo l_touchInfo, l_id.0 + MTInfo getChar_touchInfo, getChar_id.0 - If l_touchInfo.2 < 1920 - 480 { + If getChar_touchInfo.2 < 1920 - 480 { Return "" } - l_charId = (1080 - l_touchInfo.1) / 96 * 5 + (l_touchInfo.2 - (1920 - 480)) / 96 + getChar_charId = (1080 - getChar_touchInfo.1) / 96 * 5 + (getChar_touchInfo.2 - (1920 - 480)) / 96 + getChar_textLength = StrLen (text) + + Repeat 3 + Poke text, getChar_textLength + cnt, Peek (charDict@Char, getChar_charId * 3 + cnt) + Loop - NoteSel charDict@Char - NoteGet l_char, l_charId - text += l_char - NoteUnsel + touching = True Return ""