12-16-2022, 10:46 PM
The Linux user could choose a font in his/her system, if he/she doesn't have Wine and didn't run "winetricks". This is to use the same "Courier New" as the Windows version. I made a couple of other modifications -- why did the "Baron" get that name?
Code: (Select All)
'modified by mnrvovrfc
' QB64PE ASCII Art program to generate an image of Snoopy cursing the Red Baron
' Requires QB64PE to run
Screen _NewImage(640, 480, 32)
' Define variables to hold the ASCII art text
Dim Shared cr$
Dim snoopy As String
Dim redBaron As String
cr$ = Chr$(13)
' Set the ASCII art text for Snoopy and the Red Baron
snoopy = ""
snoopy = snoopy + " .--." + cr$
snoopy = snoopy + " : (\\/) :" + cr$
snoopy = snoopy + " '--'" + cr$
snoopy = snoopy + " /( )\\" + cr$
snoopy = snoopy + " | '' |" + cr$
snoopy = snoopy + " | |" + cr$
snoopy = snoopy + " | |" + cr$
snoopy = snoopy + " | |" + cr$
snoopy = snoopy + " _| |_" + cr$
snoopy = snoopy + "(' \\ / ')" + cr$
snoopy = snoopy + " \\ '._.' /" + cr$
snoopy = snoopy + " '-.___.-'" + cr$
redBaron = ""
redBaron = redBaron + " .-." + cr$
redBaron = redBaron + " ( )." + cr$
redBaron = redBaron + " (___(__)" + cr$
redBaron = redBaron + " /: V \\" + cr$
redBaron = redBaron + " /: / \\ \\" + cr$
redBaron = redBaron + " /: / \\ \\" + cr$
redBaron = redBaron + " /: / \\ \\" + cr$
redBaron = redBaron + " /: / \\ \\" + cr$
redBaron = redBaron + " /: / \\ \\" + cr$
redBaron = redBaron + " /: / \\ \\" + cr$
redBaron = redBaron + "(____________________)" + cr$
' Set the font and text color
Dim As Long lh, ccolor
$If WIN Then
lh = _LOADFONT("C:\Windows\Fonts\cour.ttf", 20)
$Else
lh = _LoadFont(Environ$("HOME") + "/.wine/drive_c/windows/Fonts/cour.ttf", 20)
If lh <= 0 Then Print "Sorry, Wine needs to be installed."
$End If
_Font lh
' Draw the ASCII art text on the screen
ccolor = _RGB(192, 192, 192)
Color ccolor
ELDRAWTEXT snoopy, 10, 10
ccolor = _RGB(224, 0, 0)
Color ccolor
ELDRAWTEXT redBaron, 10, _Width \ 2
' Wait for a key press to exit the program
While InKey$ = ""
_Limit 100
Wend
System
Sub ELDRAWTEXT (which As String, topy As Long, topx As Long)
Dim As Long fw, fh, x, y, u
Dim ch As String * 1
fw = _PrintWidth("W")
fh = _FontHeight
x = topx
y = topy
For u = 1 To Len(which)
ch = Mid$(which, u, 1)
If ch = cr$ Then
x = topx
y = y + fh
Else
_PrintString (x, y), ch
x = x + fw
End If
Next
End Sub