Blame lazarus/texture/unit1.pas

1a994e
unit Unit1;
1a994e
1a994e
{$mode objfpc}{$H+}
1a994e
1a994e
interface
1a994e
1a994e
uses
1a994e
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
1a994e
1a994e
type
1a994e
1a994e
  { TForm1 }
1a994e
1a994e
  TForm1 = class(TForm)
1a994e
    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
1a994e
  private
1a994e
    { private declarations }
1a994e
  public
1a994e
    { public declarations }
1a994e
  end;
1a994e
1a994e
var
1a994e
  Form1: TForm1;
1a994e
  px: integer = 0;
1a994e
  py: integer = 0;
1a994e
1a994e
implementation
1a994e
1a994e
{$R *.lfm}
1a994e
1a994e
procedure Line(x1, y1, x2, y2: integer);
1a994e
var
1a994e
  col, row: integer;
1a994e
begin
1a994e
  for col := -10 to 10 do begin
1a994e
    for row := -10 to 10 do begin
1a994e
      Form1.Canvas.MoveTo(x1 + col*200, y1 + row*200);
1a994e
      Form1.Canvas.LineTo(x2 + col*200, y2 + row*200);
1a994e
    end;
1a994e
  end;
1a994e
end;
1a994e
1a994e
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
1a994e
  Y: Integer);
1a994e
begin
1a994e
  if ssRight in Shift then Form1.Refresh;
1a994e
  if ssLeft in Shift then Line(px, py, x, y);
1a994e
  px := x;
1a994e
  py := y;
1a994e
end;
1a994e
1a994e
end.
1a994e