Personaje - mnrvovrfc - 01-20-2023
This is a simple program that works like "Cowsay" Flatpak app. It associates a quotation with a silly ASCII picture of an animal or person or something else. It draws a balloon around the quotation. Maybe I should have added the option for "thought" which is fluffier cloud...
This requires at least two files:- personaje.txt - contains the ASCII art. Each "personality" should be separated by a single line which has only three dashes, no whitespace around it, only newline should follow it.
- personajq.txt - contains the quotations, one per line.
A file could be asked for in interactive mode:- personaj1.txt - has the quotation that you prefer to give the personality which is not found in "personajq.txt". I wrote this program originally in Freebasic, and I'm not sure if "_CLIPBOARD$" function works on Linux. Otherwise for Windows the change to that function could be certainly done.
Also in interactive mode it's possible to load a text file of your choice to display the personality on the terminal.
This program does no special formatting for the personality, only for the balloon and caption inside. Its output is into the terminal to make it easier to copy and paste into a text editor to foul it up...
Run this program without parameters and it comes up with a random quotation and a random personality from the two files required for it. Otherwise type "help" after the program name to see what's in it for interactive mode.
I'm only including the source code. I leave it to your imagination to go looking for ASCII art and things to say...
Code: (Select All) $CONSOLE:ONLY
OPTION _EXPLICIT
DIM AS INTEGER p, q, pl, ql, ff, m, n, i, rm, m1, m2
DIM AS STRING pfile, qfile, a, b, bl, ca, crlf
DIM ch AS _UNSIGNED _BYTE
REDIM qline(1 TO 1) AS STRING
REDIM pline(1 TO 1) AS STRING
$IF WIN THEN
crlf = CHR$(13) + CHR$(10)
$ELSEIF LINUX THEN
crlf = CHR$(10)
$ELSE
crlf = CHR$(13)
$END IF
RANDOMIZE TIMER
q = 1
p = 1
ca = COMMAND$(1)
IF ca = "" THEN
qfile = "personajq.txt"
pfile = "personaje.txt"
IF NOT _FILEEXISTS(pfile) THEN
PRINT "File NOT found: "; pfile
SYSTEM
END IF
IF NOT _FILEEXISTS(qfile) THEN
PRINT "File NOT found: "; qfile
SYSTEM
END IF
ql = 10
pl = 10
REDIM qline(1 TO ql) AS STRING
REDIM pline(1 TO pl) AS STRING
b = ""
ff = FREEFILE
OPEN pfile FOR INPUT AS ff
DO UNTIL EOF(ff)
LINE INPUT #ff, a
IF a = "---" THEN
pline(p) = b
b = ""
p = p + 1
IF p > pl THEN
pl = pl + 10
REDIM _PRESERVE pline(1 TO pl) AS STRING
END IF
ELSE
'for Windows concatenate "chr(13) + chr(10)" instead of just the latter
b = b + delundersinside$(a) + crlf
END IF
LOOP
CLOSE ff
IF b = "" THEN
p = p - 1
ELSE
b = b + delundersinside$(a) + crlf
END IF
ff = FREEFILE
OPEN qfile FOR INPUT AS ff
DO UNTIL EOF(ff)
LINE INPUT #ff, a
IF a <> "" THEN
qline(q) = a
q = q + 1
IF q > ql THEN
ql = ql + 10
REDIM _PRESERVE qline(1 TO ql) AS STRING
END IF
END IF
LOOP
CLOSE ff
ELSE
ca = LCASE$(ca)
IF ca = "help" THEN
PRINT quotesquiggle$("Accepted parameters are: ~say~, ~pers~, ~both~ (without double-quotes)")
SYSTEM
END IF
IF ca = "say" OR ca = "both" THEN
PRINT "Write what the personality has to say"
PRINT quotesquiggle$("or ~c~ (without double-quote) to get it from")
PRINT "(current-dir)/personaj1.txt:"
LINE INPUT b
IF b = "" THEN SYSTEM
IF b = "c" THEN
qfile = "personaj1.txt"
b = ""
ff = FREEFILE
OPEN qfile FOR INPUT AS ff
IF NOT EOF(ff) THEN LINE INPUT #ff, b
CLOSE ff
END IF
qline(1) = b
END IF
IF ca = "pers" OR ca = "both" THEN
PRINT "Enter the filename (in current dir) which contains the personality:"
LINE INPUT pfile
IF pfile = "" THEN END
IF NOT _FILEEXISTS(pfile) THEN
PRINT "Without a personality I cannot work!"
SYSTEM
END IF
b = ""
ff = FREEFILE
OPEN pfile FOR INPUT AS ff
DO UNTIL EOF(ff)
LINE INPUT #ff, a
b = b + a + crlf
LOOP
CLOSE ff
pline(1) = b
END IF
END IF
IF q = 1 THEN n = 1 ELSE n = INT(RND * q + 1)
a = qline(n)
b = ""
bl = ""
rm = -1
m = 1
FOR i = 1 TO LEN(a)
m = m + 1
ch = ASC(a, i)
IF ch = 32 AND m > 50 THEN
IF m > rm THEN rm = m
bl = ""
m = 1
ELSE
bl = bl + CHR$(ch)
END IF
NEXT
IF rm = -1 THEN
rm = m
ELSEIF m > rm THEN
rm = m
END IF
bl = ""
m = 1
FOR i = 1 TO LEN(a)
m = m + 1
ch = ASC(a, i)
IF ch = 32 AND m > 50 THEN
b = b + "|" + bl + SPACE$(rm - LEN(bl)) + "|" + crlf
bl = ""
m = 1
ELSE
bl = bl + CHR$(ch)
END IF
NEXT
IF bl <> "" THEN
b = b + "|" + bl + SPACE$(rm - LEN(bl)) + "|" + crlf
END IF
m1 = rm - (rm \ 2) - 1
m2 = rm - m1 - 2
b = " " + STRING$(rm, 45) + crlf + b + " " + STRING$(m1, 45) + "||" + STRING$(m2, 45) + crlf + SPACE$(m1 + 1) + "||"
PRINT b
IF p = 1 THEN n = 1 ELSE n = INT(RND * p + 1)
PRINT pline(n)
SYSTEM
FUNCTION quotesquiggle$ (sa AS STRING)
STATIC st AS STRING
st = sa
ReplaceString2 st, "~", CHR$(34), 0
quotesquiggle$ = st
END FUNCTION
SUB ReplaceString2 (tx AS STRING, sfind AS STRING, repl AS STRING, numtimes AS _UNSIGNED LONG)
DIM AS STRING s, t
DIM AS _UNSIGNED LONG ls, count, u
DIM goahead AS _BYTE
IF (tx = "") OR (sfind = "") OR (sfind = repl) OR (LEN(sfind) > LEN(tx)) THEN EXIT SUB
s = UCASE$(sfind): t = UCASE$(tx)
ls = LEN(s)
count = 0
goahead = 1
DO
u = INSTR(t, s)
IF u > 0 THEN
tx = LEFT$(tx, u - 1) + repl + MID$(tx, u + ls)
t = UCASE$(tx)
IF numtimes > 0 THEN count = count + 1: IF count >= numtimes THEN goahead = 0
ELSE
goahead = 0
END IF
LOOP WHILE goahead
END SUB
FUNCTION delundersinside$ (sa AS STRING)
STATIC st AS STRING, i AS LONG, ch AS _UNSIGNED _BYTE, fl AS _UNSIGNED _BYTE
st = SPACE$(LEN(sa))
fl = 0
FOR i = 1 TO LEN(st)
ch = asc(sa, i)
IF ch = 95 AND fl = 1 THEN
'mid$(st, i, 1) = " "
_CONTINUE
ELSEIF ch <> 95 AND fl = 0 THEN
fl = 1
END IF
MID$(st, i, 1) = CHR$(ch)
NEXT
delundersinside$ = RTRIM$(st)
END FUNCTION
EDIT: Made sure it could work on "any" OS. Didn't process properly the "---" as last line of "personaje.txt", fixed. Didn't format the last line of balloon properly, fixed.
EDIT #2: Added a function, for display of the "personality" that turns the underscores into spaces, the annoying ones that interfere with image view.
RE: Personaje - bplus - 01-20-2023
Quote:I'm only including the source code. I leave it to your imagination to go looking for ASCII art and things to say...
Not even a couple of files to Demo your code? (and see how it's suppose to work.)
RE: Personaje - mnrvovrfc - 01-20-2023
Here is the file that should be saved as "personaje.txt" in the same directory as the program:
Code: (Select All) ______x___x
______x___x_________________bbbbbbbbbbbbbbbb
______x___x________________b________________b
______x___x_______________b__bbbbbbbbbbbbbb__b
______x___x______________b__b______________b__b
______x___x______________b__b__ooo____ooo__b__b
______x___x______________b__b______________b__b
____ooxoooxo_____________b__b___o______o___b__b
___o__x___x_ooo__________b__b_oo_o____o_oo_b__b
oooo__x___x____o_________b__b______________b__b
o______________o_________b__b______________b__b
o______________o_________b__b_____o__o_____b__b
_o____________o_________b__b_______oo_______b__b
_o____________o________b__b__________________b__b
_o___________o_________b__b____r________r_____b_b
_o__________o__________b_bb_____rrrrrrrr_____o_bbb
__o_________o_________bbb__o________________o____o
__o_________o______ooo______o______________o______oo
__o_________o___ooo__________oooooooooooooo_________ooo
___o________o_oo_______________________________________o
____o_______oo__________________________________________o
____o_______o___________________________________________o
____o_______o___________________________________________o
____o_______o___________________________________________o
---
_____________oooooooooooooooooooooooooooooooo
___________oo________________________________o____r
________ooo___bb______________________________o____r
_____ooo_______________________________________or_r
____o__________________________________________o_r
____ooo________________________________________o
_______o_____________________________________oo
________oo__________________________________o
__________o________________________________o
___________ooooo___oooooo_________ooo___ooo
_______________o___o_____ooooooooo__o___o
_______________o___o________________o___o
_______________o___o________________o___o
_______________o_o_o________________o_o_o
_______________o___o________________o___o
---
___________oooooooooooooooooo
___________o________________o
___________o________________o
xx_________o___________b____o
xx_________o_________bbb____o
xx_________o______bbb__b____o
xx_________o___bbb_____b____o
xx_________o_bb________b____o
xx_________o_b_________b____o
xx_________o_b_________b____o
xx_________o_bbb_______bbb__o
xx_________o_bbbb______bbbb_o
xx_________o__bbb_______bbb_o
xxxxxxxxxxxo________________o
___________o________________o
___________o________________o
___________oooooooooooooooooo
---
_________________oooo
_____________oooo____oo
__________ooo__________oo
_______ooo_______________o
_____oo_________r_________o
____o_________rr___________o
___o_________r___________oo
__o__________________oooo
_o_________________oo
o________________oo_
o______________oo_xxxxxxxx
o_____________oxxxxxxxxxxxx
_o_____________o___xxxxxxx
_o______________oo
__o_______________ooo
___oo________________ooo
_____o__________________oo
______oo__________________o
________o_______________oo
_________oo___________oo
___________oo_______oo
_____________ooooooo
---
____________xxxxxxxxxx
__________xxxxxxxxbbxxx
________xxxxxxxxxxxxxxxxxx
_______xxxxxxxxxxxxxoooxxxx
___xxxxxxxxxxxxxxxoooxx
_xxxxxxxxxxxxxxxxooxx
xxxxxxxxxxxxxxxxxxxx
___xxxxxxxxx_xxxxx
____xxxxxxx___xx
____xxxxx____xxxxx
____xxxx_____xxxxxx
____xxx_____xxxx_xx
____xxx____xxxxx__x
_____xx__xxxxx_x____xxxx
_____xx__xxx_______xxxx
______xx_x________xxxx
______xxx_x_______xxxx
_______xxxxxx____xxxx
________xxxxxxxxxxxx
___________xxxxxx
---
I'm sorry about the underscores. They are needed to properly align stuff. There are a few websites sharing ASCII art that make do with spaces and tabs in front of lines. The web browsers especially Firefox don't seem to handle them well. More than likely they are stripped, ruining the pictures. Even worse tabs could be found within seen glyphs and deleted as well. I was forced to fix a couple of them while I was testing this program. I didn't provide them because I don't want to be summoned for copyright questions. The pictures I show here are my own. Except the last one where I tried to copy the dolphin I found in another topic here.
Lynx text-mode browser can't handle the ASCII art blocks well if they are graphics containers. The lines of the art have to be "listed".
The pictures aren't conventional ASCII art, the letters are actually colored pixels for some other program I wrote. The first picture actually serves as my avatar somewhere else.
Note that each picture is allowed to exist as is, but has to be separated from one another with the three dashes on a line by itself and not decorated by anything else.
This other text file has the quotations. Save as "personajq.txt" in the same directory as the executable and the above text file:
Code: (Select All) Hello I am a QB64 programmer. But I'm not a good one!
I don't have to know any mathematics to know how to program!
The weather is clear away from the terminal, isn't it?
Quick, tell me how to pronounce "mnrvovrfc".
Look here, at the boring terminal that isn't a lot different from MS-DOS.
How do you draw a real pig anyhow?
Tell me how to reach Albuquerque. Do not tell me to take a left turn!
Hey I wonder when the green-named moderator returns to us, I miss his jokes, I laughed at every single one of them.
This is a demonstration of a program that was written hastily but was supposed to produce some laughter.
Only if the graphics were done with GIMP or one of those payware fancy programs, I could get your attention better. We must compromise, because the author of this program isn't patient enough and also isn't a good artist.
What is starting with "only" and ending with "artist" is supposed to be a single line. I could have made that last line even longer, to better test how big the balloon could be drawn LOL.
One of you could test the program further by providing "say" parameter to the user program. Then the program asks what the personality (picked at random by the computer) should say. Otherwise write it with a word processor or text editor and save it as "personaje1.txt" in the same directory as this program being showcased. Then at the prompt in this program just enter a "c" (small-case with no double-quotation marks). Otherwise on Windows this program could be changed so it also accepts text copied from the clipboard.
If you create a text-file picture, name it whatever you want but save it in the same directory as the program, because this program doesn't invoke an open file requester. Then the parameter at the command line could be "pers" to have it say something from the original quotes file, or "both" to also have it say something else that is provided on demand.
RE: Personaje - bplus - 01-20-2023
Thankyou for sample files to test.
I found I need to replace System with End because it looks like the program picks a random ascii art and a random text to insert in bubble, draws that then quits. If you quit with System the screen clears in a flash and nothing shows.
With End replacing System I get this as sample output:
Maybe a loop around after drawing one and doing another? (unless I've got the whole idea wrong, in which case I don't think the program is working correctly in Windows 10-64 laptop.)
RE: Personaje - mnrvovrfc - 01-20-2023
(01-20-2023, 09:41 PM)bplus Wrote: I found I need to replace System with End because it looks like the program picks a random ascii art and a random text to insert in bubble, draws that then quits. If you quit with System the screen clears in a flash and nothing shows.
But it clears the screen even with $CONSOLE:ONLY at the top? I put "SYSTEM" instead of "END" to get away from "Press enter to continue". I've never installed nor used Windows11 so I don't know how it behaves with the terminal. I composed this program first for Freebasic and then converted it to QB64, using Kate/KWrite, and ran it only from Konsole, for at least three Linux installations with KDE Plasma (Nutyx, EndeavourOS, Manjaro). The flaw might be because the program is being run from the QB64 IDE. (shrugs)
The program should be fixed so it loops, indeed, but that requires way more quotes and ASCII "people" than our artistic abilities...
Besides, give the user an opportunity to put in what the "personality" says. Use it somewhere. Like this site with ASCII art encourages the use of the things in social networking sites. Too bad many of their pictures were ruined by the stripped spaces.
RE: Personaje - bplus - 01-20-2023
Ah! how about Sleep instead of either End or System? The screen stays up until a keypress without a message, perfect for console app.
Also, sometimes you can put space sensitive text in a code block and preserve the spaces between copy and paste.
Code: (Select All) Try
this
example
in
a
code
block
RE: Personaje - mnrvovrfc - 01-21-2023
I have stopped trying to predict this forum, for example, about spaces maintained in front of any visible glyph.
Otherwise, have a short look at this site:
https://www.textfacescopy.com/ascii-art.html
How many text-picture blocks can you see straight away which look like "fish salad"? And when it's selected, copied and then pasted into a text editor with monospaced font, the user gets the same exact thing which is depressing. It's not so with the pictures that begin lines with underscore, or were made up of the fuzzy bricks.
A site like that cannot be displayed properly with Lynx web browser because each picture needs to be listed line by line on its own. Not in graphic containers. Also always include spaces instead of tabs because cannot always assume a tab is eight spaces long. I don't know whose idea was it to present the ASCII art in that way -- old clashes with new, I guess.
RE: Personaje - mnrvovrfc - 01-21-2023
I have added a function that removes the underscores that are not part of the beginning of a line that comprises a "personality", so that "personality" is easier to see. Update the source code from the first post of this topic.
RE: Personaje - mnrvovrfc - 01-22-2023
I created a quick-and-dirty drawing program. It's in SCREEN 0 and uses the mouse. Draw on the first 48 lines. More explanations below this code block.
NOTE: We need users of MacOS to check things out: where documents and fonts are stored by default.
Code: (Select All) 'by mnrvovrfc 22-Jan-2023
option _explicit
dim shared as integer x, y, ch
dim as _byte lb, rb
dim shared recal as _byte, beginpath as string
dim ascr$, opt$, afont as long
$IF WIN THEN
beginpath = environ$("USERPROFILE") + "\Documents"
$ELSEIF LINUX THEN
beginpath = environ$("HOME") + "/Documents"
$ELSE
'might be enough to take out "Library/"
beginpath = "/Users/" + environ$("USER") + "/Library/Documents"
$END IF
_delay 0.5
_title "Quick Draw"
width 80, 50
ascr$ = command$(1)
if ascr$ <> "" then
lb = 0 : rb = 0
if lcase$(ascr$) = "empty" then
rb = 1
ascr$ = ""
elseif _fileexists(ascr$) then
rb = 1
end if
opt$ = lcase$(command$(2))
if opt$ <> "" then
if left$(opt$, 2) = "--" then
lb = 3
elseif left$(opt$, 1) = "-" then
lb = 2
else
lb = 0
end if
if lb > 0 then
if mid$(opt$, lb, 4) = "font" then
$IF WIN THEN
afont = _loadfont("C:\Windows\Fonts\lucon.ttf", 14, "monospace")
$ELSEIF LINUX THEN
''LOL assumes Manjaro Linux
afont = _loadfont("/usr/share/fonts/liberation/LiberationMono-Regular.ttf", 14, "monospace")
$ELSE
''this has to be tested!
''from: https://alvinalexander.com/macos/what-is-mac-fonts-folder-install-new-fonts/
afont = _loadfont("/Users/" + environ$("USER") + "/Library/Fonts/liberation/LiberationMono-Regular.ttf", 14, "monospace")
$END IF
if afont > 0 then _font afont
end if
if rb and ascr$ <> "" then
if mid$(opt$, lb, 5) = "strip" then
loaddraw2 ascr$, 1
else
loaddraw2 ascr$, 0
end if
end if
end if 'if there's a proper option
else
if rb and ascr$ <> "" then
loaddraw2 ascr$, 0
end if
end if 'if there's any option
end if 'if filename to load or "empty" is provided at command line
ch = 35
if _fileexists("quickdraw00000.txt") then kill "quickdraw00000.txt"
do
_limit 500
showstatusbar
do : loop while _mouseinput
x = _mousex
y = _mousey
lb = _mousebutton(1)
rb = _mousebutton(2)
if lb < 0 then
if y < 49 then
locate y, x : print chr$(ch);
else
if x < 4 then
ch = ch - 1
if ch < 32 then ch = 254
_delay 0.15
elseif x > 5 and x < 9 then
ch = ch + 1
if ch > 254 then ch = 32
_delay 0.15
elseif x > 31 and x < 37 then
_delay 0.2
lb = _messagebox("Clear screen", "Are you sure?", "yesno", "info")
if lb = 1 then cls
elseif x > 39 and x < 44 then
_delay 0.2
savedraw 0
elseif x > 35 and x < 50 then
_delay 0.2
loaddraw 0
elseif x > 52 and x < 58 then
_delay 0.2
savedraw 1
elseif x > 60 and x < 66 then
_delay 0.2
loaddraw 1
end if
end if
elseif rb < 0 then
if y < 49 then
locate y, x : print " ";
end if
end if
loop until inkey$ = chr$(27)
if afont > 0 then
_font 8
_freefont afont
end if
system
sub showstatusbar ()
locate 49, 1
print "< "; chr$(ch); " > ";
print using "col = ##, row = ##"; x, y;
locate 49, 31
print "|CLEAR|||SAVE|LOAD|||STORE|";
if recal then print "RECAL|";
end sub
''CHANGED: a$
sub savescreen (a$)
dim i as integer
a$ = ""
for i = 1 to 3840
a$ = a$ + chr$(screen(((i - 1) \ 80) + 1, ((i - 1) mod 80) + 1))
next
end sub
sub loadscreen (a$)
locate 1, 1
print a$:
end sub
sub savedraw (haut as _byte)
static underscores$
dim a$, b$, ff as long, x as integer, y as integer, c as integer, d as integer
if underscores$ = "" then underscores$ = string$(80, 95)
if haut then
a$ = "quickdraw00000.txt"
else
a$ = _savefiledialog$("Enter a filename to save to", beginpath, "*.txt", "TEXT FILES")
if a$ = "" then exit sub
end if
ff = freefile
open a$ for output as ff
for y = 1 to 48
d = 95
b$ = ""
for x = 1 to 80
c = screen(y, x)
if haut = 0 then
if c = 32 then
c = d
elseif c <> 32 and d = 95 then
d = 32
end if
end if
b$ = b$ + chr$(c)
next
if b$ = underscores$ then
print #ff, ""
else
print #ff, rtrim$(b$)
end if
next
if haut then recal = 1
close ff
end sub
sub loaddraw (haut as _byte)
dim a$, b$, ff as long, y as integer
if haut then
a$ = "quickdraw00000.txt"
if not _fileexists(a$) then exit sub
else
a$ = _openfiledialog$("Choose a text file to restore", beginpath, "*.txt", "TEXT FILES")
if a$ = "" then exit sub
end if
cls
y = 1
ff = freefile
open a$ for input as ff
do until eof(ff)
line input #ff, b$
locate y, 1
print b$;
y = y + 1
if y > 48 then exit do
loop
close ff
end sub
sub loaddraw2 (afile as string, ustrip as _byte)
dim b$, ff as long
dim as integer v, w, x, y
y = 1
if ustrip then
x = 32766
ff = freefile
open afile for input as ff
do until eof(ff)
line input #ff, b$
if b$ <> "" then
if left$(b$, 1) = "_" then
w = 0
for v = 1 to len(b$)
if mid$(b$, v, 1) <> "_" then w = v : exit for
next
if w > 0 and w < x then x = w
end if
end if
y = y + 1
if y > 48 then exit do
loop
close ff
else
x = 1
end if
ff = freefile
open afile for input as ff
do until eof(ff)
line input #ff, b$
locate y, 1
if ustrip then
print mid$(b$, x);
else
print b$;
end if
y = y + 1
if y > 48 then exit do
loop
close ff
end sub
This program displays a status bar at the bottom of the screen. "Save" and "load" buttons clicked on screen do what they are asked. "Save" puts underscores at the front of lines where CHR$(32) spaces are. Use the arrow buttons at the extreme bottom left of the screen to change the current character for the pen. (A good improvement here is to use "_MOUSEWHEEL" function but I can only use a touchpad.) Press left mouse button to draw and right mouse button to erase. Press "clear" with left mouse button to clear the screen, but before that must answer "yes" to the prompt. Press [ESC] to quit the program.
The "store" and "recall" buttons are like "save" and "load" but always save to a specific file in the same directory as this program's executable. Before "messing it up" hit "STORE" with left mouse button. You'll notice "RECAL" appears next to "STORE" button. After that, if fixing the picture is too much just press "RECAL". It was hard for me to come up with a "proper" undo function. I had one which saved the current buffer every 10 seconds and reset the timer everytime the user drew something on the screen, but it was too tricky and some of you would have requested multiple buffers. The "savescreen" and "loadscreen" subprograms have been left alone in this program, and it was a hint of the undo function.
The "recall" file is erased if it's found by this program in the same directory. That's why you need to "STORE" first.
This program always saves text files with underscores replacing leading spaces. To get rid of them when loading back into this program, at the command line offer the name of the file as first parameter, then "-strip" or "--strip" as the second parameter. This maintains some of the underscores however, so the picture remains aligned with the left-hand side of the window. Otherwise to really get rid of them all, use the search-and-replace of your text editor or word processor.
The "-font" option is going to require some feedback. At the moment on Linux this was composed and tested only on Manjaro. The paths are going to be different at least on anything based on Debian or Fedora, and some independent distros. I looked up one page to write where the fonts might be stored on a Macintosh but it might not be accurate. The open file requester on MacOS might also not open in the user's "Documents" directory because I don't have a Macintosh and therefore don't know where this could be for a given user.
The command line requires the name of an existing file on disk. To override that to be able to use "-font" option, use "empty" as the filename.
The font size cannot be larger than 14 on a screen which is only 768 pixels high such as a laptop. If you have a much bigger screen, feel free to change that setting. The screen set by this program as it stands will at least be the 8x8 font for 80x50 SCREEN 0.
RE: Personaje - mnrvovrfc - 01-22-2023
I have attempted to fix a few bugs in this program I offered latest. The update is in post #9 which is:
https://qb64phoenix.com/forum/showthread.php?tid=1409&pid=12964#pid12964
Unfortunately on Linux I came across a "don't want to work" type of situation in the "loaddraw2" subprogram. Upon getting a non-zero value for "ustrip" second parameter, it has to load the text file twice. The first time to search for underscores to determine which is the true left-hand margin of the picture, and the second to actually load and display the text-file image.
The search turns out 16 as the correct value for "x". The problem is that the block below the search doesn't want to execute the line with "mid$()". (shrugs).
Sending this at command line:
Code: (Select All) $ ./quickdraw cooky.txt --strip
Use this as the input file (called "cooky.txt"):
Code: (Select All) ___________________________________@@@@
________________________________@@@ @@@@@@@@
_____________________________@@ @@@
_________________________@@@@ @@@@@
_______________________@@ @@@
______________________@@ @
_____________________@ @@
____________________@ @@
____________________@ @@
___________________@@ @
__________________@@ @@
__________________@ @
_________________@ @@
_________________@ @@
________________@@ @
________________@ @
________________@ @
_______________@ @
________________@ @
________________@ @
________________@ @
_________________@ @@
_________________@ @@
___________________@@ @
_____________________@@ @
________________________@ @@@
_________________________@@ @@
___________________________@@@ @@
______________________________@@ @@@@@
________________________________@@@@@@@ @@@@@@
_______________________________________@@
It was tried, near the very bottom of the whole source code:
Code: (Select All) if ustrip then
ff = freefile
open afile for input as ff
do until eof(ff)
line input #ff, b$
locate y, 1
print mid$(b$, x);
y = y + 1
if y > 48 then exit do
loop
close ff
else
ff = freefile
open afile for input as ff
do until eof(ff)
line input #ff, b$
locate y, 1
print b$;
y = y + 1
if y > 48 then exit do
loop
close ff
end if
as well as:
Code: (Select All) ff = freefile
open afile for input as ff
do until eof(ff)
line input #ff, b$
locate y, 1
if ustrip then
print mid$(b$, x);
else
print b$;
end if
y = y + 1
if y > 48 then exit do
loop
close ff
So I need this tested on Windows to see if it works like it should.
|