Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SquarePrint
#1
A simple routine to print a square text of any size font to the screen, as per Phil's request here: https://qb64phoenix.com/forum/showthread.php?tid=3182

Code: (Select All)
$Color:32
Screen _NewImage(640, 480, 32)
Color Orange, Blue
SquarePrint 0, 0, 8, "Hello World"
Color Red, Green
Sleep
SquarePrint 8, 8, 32, "Hello World"
Color Blue, Yellow
Sleep
SquarePrint 100, 100, 32, "Testing the code!"
Sleep
System


Sub SquarePrint (x, y, size As Single, text$)
    Dim As _Unsigned Long dc, bg
    If size < 4 Or size > 256 Then Exit Sub
    sz = size / 8
    tempscreen = _NewImage(_Width / size * 8, _Height / size * 8, 32)
    d = _Dest: dc = _DefaultColor: bg = _BackgroundColor
    _Dest tempscreen
    Color dc, bg: _Font 8
    _PrintString (x * 8 / size, y * 8 / size), text$
    _Dest d
    _PutImage , tempscreen
    _FreeImage tempscreen
End Sub
Reply




Users browsing this thread: 1 Guest(s)