Code-Beispiel
DrawString-Routine (Ersatz für GfxPrint)
Lizenz: | Erster Autor: | Letzte Bearbeitung: |
LGPL | Volta | 17.02.2013 |
'fb_font_x.bas by Volta
'ab FB-Version 0.18 (neuer Header für die fb_font's)
'Idee von der alten GfxPrint-Routine
'ab FB 0.24 neue Bezeichnung für die Font-Type
Type fb_font_x
As Integer breit, hoch
As Any Ptr start
End Type
'alt
'Extern Font8 Alias "fb_font_8x8" As fb_font_x
'Extern Font14 Alias "fb_font_8x14" As fb_font_x
'Extern Font16 Alias "fb_font_8x16" As fb_font_x
'neu
Extern __fb_font(0 To 2) Alias "__fb_font" As fb_font_x
#Define Font8 __fb_font(0)
#Define Font14 __fb_font(1)
#Define Font16 __fb_font(2)
Sub DrawString( ByVal buffer As Any Ptr=0, ByVal xpos As Integer, _
ByVal ypos As Integer, ByRef text As String, ByVal fgcol As Integer=Color, _
ByRef f As fb_font_x)
Dim As Integer l,bits,xend
Dim row As UByte Ptr
l = Len(text)-1
If l<0 Then Exit Sub
ScreenInfo xend
ScreenLock
For i As Integer = 0 To l
row = text[i]*f.hoch+f.start
For y As Integer= ypos To ypos+f.hoch-1
bits = *row
For x As Integer= xpos To xpos+7
If (bits And 1) Then
If (buffer = 0) Then
PSet (x,y),fgcol
Else
PSet buffer,(x,y),fgcol
End If
End If
bits = bits Shr 1
Next
row +=1
Next
xpos +=f.breit
If xpos > xend Then Exit For
Next
ScreenUnLock
End Sub
Screen 18,32
DrawString ,20,10,"Schrifttyp 8x8 Font",&h0000ff,Font8
DrawString ,40,30,"Schrifttyp 8x14 Font",&h00ff00,Font14
DrawString ,60,60,"Schrifttyp 8x16 Font",&hff0000,Font16
Draw String (80,80),"Schrifttyp 8x16 Font (Draw String)",&Hffffff
Sleep
Zusätzliche Informationen und Funktionen | |||||||
---|---|---|---|---|---|---|---|
|