'This plotter was made in 2 days by Ken G. and finished on June 27, 2019 using QB64 language.
'Thank you for some ideas from some people at the QB64.org Forum!
'Code to use the pictures made with this can be found marked out toward the end of this program.
'This program is Freeware and will always be Freeware.
'Feel free to use any of this code in your own programs.
'-----------------------------------------------------------------------------------------------
start:
DIM x$
(10000), y$
(10000), x
(10000), y
(10000) p = 0
t = 0
pn = 0
e = 0
PRINT "Use the arrow keys to move the red box." PRINT "Use Space Bar to move Pen Down to draw and Pen Up to just move." PRINT "Use E to turn the Eraser off and on." PRINT "Use Esc to start over." PRINT "**** You will need to have Pen Down to use Eraser." PRINT "There is a 10,000 plot limit. Don't worry about this limit" PRINT "because you can fill the entire screen and more and still be" PRINT "less than 10,000 plots." PRINT "Press S to save and L to load an already saved picture." PRINT "The saved .txt file will have X,Y plots on each line that" PRINT "can be used in your own programs." PRINT "This is a simple plotting/drawing program that doesn't change colors." PRINT "The saved files don't have any colors on them, so when" PRINT "you use them for your own programs, you will need to add a color." PRINT "The window scale is 640 x 480 pixels with each plot every 10 pixels." PRINT "So when using in your own programs, make sure and make X = X + 10 and" PRINT "Y = Y + 10 to display with LINE command." PRINT "Code to load your picture is marked out in the code of this program." PRINT "The coordinates and Pen Up, Pen Down, Eraser On, Eraser Off will be" PRINT "in the top Window title bar." INPUT "Press enter to start.", st$
x = 320: y = 240
LINE (gridx
, gridy
)-(gridx
+ 10, gridy
+ 10), _RGB32(255, 255, 255), B
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 0, 0), B
pen$
= "Up": eraser$
= "Off" titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
go:
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 255, 255), B
y = y - 10
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 0, 0), B
x2 = x + 10
y2 = y + 10
t = t + 1
titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 255, 255), B
y = y + 10
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 0, 0), B
x2 = x + 10
y2 = y + 10
t = t + 1
titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 255, 255), B
x = x + 10
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 0, 0), B
x2 = x + 10
y2 = y + 10
t = t + 1
titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 255, 255), B
x = x - 10
LINE (x
, y
)-(x
+ 10, y
+ 10), _RGB(255, 0, 0), B
x2 = x + 10
y2 = y + 10
t = t + 1
titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
e = e + 1
titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
eraser$ = "Off"
titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
pn = pn + 1
titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
titl$
= "Ken's Plotter X=" + xx$
+ " Y=" + yy$
+ " Pen: " + pen$
+ " Eraser: " + eraser$
save:
save2:
INPUT "Type file name of maze to create (without the .txt ending):", nm$
nm$ = nm$ + ".txt"
'Checking to see if the file already exists on your computer.
PRINT "File Already Exists" PRINT "Saving will delete your old maze." PRINT "Would you like to still do it?" PRINT "(Y/N). Esc ends program." llloop:
save3:
PRINT #1, x$
(plots
);
","; y$
(plots
) skip2:
PRINT nm$;
" has been saved to your computer." INPUT "Press enter to start again."; a$
'------------------------------------------------------------------------------
'The following is the code you can use to load the graphic to your own program.
'------------------------------------------------------------------------------
load:
INPUT "Type file name to load (without the .txt ending):", nm$
nm$ = nm$ + ".txt"
ggo:
p = p + 1
x
(p
) = VAL(x$
(p
)): y
(p
) = VAL(y$
(p
))LINE (x
(p
), y
(p
))-(x
(p
) + 10, y
(p
) + 10), _RGB(255, 255, 255), BF
done:
'------------------------------------------------------------------------------
check:
INPUT "Limit has been reached, do you want to save (Yes/No):"; yn$
IF yn$
= "YES" OR yn$
= "yes" OR yn$
= "Yes" OR yn$
= "YEs" OR yn$
= "yES" OR yn$
= "Y" OR yn$
= "y" THEN GOTO save:
eraser:
x$(ee) = "": y$(ee) = ""