Browse Source

文字

main
Miteruzo 1 year ago
parent
commit
83bd8c0772
3 changed files with 59 additions and 3 deletions
  1. +12
    -2
      main.hsp
  2. +46
    -1
      modules/char.mod.hsp
  3. +1
    -0
      userdef.as

+ 12
- 2
main.hsp View File

@@ -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


+ 46
- 1
modules/char.mod.hsp View File

@@ -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


+ 1
- 0
userdef.as View File

@@ -0,0 +1 @@
G:/マイドライブ/hsp-mod/userdef.as

Loading…
Cancel
Save