From: | Thorsten Will |
Date: | 13 Mar 2001 at 21:28:01 |
Subject: | How to optimize...? |
Message to..: "blitz-list@netsoc.ucd.ie"
Message from: "twill@gmx.de"
Subject.....: "How to optimize...?"
I coded a small routine to print text with diferent Fonts (8x8 and 16x16)
in any color on Bitmap... It works but it is really to slow and the code
doesnt looks great, because of the "Goto Loop1" ;((( I dont have any ideas
how to fix the "Goto Loop1" (Pop If, is missing!) and how to speed it up...
The text will be printed on a 640x256*8 Bitmap... I use the "%" sign to
check what kind of font or color i must print out the next charset...
Statement MyShowText{adr.l} ; y and x are pos of TextPrint
y=0:x=0:txtc=255 ; txtc is the color of Font
;
For mem.l=0 To 50*30+88 ; PrintText is 50*30
If NPeekB(mem.l+adr.l)=$a Then y+8:mem.l+1:x=0
; $a = Return
;
;
If NPeekB(mem.l+adr.l)=$25:mem.l+1:chg=1
; $25 = %
If NPeekB(mem.l+adr.l)=$30 AND chg=1 Then txtf=0:mem.l+1:chg=0
; %0 = 8x8 Font
;
;
If NPeekB(mem.l+adr.l)=$31 AND chg=1
; %1 = 16x16 Font
loop1: ; very bad!!!!!
txtf=1:mem.l+1:chg=0 ; Where is "Pop If" ;(
a$=a$+NChr$(NPeekB(mem.l+adr.l))
If NPeekB(mem.l+adr.l)<>$25 Then Goto loop1 Else mem.l+1
EndIf
;
If NPeekB(mem.l+adr.l)=$61 AND chg=1 Then
txtc=255:mem.l+1:chg=0 ; %a = color1
If NPeekB(mem.l+adr.l)=$62 AND chg=1 Then
txtc=254:mem.l+1:chg=0 ; %b = color2
If NPeekB(mem.l+adr.l)=$63 AND chg=1 Then
txtc=253:mem.l+1:chg=0 ; %c = color3
;
EndIf
;
Select txtf
Case 0
FNSPrint txtf,220+x,y,NChr$(NPeekB(mem.l+adr.l)),0,txtc:x+8
Case 1
i=NLen(a$)
b$=NLeft$(a$,i-1)
FNSPrint txtf,220+x,y,b$,0,txtc
End Select
Next mem
End Statement
I use following Stuff for FNSPrint....
InstallFNS 0,?Font1 ; Init our 8*8 Font
InstallFNS 1,?Font2 ; Init our x*16 Font (x is not ever the same)
FNSPrefs 0,25 ; 25 = Color
FNSOutput db,1 ; db = Print to DoubleBuffering Bitmap
Is there any way to optimize my Statement and add some more of the FNS
commands... Because i dont know all the commands ;(
Thanks in advance, if you could help me...
Thorsten
---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list/-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list/-help@netsoc.ucd.ie