View.Set ("graphics:max,max")
var mx, my, mb : int
var current_tool : string := "no tool"
var col: int := black %colour
var mog_stamp : int := Pic.FileNew ("mog.bmp")
var pencil_pic :int:=Pic.FileNew ("pencil.bmp")
var pencil_pic2 : int:=Pic.FileNew ("pencil2.bmp")
var erase:int:=Pic.FileNew ("erase.bmp")
var box:int:=Pic.FileNew ("box.bmp")
var star:int:=Pic.FileNew ("star.bmp")
var sprayx, sprayy:int
var maxdist : int := 0
var distance : int
%Drawing the Screen
%Tools
drawbox (50, 50, 100, 100, black) % Smallest Circle
drawbox (50, 120, 100, 170, black) % Small Circle
drawbox (50, 330, 100, 380, black) % Erase
drawbox (50, 190, 100, 240, black) % Box
drawbox (50, 260, 100, 310, black) % Star
Pic.Draw (pencil_pic, 52, 52, picCopy)
Pic.Draw (pencil_pic2, 52, 122, picCopy)
Pic.Draw (erase, 51, 335, picCopy)
Pic.Draw (box, 52, 192, picCopy)
Pic.Draw (star, 52,261, picCopy)
% row 2
drawbox (110, 300, 160, 350, black) % Stamp 1
Pic.Draw (mog_stamp, 120, 305, picCopy)
drawbox (110, 230, 160, 280, black) % Stamp 2
%Canvas
drawbox (170, 73, 1000, 650, black)
for x: 150.. 650 by 15 %bottom menu
for y: 0.. 55 by 15
drawfillbox (x,y,x + 15,y + 15, col)
col +=1
end for
end for
loop
mousewhere (mx, my, mb)
%tools & stamps selection
if mb = 1 and mx > 52 and my > 50 and mx < 100 and my < 100 then
current_tool := "pencil2"
elsif mb = 1 and mx > 110 and my >230 and mx < 160 and my <280 then
current_tool := "spray"
elsif mb = 1 and mx > 50 and my > 190 and mx < 100 and my < 240 then
current_tool := "box"
elsif mb = 1 and mx >50 and my > 330 and mx < 100 and my <380 then
current_tool := "erase"
elsif mb = 1 and mx > 110 and my > 300 and mx < 160 and my < 350 then
current_tool := "mog"
elsif mb = 1 and mx > 50 and my > 120 and mx < 100 and my < 170 then
current_tool := "pencil"
elsif mb = 1 and mx > 50 and my > 260 and mx < 100 and my < 310 then
current_tool := "star"
elsif mb = 1 and mx > 200 and my > 97 and mx < 950 and my <626 then
%user has clicked in canvas
if current_tool = "pencil2" then
drawfilloval (mx - 0, my - 0, 5, 5, col)
elsif current_tool = "box" then
drawfillbox (mx, my, mx - 20, my - 20, col)
elsif current_tool = "erase" then
drawfillbox (mx, my, mx -20, my -20, white)
elsif current_tool = "mog" then
Pic.Draw (mog_stamp, mx - 25, my - 25, picCopy)
elsif current_tool = "pencil" then
drawfilloval (mx - 0, my - 0, 20, 20, col)
elsif current_tool = "star" then
drawfillstar (mx - 25, my - 25, mx + 25, my + 25, col)
elsif current_tool = "spray" then
mousewhere (mx, my, mb)
randint (sprayx, mx - 5, mx + 5)
randint (sprayy, my - 5, my + 5)
randint (col, col, col)
drawdot (sprayx, sprayy, col)
end if
end if
if mb = 1 and mx > 150 and my > 0 and mx < 960 and my < 65 then
col:= whatdotcolour (mx, my)
drawfillbox (700,0, 760,60, col)
end if
end loop