Skip to content

Commit 18512bf

Browse files
committed
Update bmfontloader.bas
1 parent 35ceb42 commit 18512bf

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

QB64PE/BMFont Loader/bmfontloader.bas

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Screen _NewImage(800, 600, 32)
1111
LoadBMFont fntFile$, pngFile$
1212
Line (0, 0)-(100, 100), _RGB32(255, 0, 0), BF
1313

14-
PrintBMF 20, 20, "Hello from QB64-PE BMFont!", _RGB32(255, 255, 0)
14+
PrintBMF 20, 20, "Hello from QB64-PE BMFont! ", _RGB32(255, 255, 0)
15+
'PrintBMFGlyph 140, 40, Chr$(0) + Chr$(1), 1
1516

1617
Print "Press any key to quit"
1718
Sleep
@@ -111,5 +112,17 @@ Sub PrintBMF (x%, y%, txt$, col&)
111112
Next
112113
End Sub
113114

115+
Sub PrintBMFGlyph (x%, y%, txt$, scale!)
116+
cx% = x%
117+
For i% = 1 To Len(txt$)
118+
c% = Asc(Mid$(txt$, i%, 1))
119+
_PUTIMAGE (cx% + fontChar(c%).xo * scale!, y% + fontChar(c%).yo * scale!)- _
120+
(cx%+ (fontChar(c%).xo + fontChar(c%).w) * scale! - 1, _
121+
y% + (fontChar(c%).yo + fontChar(c%).h) * scale! - 1), fontTex&, , _
122+
(fontChar(c%).x, fontChar(c%).y)- _
123+
(fontChar(c%).x + fontChar(c%).w - 1, fontChar(c%).y + fontChar(c%).h - 1)
124+
cx% = cx% + fontChar(c%).xadv * scale!
125+
Next
126+
End Sub
114127

115128

0 commit comments

Comments
 (0)