#module
#deffunc wordchk val, int
mref txt, 24 : mref ichi, 1
mref stt, 64
peek chk, txt, ichi
if chk = 0 : stt = -1 : return
if (chk > 128 & (chk < 160)) | (chk > 223) : stt = 1 : else : stt = 0
return
#deffunc textmes val, int, int, int
mref string, 24 : mref speed1, 1 : mref speed2, 2 : mref speed3, 3
mref bmscr, 67
strlen len, string
cx = csrx : cx.1 = cx : cy = csry
repeat len
sp = 0
wordchk string, cnt
strmid tmps, string, cnt, stat + 1
// 1バイト
if stat = 0 {
// 改行
if chk = 13 {
peek chk, string, cnt + 1
cx = cx.1 : cy += bmscr.32 // 文字の高さ分増やす
continue cnt + (chk = 10) + 1
}
if tmps = "," : sp = speed2 // 読点
if tmps = "." : sp = speed3 // 句点
// 2バイト
} else {
if tmps = "、" : sp = speed2 // 読点
if tmps = "。" : sp = speed3 // 句点
}
pos cx, cy : mes tmps
cx += bmscr.32 / (2 - stat) // 文字幅(高さ÷2)を取得しカレントポジションの変更
memset tmps, , 4
if speed1 + sp > 0 : wait speed1 + sp
continue cnt + stat + 1
loop
pos cx.1, cy + bmscr.32
return
#global
sdim txt, 256
txt = {"
ゆっくりテキストを表示させてみるテストです。
読点(テン)では通常以上のウェイトを掛け、
句点(マル)ではさらに、さらにウェイトを掛けています。
補足ですが、半角のカンマ「,」も読点として、
ピリオド「.」を句点として同じ様にウェイトを掛けています。
"}
pos 50, 50 : textmes txt // 徐々にではなく、ウェイトを掛けず一括表示する
color 255
pos 50, 50 : textmes txt, 5, 30, 70 // 通常:50ms 読点:350ms 句点:750ms
color
mes "- 完 -"
stop
|