Blame lazarus/mouse-maze/unit1.pas
|
|
418c04 |
unit Unit1;
|
|
|
418c04 |
|
|
|
418c04 |
{$mode objfpc}{$H+}
|
|
|
418c04 |
|
|
|
418c04 |
interface
|
|
|
418c04 |
|
|
|
418c04 |
uses
|
|
|
418c04 |
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
|
|
418c04 |
StdCtrls;
|
|
|
418c04 |
|
|
|
418c04 |
type
|
|
|
418c04 |
|
|
|
418c04 |
{ TForm1 }
|
|
|
418c04 |
|
|
|
418c04 |
TForm1 = class(TForm)
|
|
|
418c04 |
Button1: TButton;
|
|
|
418c04 |
Image1: TImage;
|
|
|
418c04 |
Label1: TLabel;
|
|
|
418c04 |
procedure Button1Click(Sender: TObject);
|
|
|
418c04 |
procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer
|
|
|
418c04 |
);
|
|
|
418c04 |
private
|
|
|
418c04 |
{ private declarations }
|
|
|
418c04 |
public
|
|
|
418c04 |
{ public declarations }
|
|
|
418c04 |
end;
|
|
|
418c04 |
|
|
|
418c04 |
var
|
|
|
418c04 |
Form1: TForm1;
|
|
|
418c04 |
play: boolean = false;
|
|
|
418c04 |
|
|
|
418c04 |
implementation
|
|
|
418c04 |
|
|
|
418c04 |
{$R *.lfm}
|
|
|
418c04 |
|
|
|
418c04 |
procedure TForm1.Button1Click(Sender: TObject);
|
|
|
418c04 |
begin
|
|
|
418c04 |
play := true;
|
|
|
418c04 |
Label1.Caption := 'Play';
|
|
|
418c04 |
end;
|
|
|
418c04 |
|
|
|
418c04 |
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
|
|
|
418c04 |
Y: Integer);
|
|
|
418c04 |
begin
|
|
|
418c04 |
if play = true then begin
|
|
|
418c04 |
if Image1.Picture.Bitmap.Canvas.Pixels[X, Y] = clBlack then begin
|
|
|
418c04 |
Label1.Caption := 'You looooze';
|
|
|
418c04 |
play := false;
|
|
|
418c04 |
end;
|
|
|
418c04 |
if Image1.Picture.Bitmap.Canvas.Pixels[X, Y] = clYellow then begin
|
|
|
418c04 |
Label1.Caption := 'You WIN!!!';
|
|
|
418c04 |
play := false;
|
|
|
418c04 |
end;
|
|
|
418c04 |
end;
|
|
|
418c04 |
end;
|
|
|
418c04 |
|
|
|
418c04 |
end.
|
|
|
418c04 |
|