#defcfunc の中では,ほかの #defcfunc で宣言された関数を利用できなぃらしぃ.

This commit is contained in:
2023-07-10 01:24:27 +09:00
parent 6c894c9bde
commit f148df36ed
4 changed files with 82 additions and 127 deletions
+1 -90
View File
@@ -1,90 +1 @@
いうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもや(ゆ)よらりるれろわゐーゑをん!?・…がぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽぁぃぅぇぉゃ,ゅ.ょ
+6 -4
View File
@@ -43,6 +43,8 @@
ChDir "assets" ChDir "assets"
#endif ; not _DEBUG #endif ; not _DEBUG
Font MSGOTHIC, 96
ViewCalc VPTYPE_2D, Double (gInfo_winX) / DISPLAY_WIDTH, Double (gInfo_winY) / DISPLAY_HEIGHT ViewCalc VPTYPE_2D, Double (gInfo_winX) / DISPLAY_WIDTH, Double (gInfo_winY) / DISPLAY_HEIGHT
; 背景 ; 背景
@@ -87,10 +89,7 @@
Show@Keyboard Show@Keyboard
Pos 100, 100 Pos 100, 100
NoteSel test Text = New@Char ("")
NoteLoad "test.txt"
NoteUnsel
Text = New@Char (test)
size@Char.Text = 240 size@Char.Text = 240
Repeat Repeat
@@ -101,6 +100,9 @@
Draw@Goatoh Goatoh Draw@Goatoh Goatoh
Draw@Char Draw@Char
Draw@Keyboard Draw@Keyboard
a = GetChar@Keyboard ()
text@Char.Text = text@Keyboard
ReDraw True ReDraw True
Await LOOP_INTERVAL Await LOOP_INTERVAL
+57 -19
View File
@@ -8,9 +8,10 @@ Char
New \ New \
str p_text str p_text
If insNum <= 0 { If insNum <= 0 {
NoteSel charDict SDim charDict, 384
NoteLoad "dict.dat" SDim text, 1024
NoteUnsel
BLoad "dict.dat", charDict
} }
text.insNum = p_text text.insNum = p_text
@@ -34,31 +35,68 @@ Destroy \
#deffunc local \ #deffunc local \
Draw \ Draw \
local cnt_,\ local l_cnt,\
local found,\ local l_found
local zoom
Repeat insNum Repeat insNum
If exists.cnt { If exists.cnt {
cnt_ = cnt l_cnt = cnt
NoteSel charDict Repeat StrLen (text.l_cnt) / 3
Repeat StrLen (text.cnt_) / 3 l_found = MyInStr (charDict, 0, StrMid (text.l_cnt, cnt * 3, 3)) / 3
Pos posX.cnt_ + cnt * size.cnt_, posY.cnt_
found = NoteFind (StrMid (text.cnt_, cnt * 3, 3)) If darw_found < 0 {
l_found = UNKNOWN
}
If found = -1 { Pos posX.l_cnt + cnt * size.l_cnt, posY.l_cnt
found = UNKNOWN l_zoom = Double (size.l_cnt) / CHAR_WIDTH
} CelPut BUFFER_CHAR, l_found, l_zoom, l_zoom
Loop
zoom = Double (size.cnt_) / CHAR_WIDTH
CelPut BUFFER_CHAR, found, zoom, zoom
Loop
NoteUnsel
} }
Loop Loop
Return 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 #global
+18 -14
View File
@@ -15,33 +15,37 @@ Hide
Return Return
#defcfunc local \ #defcfunc local \
GetChar \ GetChar
local l_ids,\
local l_touchInfo,\
local l_charId,\
local l_char
if showing = False { if showing = False {
Return "" Return ""
} }
MTList l_id MTList getChar_id
If stat = 0 { If stat = 0 {
touching = False
Return "" Return ""
} }
MTInfo l_touchInfo, l_id.0 If touching {
If l_touchInfo.2 < 1920 - 480 {
Return "" Return ""
} }
l_charId = (1080 - l_touchInfo.1) / 96 * 5 + (l_touchInfo.2 - (1920 - 480)) / 96 MTInfo getChar_touchInfo, getChar_id.0
NoteSel charDict@Char If getChar_touchInfo.2 < 1920 - 480 {
NoteGet l_char, l_charId Return ""
text += l_char }
NoteUnsel
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
touching = True
Return "" Return ""