using bitmaps as text?
Blitz3D Forums/Blitz3D Beginners Area/using bitmaps as text?
| ||
Ok, im scrapping the whole TEXT command and want to use an animated bitmap instead to display text, How do you set up the code to do this?, Im still new to basic and the text command was "Faithfull" but now i fear im going to have to use for next loops etc :) Could someone Explain please.... |
| ||
You mean characters that keep animating once you've put them to the screen ? First you make a loader function for your own font, next you create a timer, and at each timer 'event' you overwrite your text again with another offset (using your own text command). Tho, to rip away slaveswork when updating this text, I suggest that you make a complete system where every line of text is stored in that system, then you make a function that automatically updates all pieces of text in your system .. I expect a few hundrede lines for all this.. |
| ||
U need something like this?Const wtext=8 Const htext=12 Global characters=LoadAnimImage("filewithtext.bmp",wtext,htext,32) Function text2(a,b,towrite$) For c=1 To Len(towrite) DrawImage characters,a+(c-1)*wtext,b,Asc(Mid(towrite,c,1)) Next End Function Place the characters in the .bmp file by ascii value order |
| ||
He wanted animated characters eBusiness. Infantry_Nutter, do what eBusiness said except load a few AnimImage's. Something like this: Const wtext=8 Const htext=12 Dim characters(3) Global characters(1)=LoadAnimImage("filewithtext.bmp",wtext,htext,32) Global characters(2)=LoadAnimImage("filewithtext2.bmp",wtext,htext,32) Global characters(3)=LoadAnimImage("filewithtext3.bmp",wtext,htext,32) Function text2(a,b,towrite$,animchar) For c=1 To Len(towrite) DrawImage characters(animchar),a+(c-1)*wtext,b,Asc(Mid(towrite,c,1)) Next End Function chartimer = Millisecs() ;Main loop While Not keyhit(1) If Millisecs() + 300 > chartimer chartimer = Millisecs() animchar = animchar + 1 - (3 * (animchar > 2)) EndIf Wend |
| ||
i use...it works as the text command only it uses a bitmapped font. Use fontext to create em and improve in ur fav image editing prog. example: while not keyhit(1) DrawFont%("Hey! Look @ Me"+Chr(13)+"Multiline!!!",20,20,FNT_MENU%,8) flip wend Global FNT_MENU% = LoadAnimImage("gfx\fnt_main_b.png",8,8,0,64) : MaskImage FNT_MENU%,255,0,255 Function DrawFont%(TSTR$,XP%,YP%,FNTNAME%,HEIGHT%=0) StartX = XP% StartY = YP% FNTNAME% = FNTNAME% TextString$ = Upper(TSTR$) 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) StartX = StartX + HEIGHT% Goto Redo ElseIf Tmp$ = Chr(13) Then StartY = StartY + HEIGHT%+2 StartX = XP% Else DrawImage FNTNAME%,StartX,StartY,Frame StartX = StartX + HEIGHT% EndIf Wend Return True End Function |
| ||
Thanks guys im gunna have to test these out Dan |
| ||
You may want to have a nose at this: http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=gillissie01022003212523&comments=no I think it is very good - you may find it of interest. |
| ||
I think AlphaGUI has a bitmap font creation program. |
| ||
Can i Somehow link the bitmap text to the Input Command, so when the user types, the the font displayed is the one ive drawn? Also Ive messed with the viewport command and really dont understand it at all, can you name viewports? or am I Just Been Totally Dumb? |
| ||
You want something like Wolron's code to select the correct anim sequence per letter. This can then be displayed as any other animated image. Viewports are entirely separate and is for the cameras : the area of the screen buffer to which 3D world is rendered. To have the user type in, AND have these images animated, you will need a loop, and a variable to keep track of the current characters entered... -Check for keypress and get key -Add keypress character to current word -Display Current word -Animate Current Word -Loop |