March 06, 2021, 05:42:22 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Like stats
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bmx] font to defdata by Jesse [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bmx] font to defdata by Jesse [ 1+ years ago ] (Read 486 times)
BlitzBot
Jr. Member
Posts: 1
Total likes: 0
[bmx] font to defdata by Jesse [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:40 AM »
Title :
font to defdata
Author :
Jesse
Posted :
1+ years ago
Description :
converts a string of characters using current font into a defdata bmx program to be included in a game. I hope it helps someone.
Code :
Code: BlitzMax
Function
bittext
(
capital$,name$
)
CreateFile
(
name$
)
Local
file:TStream = OpenFile
(
name$
)
If
file =
Null
End
For
Local
i% =
0
To
capital.length-
1
Cls
Local
width% = TextWidth
(
Chr
(
capital
[
i
]
)
)
Local
Height% = TextHeight
(
Chr
(
capital
[
i
]
)
)
DrawText
Chr
(
capital
[
i
]
)
,
0
,
0
Local
pixmap:TPixmap = GrabPixmap
(
0
,
0
,width,height
)
WriteString file,
"defdata "
+
String
(
width
)
+
" ,"
+
String
(
height
)
+
"' "
+
Chr
(
capital
[
i
]
)
+
"~r~n"
For
Local
y% =
0
To
height -
1
Local
text$=
"Defdata "
For
Local
x% =
0
To
width-
1
Local
color% =ReadPixel
(
pixmap,x,y
)
& $fff
If
x
Then
text = text+
","
If
color
Then
text=text+
"1"
Else
text = text+
"0"
SetColor
200
,
100
,
0
If
color DrawRect x*
(
5
)
,y*
(
5
)
,
4
,
4
Next
text = text +
"~r~n"
WriteString file,text
Next
Flip
(
)
Delay
(
50
)
Next
CloseFile file
Print
"program saved as"
+name
End
Function
Graphics
1024
,
768
,
32
Local
letters$=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Local
numsymb$ =
"0123456789!@#$%&()-+*/^_="
bittext
(
letters,
"letters.bmx"
)
bittext
(
numsymb,
"numsymb.bmx"
)
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bmx] font to defdata by Jesse [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal