mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-21 08:45:06 -05:00
Tests on a thread now.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@9 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
4cc31f4693
commit
93916bf9c1
@ -276,6 +276,7 @@ begin
|
||||
begin
|
||||
// throw exception
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
function TMWindow.SetTarget(ArrPtr: PRGB32): integer; overload;
|
||||
|
129
project1.lpi
129
project1.lpi
@ -6,7 +6,7 @@
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="4"/>
|
||||
<ActiveEditorIndexAtStart Value="6"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -35,10 +35,10 @@
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
<CursorPos X="63" Y="17"/>
|
||||
<CursorPos X="60" Y="16"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="42"/>
|
||||
<UsageCount Value="44"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -49,7 +49,7 @@
|
||||
<UnitName Value="TestUnit"/>
|
||||
<CursorPos X="33" Y="57"/>
|
||||
<TopLine Value="32"/>
|
||||
<UsageCount Value="42"/>
|
||||
<UsageCount Value="44"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="client.pas"/>
|
||||
@ -57,7 +57,7 @@
|
||||
<UnitName Value="Client"/>
|
||||
<CursorPos X="18" Y="34"/>
|
||||
<TopLine Value="10"/>
|
||||
<UsageCount Value="42"/>
|
||||
<UsageCount Value="44"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
|
||||
@ -74,7 +74,7 @@
|
||||
<UnitName Value="MufasaTypes"/>
|
||||
<CursorPos X="52" Y="20"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="42"/>
|
||||
<UsageCount Value="44"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="window.pas"/>
|
||||
@ -82,7 +82,7 @@
|
||||
<UnitName Value="Window"/>
|
||||
<CursorPos X="4" Y="100"/>
|
||||
<TopLine Value="85"/>
|
||||
<UsageCount Value="42"/>
|
||||
<UsageCount Value="44"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="../../Documents/fpc/rtl/inc/systemh.inc"/>
|
||||
@ -96,7 +96,7 @@
|
||||
<UnitName Value="Input"/>
|
||||
<CursorPos X="5" Y="20"/>
|
||||
<TopLine Value="15"/>
|
||||
<UsageCount Value="41"/>
|
||||
<UsageCount Value="43"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
@ -111,7 +111,7 @@
|
||||
<Filename Value="Units/MMLCore/client.pas"/>
|
||||
<UnitName Value="Client"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="12"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -120,7 +120,7 @@
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<UnitName Value="Input"/>
|
||||
<CursorPos X="42" Y="141"/>
|
||||
<TopLine Value="1"/>
|
||||
<TopLine Value="125"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -137,8 +137,8 @@
|
||||
<Unit12>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<UnitName Value="Window"/>
|
||||
<CursorPos X="40" Y="265"/>
|
||||
<TopLine Value="249"/>
|
||||
<CursorPos X="20" Y="279"/>
|
||||
<TopLine Value="258"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -149,7 +149,7 @@
|
||||
<UnitName Value="windowutil"/>
|
||||
<CursorPos X="45" Y="13"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="34"/>
|
||||
<UsageCount Value="36"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/>
|
||||
@ -190,8 +190,8 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="TestUnit"/>
|
||||
<CursorPos X="84" Y="34"/>
|
||||
<TopLine Value="28"/>
|
||||
<CursorPos X="30" Y="72"/>
|
||||
<TopLine Value="64"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="15"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -249,124 +249,124 @@
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="../../Documents/fpc/packages/x11/src/xlib.pp"/>
|
||||
<Caret Line="1272" Column="47" TopLine="1257"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="97" Column="63" TopLine="82"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="76" Column="6" TopLine="47"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="8" Column="33" TopLine="1"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="80" Column="66" TopLine="76"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="100" Column="29" TopLine="84"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="95" Column="31" TopLine="69"/>
|
||||
<Caret Line="106" Column="42" TopLine="89"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="93" Column="3" TopLine="69"/>
|
||||
<Caret Line="112" Column="55" TopLine="95"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="97" Column="63" TopLine="82"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="38" Column="69" TopLine="31"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="8" Column="33" TopLine="1"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="60" Column="14" TopLine="37"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="100" Column="29" TopLine="84"/>
|
||||
<Caret Line="22" Column="48" TopLine="1"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="106" Column="42" TopLine="89"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="9" Column="16" TopLine="1"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="112" Column="55" TopLine="95"/>
|
||||
<Caret Line="136" Column="1" TopLine="112"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="38" Column="69" TopLine="31"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="135" Column="125" TopLine="113"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="60" Column="14" TopLine="37"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="127" Column="22" TopLine="113"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="22" Column="48" TopLine="1"/>
|
||||
<Caret Line="136" Column="21" TopLine="113"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="9" Column="16" TopLine="1"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="135" Column="2" TopLine="113"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="136" Column="1" TopLine="112"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="74" Column="3" TopLine="50"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="135" Column="125" TopLine="113"/>
|
||||
<Caret Line="138" Column="31" TopLine="113"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="127" Column="22" TopLine="113"/>
|
||||
<Caret Line="131" Column="45" TopLine="117"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="136" Column="21" TopLine="113"/>
|
||||
<Caret Line="92" Column="13" TopLine="75"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="135" Column="2" TopLine="113"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="51" Column="40" TopLine="34"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="74" Column="3" TopLine="50"/>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="142" Column="1" TopLine="120"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="138" Column="31" TopLine="113"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="51" Column="35" TopLine="31"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="131" Column="45" TopLine="117"/>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="32" Column="35" TopLine="19"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="92" Column="13" TopLine="75"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="75" Column="47" TopLine="58"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="51" Column="40" TopLine="34"/>
|
||||
<Caret Line="71" Column="19" TopLine="56"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="Units/MMLCore/input.pas"/>
|
||||
<Caret Line="142" Column="1" TopLine="120"/>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="60" Column="3" TopLine="38"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="51" Column="35" TopLine="31"/>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="280" Column="20" TopLine="259"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
|
||||
<Caret Line="32" Column="35" TopLine="19"/>
|
||||
<Filename Value="Units/MMLCore/window.pas"/>
|
||||
<Caret Line="279" Column="7" TopLine="261"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="75" Column="47" TopLine="58"/>
|
||||
<Caret Line="47" Column="46" TopLine="31"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="71" Column="19" TopLine="56"/>
|
||||
<Caret Line="29" Column="5" TopLine="15"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="60" Column="3" TopLine="38"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="13" Column="56" TopLine="1"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
@ -384,6 +384,7 @@
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-dUseCThreads"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
|
@ -4,7 +4,7 @@ program project1;
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
cthreads, cmem,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, TestUnit, LResources, Client, MufasaTypes, Window, Input, windowutil;
|
||||
|
58
testunit.pas
58
testunit.pas
@ -26,47 +26,59 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
{ TForm1 }
|
||||
type
|
||||
TMyThread = class(TThread)
|
||||
private
|
||||
protected
|
||||
procedure Execute; override;
|
||||
public
|
||||
Constructor Create(CreateSuspended : boolean);
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
constructor TMyThread.Create(CreateSuspended : boolean);
|
||||
begin
|
||||
FreeOnTerminate := True;
|
||||
inherited Create(CreateSuspended);
|
||||
end;
|
||||
|
||||
procedure TMyThread.Execute;
|
||||
Var
|
||||
Client: TClient;
|
||||
w,h, x, y, xx, yy:integer;
|
||||
bmp: TBitmap;
|
||||
ptr: PRGB32;
|
||||
t:integer;
|
||||
|
||||
begin
|
||||
while (not Terminated) do
|
||||
begin
|
||||
Client := TClient.Create;
|
||||
Client.MWindow.GetDimensions(w, h);
|
||||
writeln(inttostr(w) + ' , ' + inttostr(h));
|
||||
|
||||
Client.MWindow.SetTarget(77736320);
|
||||
Client.MWindow.GetDimensions(w, h);
|
||||
writeln(inttostr(w) + ' , ' + inttostr(h));
|
||||
//Client.MWindow.SetTarget(77736320);
|
||||
|
||||
{bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h);
|
||||
bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h);
|
||||
bmp.SaveToFile('/tmp/test.bmp');
|
||||
bmp.Free;
|
||||
}
|
||||
|
||||
//Sleep(1000);
|
||||
{ Client.MInput.GetMousePos(x, y);
|
||||
writeln(inttostr(x) + ' , ' + inttostr(y)); }
|
||||
|
||||
{ Client.MInput.SetMousePos(50, 50);
|
||||
Client.MInput.GetMousePos(x, y);
|
||||
writeln(inttostr(x) + ' , ' + inttostr(y)); }
|
||||
writeln(inttostr(x) + ' , ' + inttostr(y));
|
||||
|
||||
Client.MInput.ClickMouse(40, 20, mouse_Right);
|
||||
Client.MInput.SetMousePos(50, 50);
|
||||
Client.MInput.GetMousePos(x, y);
|
||||
writeln(inttostr(x) + ' , ' + inttostr(y));
|
||||
|
||||
{ ptr := Client.MWindow.ReturnData(0, 0, w, h);
|
||||
Client.MInput.ClickMouse(60, 60, mouse_Right);
|
||||
|
||||
ptr := Client.MWindow.ReturnData(0, 0, w, h);
|
||||
for yy := 0 to h - 1 do
|
||||
for xx := 0 to w - 1 do
|
||||
begin
|
||||
{ Do comparison here }
|
||||
inc(ptr);
|
||||
end;
|
||||
Client.MWindow.FreeReturnData; }
|
||||
Client.MWindow.FreeReturnData;
|
||||
|
||||
Client.MInput.IsMouseButtonDown(mouse_Left);
|
||||
Sleep(1000);
|
||||
@ -78,6 +90,20 @@ begin
|
||||
writeln('Middle mouse is down!');
|
||||
Client.Destroy;
|
||||
writeln('Test completed successfully');
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
Var
|
||||
MyThread: TMyThread;
|
||||
|
||||
begin
|
||||
MyThread := TMyThread.Create(True);
|
||||
MyThread.Resume;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
Loading…
Reference in New Issue
Block a user