Mouse.ButtonChoose ("multibutton")
View.Set ("offscreenonly,nobuttonbar")
colorback (black)
cls
var mx, my, mz, b : int
var c := 1
var ch : array char of boolean
var poly : int := 4 %<-- Change this
type coo :
record
x, y : array 1 .. 4 /* <--- and this! */of int
end record
var Line : flexible array 1 .. 1 of coo
proc click
for yy : 0 .. maxy by 10
Draw.Line (0, yy, maxx, yy, 19)
end for
for xx : 0 .. maxx by 10
Draw.Line (xx, 0, xx, maxy, 19)
end for
if upper (Line) > 1 then
for i : 1 .. upper (Line) - 1
Draw.FillPolygon (Line (i).x, Line (i).y, upper (Line (i).x), grey)
end for
end if
View.Update
end click
click
loop
Mouse.Where (mx, my, mz)
Input.KeyDown (ch)
if mz = 1 then
Line (upper (Line)).x (c) := (round (mx / 10)) * 10
Line (upper (Line)).y (c) := (round (my / 10)) * 10
Draw.FillOval (Line (upper (Line)).x (c), Line (upper (Line)).y (c), 3, 3, black)
delay (200)
View.Update
c += 1
elsif mz = 10 and c = 1 then
exit
end if
if c > 1 and c < poly+1 and mz = 100 then
cls
click
Draw.FillOval (Line (upper (Line)).x (1), Line (upper (Line)).y (1), 3, 3, black)
if c > 2 then
for i : 2 .. c - 1
Draw.Line (Line (upper (Line)).x (i),
Line (upper (Line)).y (i),
Line (upper (Line)).x (i - 1),
Line (upper (Line)).y (i - 1), black)
Draw.FillOval (Line (upper (Line)).x (i), Line (upper (Line)).y (i), 3, 3, black)
end for
end if
Draw.Line (Line (upper (Line)).x (c - 1), Line (upper (Line)).y (c - 1), mx, my, black)
View.Update
delay (50)
end if
if c = poly+1 then
cls
new Line, upper (Line) + 1
click
Draw.FillPolygon (Line (upper (Line)).x, Line (upper (Line)).y, upper (Line (upper (Line)).x), grey)
c := 1
%new Line, upper (Line) + 1
end if
if ch (KEY_CTRL) and ch ('z') and upper (Line) > 1 and c = 1 then
new Line, upper (Line) - 1
c := 1
cls
click
delay (500)
Input.Flush
end if
/* REDO COMMAND It works but its dangerous.
if ch (KEY_CTRL) and ch ('y') and upper (Line) > 1 and c = 1 then
new Line, upper (Line) + 1
c := 1
cls
locate (1, 1)
put upper (Line)
click
delay (500)
Input.Flush
end if
*/
end loop
cls
var f : int
open : f, "Coor.txt", put
for i : 1 .. upper (Line) - 1
Draw.FillPolygon (Line (i).x, Line (i).y, upper (Line (i).x), grey)
View.Update
%Input.Pause
for ii : 1 .. 4
put : f, Line (i).x (ii), " ", Line (i).y (ii), " | " ..
end for
put : f, ""
end for
close : f
|