Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filled in boxes
#1
How do i make boxes filled in with colour and then add some text without getting the black spaces

what i mean is this.......

Code:
line(406,11)-(633,464),0,bf
locate 4,4:print "Menu 1"
Reply
#2
I THINK you do this

LINE (0,0)-(100,100), 12, BF
COLOR 15,12:LOCATE 1,1TongueRINT "Hello"
url=http://www.sloganizer.net/en/][Image: style4,TheDarkJay.png][/url]
Reply
#3
You can't avoid FB standard gfxlib print change the backgraound, in this it behaves exactly like QB. You have 3 options.
-PRINT changes the background to color 0, you can use PALETTE set that color to something fitting.
-Use the transparent background routine lillo suggests in the appendix of gfxlib.text in the FB distribution.
-Wait for the next 0.16 unstable release, it should include the new DRAW STRING that will allow custom fonts, custom positions and transparent background
Antoni
Reply
#4
Quote:-Wait for the next 0.16 unstable release, it should include the new DRAW STRING that will allow custom fonts, custom positions and transparent background
haha, drawstring, :lol: I cant wait for this command, Print always annoys me Tongue
[Image: freebasic.png]
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)