mirror of
https://github.com/moparisthebest/Simba
synced 2024-12-24 08:18:52 -05:00
bf4e1e5a69
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@159 3f818213-9676-44b0-a9b4-5e4c4e03d09d
112 lines
1.8 KiB
ObjectPascal
112 lines
1.8 KiB
ObjectPascal
program project1;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
uses
|
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
|
cthreads,
|
|
{$ENDIF}{$ENDIF}
|
|
Classes, SysUtils, CustApp,
|
|
Forms,Interfaces,
|
|
LCLIntf,
|
|
Client
|
|
|
|
|
|
{ you can add units after this };
|
|
|
|
type
|
|
|
|
{ MufasaTests }
|
|
|
|
MufasaTests = class(TCustomApplication)
|
|
protected
|
|
procedure DoRun; override;
|
|
public
|
|
constructor Create(TheOwner: TComponent); override;
|
|
destructor Destroy; override;
|
|
procedure WriteHelp; virtual;
|
|
end;
|
|
|
|
{ MufasaTests }
|
|
|
|
procedure MufasaTests.DoRun;
|
|
|
|
var
|
|
ErrorMsg: String;
|
|
Time: DWord;
|
|
C: TClient;
|
|
I, W, H, X, Y: Integer;
|
|
|
|
begin
|
|
// quick check parameters
|
|
ErrorMsg:=CheckOptions('h','help');
|
|
if ErrorMsg<>'' then begin
|
|
ShowException(Exception.Create(ErrorMsg));
|
|
Terminate;
|
|
Exit;
|
|
end;
|
|
|
|
// parse parameters
|
|
if HasOption('h','help') then begin
|
|
WriteHelp;
|
|
Terminate;
|
|
Exit;
|
|
end;
|
|
|
|
{ add your program here }
|
|
C := TClient.Create;
|
|
|
|
C.MWindow.GetDimensions(W, H);
|
|
Time := GetTickCount;
|
|
for i := 0 to 100 do
|
|
C.MFinder.FindColor(X, Y, 0, 0, 0, W - 1, H - 1);
|
|
writeln('Time: ' + IntToStr(GetTickCount - Time));
|
|
|
|
if C.MFinder.FindColor(X, Y, 0, 0, 0, W - 1, H - 1) then
|
|
begin
|
|
C.MInput.SetMousePos(X, Y);
|
|
writeln('found!');
|
|
end else
|
|
begin
|
|
writeln('not found!');
|
|
end;
|
|
|
|
|
|
|
|
C.Free;
|
|
|
|
|
|
// stop program loop
|
|
Terminate;
|
|
end;
|
|
|
|
constructor MufasaTests.Create(TheOwner: TComponent);
|
|
begin
|
|
inherited Create(TheOwner);
|
|
StopOnException:=True;
|
|
end;
|
|
|
|
destructor MufasaTests.Destroy;
|
|
begin
|
|
inherited Destroy;
|
|
end;
|
|
|
|
procedure MufasaTests.WriteHelp;
|
|
begin
|
|
{ add your help code here }
|
|
writeln('Usage: ',ExeName,' -h');
|
|
end;
|
|
|
|
var
|
|
Application: MufasaTests;
|
|
|
|
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
|
|
|
|
begin
|
|
Application:=MufasaTests.Create(nil);
|
|
Application.Title:='My Application';
|
|
Application.Run;
|
|
Application.Free;
|
|
end.
|
|
|