%Purpose: Chooses a shape and draws it with two mouse clicks
%**the bonuses don't work properly
%
%Variable Dictionary:
%x- x cooridinate for first click
%y- y cooridinate for first click
%x2- x cooridinate for second click
%y2- y cooridinate for second click
%opt- that is the shape the user chooses from the menu
procedure MousePractice
var opt, x, y, bnum, bupdown, x2, y2, c : int
loop
randint (c, 1, 225)
put "DRAWING SHAPES"
put ""
put "1.Box"
put "2.Star"
put "3.Maple Leaf"
put "4.Circle"
put "5.Oval"
put "6.Arc"
put "7.Exit"
get opt
delay (500)
cls
put "Click to make the shape. Pick two points."
if opt = 1 then
Mouse.ButtonWait ("down", x, y, bnum, bupdown)
Mouse.ButtonWait ("down", x2, y2, bnum, bupdown)
drawfillbox (x, y, x2, y2, c)
delay (3000)
cls
elsif opt = 2 then
Mouse.ButtonWait ("down", x, y, bnum, bupdown)
Mouse.ButtonWait ("down", x2, y2, bnum, bupdown)
if y > y2 then
drawfillstar (x2, y2, x, y, c)
else
drawfillstar (x, y, x2, y2, c)
end if
delay (3000)
cls
elsif opt = 3 then
Mouse.ButtonWait ("down", x, y, bnum, bupdown)
Mouse.ButtonWait ("down", x2, y2, bnum, bupdown)
if y > y2 then
drawfillmapleleaf (x2, y2, x, y, c)
else
drawfillmapleleaf (x, y, x2, y2, c)
end if
delay (3000)
cls
elsif opt = 4 then
Mouse.ButtonWait ("down", x, y, bnum, bupdown)
Mouse.ButtonWait ("down", x2, y2, bnum, bupdown)
if x > y then
if x2 > x then
drawfilloval (x, y, x2 - x, x2 - x, c)
else
drawfilloval (x, y, x - x2, x - x2, c)
end if
else
if y2 > y then
drawfilloval (x, y, y2 - y, y2 - y, c)
else
drawfilloval (x, y, y - y2, y - y2, yellow)
end if
end if
delay (3000)
cls
elsif opt = 5 then
Mouse.ButtonWait ("down", x, y, bnum, bupdown)
Mouse.ButtonWait ("down", x2, y2, bnum, bupdown)
if x2 > x then
drawfilloval (x, y, x2 - x, y2 - y, c)
else
drawfilloval (x, y, x - x2, y - y2, c)
end if
elsif opt = 6 then
Mouse.ButtonWait ("down", x, y, bnum, bupdown)
Mouse.ButtonWait ("down", x2, y2, bnum, bupdown)
if x2 > x then
drawarc (400,300, x2 - x, y2 - y, 1, 25, c)
else
drawarc (400,300, x - x2, y - y2, 25, 1, c)
end if
elsif opt > 7 and opt < 1 then
put "Invaild Response--Can not continue"
else
cls
put "Good-bye"
exit when opt = 7
end if
delay (3000)
cls
end loop
end MousePractice
setscreen ("graphics:800;600")
MousePractice
|