Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filled in boxes
#5
Code:
Type fb_FontType

    w As Integer
    h As Integer
    Data As uByte Ptr

End Type

Extern fb_FontData Alias "fb_font_8x8" As fb_FontType
'Extern fb_FontData Alias "fb_font_8x16" As fb_FontType

Sub GfxPrint( ByRef text As String, ByVal x As Integer = 0, ByVal y As Integer = 0, ByVal col As Integer = 15, ByVal buffer As Any Ptr = 0 )

  '' everyone knows angelo wrote a lot of this :)
  '' i try to optimize


    Dim row As Integer, i As Integer
    Dim bits As uByte Ptr
  
  Dim As Integer h_opt = fb_FontData.h-1, h_opt2
  
  Select Case fb_FontData.h
  
    Case 8
  
      h_opt2 = 3
      
    Case 16
    
      h_opt2 = 4
      
  End Select
  
  
    For i = 0 To Len(text)-1

        bits = fb_FontData.Data + (text[i] Shl h_opt2)
    
    Dim As Integer y_opt = y, x_opt = x + 7
    
    
        For row = 0 To h_opt
      
            Line (x_opt, y_opt)-(x, y_opt),col,, *bits Shl 8

            y_opt += 1
            bits += 1

        Next row

        x += 8

    Next i

End Sub


Screen 13
Paint( 0, 0 ), 4

gfxprint "hey hey, no black crap!"

Sleep

for now, this will work for ya. switch which one of those externs is commented to switch between 8x8 and 8x16 text
Reply


Messages In This Thread
Filled in boxes - by Champions_2002 - 02-27-2006, 05:41 PM
Filled in boxes - by TheDarkJay - 02-27-2006, 07:59 PM
Filled in boxes - by Antoni Gual - 02-28-2006, 01:12 AM
Filled in boxes - by Deleter - 02-28-2006, 01:16 AM
Filled in boxes - by Anonymous - 02-28-2006, 01:49 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)