sync on : disable escapekey : randomize timer()
type pt_t
x as integer
y as integer
endtype
`array of points, every time a line is drawn its start and end point is added to this array
dim points(0) as pt_t
empty array points(0)
`
last as pt_t
last.x = -1
mx as integer
my as integer
ink rgb(255,255,255),0
box 0,0,screen width(),screen height()
ink rgb(0,0,0),0
`drawing loop
repeat
mx = mousex()
my = mousey()
if mouseclick() = 1
`if a line is not in progress
if last.x = -1
last.x = mx
last.y = my
else
`line in progress so draw a line and add the point to the points() array
line last.x,last.y,mx,my
array insert at bottom points()
points(array count(points())).x = mx
points(array count(points())).y = my
last.x = mx
last.y = my
endif
else
`make it so a line is not in progress as the mouse is released
last.x = -1
endif
sync
until escapekey()
cls
repeat : sync : until escapekey() = 0
i as integer
ii as integer
rand as integer
`for calculating distance
x as integer
y as integer
dist as integer
short as integer
first as integer
second as integer
`array of random points in the points() array
dim connect(15)as pt_t
total as integer
total = array count(points())
ink rgb(255,255,255),0
box 0,0,screen width(),screen height()
ink rgb(0,0,0),0
`scribbler loop
repeat
`get some random points
for i = 0 to 15
rand = rnd(total)
connect(i).x = points(rand).x
connect(i).y = points(rand).y
next i
short = 1121 : `640 + 480 + 1
`find the two closest points
for i = 0 to 15
for ii = 0 to 15
if i <> ii
x = abs(connect(i).x - connect(ii).x)
y = abs(connect(i).y - connect(ii).y)
dist = x + y
if dist < short
first = i
second = ii
short = dist
endif
endif
next ii
next i
`draw line
line connect(first).x,connect(first).y,connect(second).x,connect(second).y
sync
until escapekey()
Draw then press escape and it will go into scribble mode.
Unfortunalty you can't use alpha without moving to memblocks so it doesn't look as good.
PII 300 : 64mb ram : voodoo II 12mb : Win98