mirror of
https://git.sr.ht/~rabbits/macintosh_cookbook
synced 2024-12-28 17:29:52 +00:00
49 lines
814 B
ObjectPascal
49 lines
814 B
ObjectPascal
program ExampleDraw;
|
|
|
|
const
|
|
radius = 10;
|
|
var
|
|
cursor, prev: Point;
|
|
isDown: Boolean;
|
|
|
|
procedure WhenDownChanged;
|
|
begin
|
|
MoveTo(prev.h, prev.v);
|
|
LineTo(cursor.h, cursor.v);
|
|
MoveTo(300 - prev.h, prev.v);
|
|
LineTo(300 - cursor.h, cursor.v);
|
|
GetMouse(prev);
|
|
end;
|
|
|
|
procedure WhenDown;
|
|
begin
|
|
GetMouse(cursor);
|
|
if cursor.h <> prev.h then
|
|
if cursor.v <> prev.v then
|
|
WhenDownChanged;
|
|
end;
|
|
|
|
procedure MainLoop;
|
|
begin
|
|
repeat {Until we click outside screen}
|
|
while button do
|
|
begin
|
|
GetMouse(cursor);
|
|
GetMouse(prev);
|
|
MoveTo(cursor.h, cursor.v);
|
|
LineTo(prev.h, prev.v);
|
|
repeat {Tight loop until button up}
|
|
WhenDown;
|
|
until not Button;
|
|
end;
|
|
until cursor.h > 300;
|
|
end;
|
|
|
|
begin
|
|
|
|
ShowDrawing;
|
|
Writeln('Started');
|
|
MainLoop;
|
|
Writeln('stopped');
|
|
|
|
end. |