import GUI in "%oot/lib/GUI"
var newx, newy, newb : int := 0 % Mouse at the current frame.
var oldx, oldy : int := 0 % Mouse at last frame
var colourdraw:=7 % Colour the lines will be.
var Files, Edit, Views, Image, Skins, Help, x, y, btnNumber, btnUpDown,
buttons, x2, y2 : int
% "Canvas" Again, I don't like GUI too much.
drawfillbox (113, 66, 640, 400, 0)
drawbox (113, 66, 640, 400, 7)
Draw.Box (115, 68, 638, 398, 7)
drawfill (114, 67, 1, 7)
proc Tools % Ignore
% Border.
Draw.Box (8, 65, 96, 400, 7)
Draw.Box (10, 67, 94, 398, 7)
Draw.Fill (9, 66, 1, 7)
% Columns & rows.
Draw.Line (51, 151, 51, 400, 7)
Draw.Box (12, 69, 92, 149, 7)
for rowy : 151 .. 398 by 50
Draw.Line (10, rowy, 94, rowy, 7)
end for
% Pencil.
Draw.FillBox (27, 365, 33, 379, 43)
Draw.FillArc (30, 365, 3, 5, 173, 0, 41)
Draw.Line (27, 380, 30, 386, 26)
Draw.Line (30, 386, 33, 380, 26)
% Eraser.
Draw.FillBox (60, 366, 74, 370, 68)
Draw.Line (60, 370, 74, 384, 68)
Draw.Line (74, 384, 88, 384, 68)
Draw.Line (88, 384, 74, 370, 68)
Draw.Line (88, 384, 88, 380, 68)
Draw.Line (88, 380, 74, 366, 68)
Draw.Fill (73, 371, 67, 68)
Draw.Fill (87, 380, 68, 68)
% Paint.
Draw.FillBox (21, 314, 39, 331, 54)
Draw.FillBox (25, 314, 35, 331, 53)
Draw.Line (30, 314, 30, 331, 0)
Draw.Arc (30, 331, 9, 10, 0, 180, 7)
% Spray can.
Draw.FillBox (68, 315, 80, 331, 54)
Draw.FillBox (71, 315, 76, 331, 53)
Draw.Line (74, 315, 74, 331, 0)
Draw.FillBox (66, 333, 68, 336, 30)
Draw.FillArc (74, 331, 6, 10, 0, 180, 30)
var xvalue, yvalue : int
for count : 1 .. 30
xvalue := Rand.Int (53, 65)
yvalue := Rand.Int (330, 339)
Draw.Dot (xvalue, yvalue, 0)
end for
% Line.
Draw.Line (17, 265, 42, 290, 54)
% Text.
var fontexample : int
fontexample := Font.New ("serif:26")
assert fontexample > 0
Font.Draw ("A", 62, 265, fontexample, 54)
% Oval/circle.
Draw.Oval (30, 226, 10, 10, 7)
Draw.Fill (30, 226, 54, 7)
% Box.
Draw.Box (61, 216, 85, 236, 7)
Draw.Fill (62, 217, 54, 7)
% Star.
Draw.FillStar (15, 164, 45, 189, 54)
Draw.Star (15, 164, 45, 189, 7)
% Maple leaf.
Draw.FillMapleLeaf (58, 164, 86, 189, 54)
Draw.MapleLeaf (58, 164, 86, 189, 7)
% Current tool in use.
Draw.Box (8, 10, 52, 55, 7)
Draw.Box (10, 12, 50, 53, 7)
Draw.Fill (9, 11, 1, 7)
Draw.Box (52, 10, 96, 55, 7)
Draw.Box (54, 12, 94, 53, 7)
Draw.Fill (53, 11, 1, 7)
end Tools
%***************************MAINLINE************************
Tools
Help := GUI.CreateMenu ("Help")
item (24) := GUI.CreateMenuItem (name (24), nothing)
item (25) := GUI.CreateMenuItem (name (25), nothing)
loop
oldx := newx
oldy := newy
Mouse.Where (newx, newy, newb)
if newb = 1 then
View.ClipSet (115, 68, 638, 398)
drawbox (113, 66, 640, 400, 7)
Draw.Box (115, 68, 638, 398, 7)
drawfill (114, 67, 1, 7)
drawline (newx, newy, oldx, oldy, colourdraw)
View.ClipOff
elsif newx > 10 and newx < 51 and newy > 351 and newy < 398 and
newb = 1 then
% Pencil.
View.ClipSet (115, 68, 638, 398)
drawbox (113, 66, 640, 400, 7)
Draw.Box (115, 68, 638, 398, 7)
drawfill (114, 67, 1, 7)
drawline (newx, newy, oldx, oldy, colourdraw)
View.ClipOff
elsif newx > 10 and newx < 51 and newy > 351 and newy < 398 and
newb = 1 then
% Eraser.
elsif newx > 10 and newx < 51 and newy > 351 and newy < 398 and
newb = 1 then
% Paint.
elsif newx > 10 and newx < 51 and newy > 351 and newy < 398 and
newb = 1 then
% Spray can.
elsif newx > 10 and newx < 51 and newy > 251 and newy < 301 and
Mouse.ButtonMoved ("down") and Mouse.ButtonMoved ("up") then
% Line.
View.ClipSet (115, 68, 638, 398)
loop
Mouse.ButtonWait ("down", x, y, btnNumber, btnUpDown)
x2 := x
y2 := y
loop
drawbox (113, 66, 640, 400, 7)
Draw.Box (115, 68, 638, 398, 7)
drawfill (114, 67, 1, 7)
Draw.Line (x, y, x2, y2, 0) % Erase previous line
exit when Mouse.ButtonMoved ("up")
Mouse.Where (x2, y2, buttons)
Draw.Line (x, y, x2, y2, colourdraw) % Draw line to position
end loop
Mouse.ButtonWait ("up", x2, y2, btnNumber, btnUpDown)
Draw.Line (x, y, x2, y2, colourdraw) % Draw line to final position
end loop
View.ClipOff
elsif newx > 10 and newx < 51 and newy > 351 and newy < 398 and
newb = 1 then
% Text.
elsif newx > 10 and newx < 51 and newy > 201 and newy < 251 and
newb = 1 then
% Cirlce.
View.ClipSet (115, 68, 638, 398)
loop
Mouse.ButtonWait ("down", x, y, btnNumber, btnUpDown)
newx := x
y2 := y
loop
drawbox (113, 66, 640, 400, 7)
Draw.Box (115, 68, 638, 398, 7)
drawfill (114, 67, 1, 7)
Draw.Oval (x, y, x2, y2, 0) % Erase previous line
exit when Mouse.ButtonMoved ("up")
Mouse.Where (x2, y2, buttons)
Draw.Oval (x, y, x2, y2, colourdraw) % Draw line to position
end loop
Mouse.ButtonWait ("up", x2, y2, btnNumber, btnUpDown)
Draw.Oval (x, y, x2, y2, colourdraw) % Draw line to final position
end loop
View.ClipOff
elsif newx > 51 and newx < 94 and newy > 201 and newy < 251 and
newb = 1 then
% Box.
View.ClipSet (115, 68, 638, 398)
loop
Mouse.ButtonWait ("down", x, y, btnNumber, btnUpDown)
x2 := x
y2 := y
loop
drawbox (113, 66, 640, 400, 7)
Draw.Box (115, 68, 638, 398, 7)
drawfill (114, 67, 1, 7)
Draw.Box (x, y, x2, y2, 0) % Erase previous line
exit when Mouse.ButtonMoved ("up")
Mouse.Where (x2, y2, buttons)
Draw.Box (x, y, x2, y2, colourdraw) % Draw line to position
end loop
Mouse.ButtonWait ("up", x2, y2, btnNumber, btnUpDown)
Draw.Box (x, y, x2, y2, colourdraw) % Draw line to final position
end loop
View.ClipOff
elsif newx > 10 and newx < 51 and newy > 151 and newy < 251 and
newb = 1 then
% Star.
View.ClipSet (115, 68, 638, 398)
loop
Mouse.ButtonWait ("down", x, y, btnNumber, btnUpDown)
x2 := x
y2 := y
loop
drawbox (113, 66, 640, 400, 7)
Draw.Box (115, 68, 638, 398, 7)
drawfill (114, 67, 1, 7)
Draw.Star (x, y, x2, y2, 0) % Erase previous line
exit when Mouse.ButtonMoved ("up")
Mouse.Where (x2, y2, buttons)
Draw.Star (x, y, x2, y2, colourdraw) % Draw line to position
end loop
Mouse.ButtonWait ("up", x2, y2, btnNumber, btnUpDown)
Draw.Star (x, y, x2, y2, colourdraw) % Draw line to final position
end loop
View.ClipOff
elsif newx > 51 and newx < 92 and newy > 149 and newy < 201 and
newb = 1 then
% Maple Leaf.
View.ClipSet (115, 68, 638, 398)
loop
Mouse.ButtonWait ("down", x, y, btnNumber, btnUpDown)
x2 := x
y2 := y
loop
drawbox (113, 66, 640, 400, 7)
Draw.Box (115, 68, 638, 398, 7)
drawfill (114, 67, 1, 7)
Draw.MapleLeaf (x, y, x2, y2, 0) % Erase previous leaf.
exit when Mouse.ButtonMoved ("up")
Mouse.Where (x2, y2, buttons)
Draw.MapleLeaf (x, y, x2, y2, colourdraw) % Leaf line to %position.
end loop
Mouse.ButtonWait ("up", x2, y2, btnNumber, btnUpDown)
Draw.MapleLeaf (x, y, x2, y2, colourdraw) % Leaf line to final %position.
end loop
View.ClipOff
elsif newx > 0 and newx < 650 and newy > 439 then
% This is here because I am using the menu thingy from GUI
exit when GUI.ProcessEvent
end if
end loop
|