JUICY FONTS input code?

Blitz3D Forums/Blitz3D Beginners Area/JUICY FONTS input code?

jigga619(Posted 2008) [#1]
Finally I have learned how to use JUICY FONTS for bitmap fonts. My question is this

Being that

jf_text(my_font,10,10,"Hello World!")

Would print
Hello World, using a bitmap font

How do I accept a user’s INPUT using the BITMAP font ? For example how would I make a program print

“PLEASE ENTER YOUR NAME?” and allow the user to enter their name on that line.


AS of now, when I do a user input, blitz3d goes BACK and uses the default font (ARIAL), not the bitmap font I loaded.

How can I use the current BITMAP font and accept a user input?


GfK(Posted 2008) [#2]
This isn't a question that's specific to Juicyfonts.

You need to manually take user input from KeyHit(), and add the corresponding characters to a string, which is then passed to JF_Text for printing.

KeyHit() uses keycodes though - not ASCII codes. There might be something in the code archives to convert from one to the other.

[edit] One of several examples: http://www.blitzbasic.com/codearcs/codearcs.php?code=2006


big10p(Posted 2008) [#3]
As Gfk says, you need to code your own input routine which is advisible anyway as Input$ isn't very robust.


Kryzon(Posted 2008) [#4]
Use GetKey(). It doesn't halt the program and returns the ASCII code.

You should make a loop, and keep adding to a string every Chr(Ascii) value the GetKey() returns.

While not [...]

ASCII = GetKey()
If ASCII Then Message$ = Message$ + Chr(ASCII)

Wend