Ok Image Fonts are used alot in video games, so does BlitzBasicPlus come with some kind of gispmo or command to load a set of images as a font. Instead of doing If var = 1 then load and display image for 1. Thank you all in advance.
Image Fonts
Blitz3D Forums/Blitz3D Beginners Area/Image Fonts Hi Folks,
Jono, you can use LoadImage (with a parameter giving the number of frames) to load a strip of images and just use the anim index when you want to display it, so
Something like that, anyway.
Later,
Jes
Jono, you can use LoadImage (with a parameter giving the number of frames) to load a strip of images and just use the anim index when you want to display it, so
; Something like frames = 32 ; number of frames in strip font_pic = loadimage("fontpic.bmp",width,height,frames) index = 5 DrawImage font_pic, 0,0,index ; would draw 'E' if using the A=1
Something like that, anyway.
Later,
Jes
There are many libraries that do this kind of thing such as FontText (in the links section) and there is also a free one on BlitzCoder called FontLib. (I think)
Regards
Jason.
Regards
Jason.
lil sample code by moi...
If your gonna work on demo's n stuff plz use ur own fonts...And not the one below...IT'S MINE all MINE!
use this image with the demo :
If your gonna work on demo's n stuff plz use ur own fonts...And not the one below...IT'S MINE all MINE!
Graphics 320,110,32,2 SetBuffer BackBuffer() Global FNTHEIGHT% = 8 Global FNTNAME% = LoadAnimImage("fnt_64x64W.png",8,FNTHEIGHT%,0,64):MaskImage(FNTNAME%,255,0,255) While Not KeyHit(1) DrawFnt(20,20,"Hello World!"+Chr(13)+"Hey this is cool..."+Chr(13)+Chr(13)+"The font was made with FonText.") DrawFnt(20,45,Chr(13)+Chr(13)+Chr(13)+Chr(13)+"Created by darklordz") Flip Wend End ;Draw BMFonts Function DrawFnt(Start_X,Start_Y,TextString$) StartX = Start_X StartY = Start_Y TextString$ = Upper(TextString$) While Len(TextString$) > 0 .Redo TextLength = Len(TextString$) Tmp$ = Left(TextString$,1) If TextLength-1 < 0 Exit EndIf TextString$ = Right(TextString$,TextLength-1) Frame = Asc(Tmp$)-33 If Tmp$ = Chr(32) ; SPACE StartX = StartX + FNTHEIGHT% Goto Redo ElseIf Tmp$ = Chr(13) Then ; LINEBREAK StartY = StartY + FNTHEIGHT% StartX = Start_X Else DrawImage FNTNAME,StartX,StartY,Frame StartX = StartX + FNTHEIGHT% EndIf Wend End Function
use this image with the demo :
darklordz, nice sample :-D
Thanks for the code and font...
/me runs off to make ungodly demos of which the likes you've never seen! muhahahahhahahahahahaha
/me runs off to make ungodly demos of which the likes you've never seen! muhahahahhahahahahahaha
lol@ paradox.