diff --git a/main.hsp b/main.hsp index c8df666..24ab00f 100644 --- a/main.hsp +++ b/main.hsp @@ -32,6 +32,7 @@ #include "./modules/goatoh.mod.hsp" #include "./modules/chat.mod.hsp" +#include "./modules/char.mod.hsp" #ifdef _DEBUG @@ -66,8 +67,8 @@ CelLoad "goatoh-tarso.png", BUFFER_GOATOH_TARSO CelDiv BUFFER_GOATOH_TARSO, 0, 0, 97, 49 - CelLoad "char.png", BUFFER_CHAR - CelDiv BUFFER_CHAR, 32, 32, 0, 0 + CelLoad "font.png", BUFFER_CHAR + CelDiv BUFFER_CHAR, 32, 35, 0, 0 ; ゴートうインスタンス生成 Goatoh = New@Goatoh (960, 800, DIRECTION_LEFT) @@ -82,6 +83,13 @@ GMode GMODE_RGB0 ; アルファあり + Pos 100, 100 + NoteSel test + NoteLoad "test.txt" + NoteUnsel + Text = New@Char (test) + size@Char.Text = 240 + Repeat ReDraw False Pos 0, 0 @@ -94,6 +102,8 @@ Print StrF ("gInfo_winY: %4d", gInfo_winY) Print StrF ("gInfo_dispX: %4d", gInfo_dispX) Print StrF ("gInfo_dispY: %4d", gInfo_dispY) + + Draw@Char ReDraw True Await LOOP_INTERVAL diff --git a/modules/char.mod.hsp b/modules/char.mod.hsp index b8ccd5e..1d5c5bf 100644 --- a/modules/char.mod.hsp +++ b/modules/char.mod.hsp @@ -1,18 +1,63 @@ #module \ Char +#const CHAR_WIDTH 32 +#const UNKNOWN 52 + #defcfunc local \ New \ str p_text + If insNum <= 0 { + NoteSel charDict + NoteLoad "dict.dat" + NoteUnsel + } + text.insNum = p_text + posX.insNum = gInfo_cX + posY.insNum = gInfo_cY + size.insNum = CHAR_WIDTH + + exists.insNum = True + insNum++ Return insNum - 1 #deffunc local \ -Put \ +Destroy \ int p_insId + exists.insNum = False + + Return + +#deffunc local \ +Draw \ + local cnt_,\ + local found,\ + local zoom + Repeat insNum + If exists.cnt { + cnt_ = cnt + + NoteSel charDict + Repeat StrLen (text.cnt_) / 3 + Pos posX.cnt_ + cnt * size.cnt_, posY.cnt_ + + found = NoteFind (StrMid (text.cnt_, cnt * 3, 3)) + + If (found = -1) { + found = UNKNOWN + } + + zoom = Double (size.cnt_) / CHAR_WIDTH + CelPut BUFFER_CHAR, found, zoom, zoom + Loop + NoteUnsel + } + Loop + Return #global diff --git a/userdef.as b/userdef.as new file mode 120000 index 0000000..c7d930e --- /dev/null +++ b/userdef.as @@ -0,0 +1 @@ +G:/マイドライブ/hsp-mod/userdef.as \ No newline at end of file