1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-13 21:05:12 -05:00

Merge previous revision + added GetNativeWindow and GetImageTarget.

Also fixed OCRBench.

Also committing the .lpi's as svn sucks ass. :-) 
EXCEPT FOR THE SAMUFASAGUI .lpi AS IT HAS BEEN LOCKED, lmfao




git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@468 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2010-01-25 21:21:18 +00:00
parent 8addf78a8a
commit b1d07ff6d4
6 changed files with 225 additions and 120 deletions

View File

@ -7,7 +7,7 @@
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Icon Value="0"/> <Icon Value="0"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="7"/> <ActiveEditorIndexAtStart Value="0"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -31,12 +31,12 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="20"> <Units Count="23">
<Unit0> <Unit0>
<Filename Value="project1.lpr"/> <Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="project1"/> <UnitName Value="project1"/>
<UsageCount Value="67"/> <UsageCount Value="69"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="unit1.pas"/> <Filename Value="unit1.pas"/>
@ -44,10 +44,10 @@
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/> <UnitName Value="Unit1"/>
<CursorPos X="103" Y="81"/> <CursorPos X="30" Y="15"/>
<TopLine Value="67"/> <TopLine Value="1"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="67"/> <UsageCount Value="69"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
@ -73,10 +73,10 @@
<Unit4> <Unit4>
<Filename Value="../../Units/MMLCore/client.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<UnitName Value="Client"/> <UnitName Value="Client"/>
<CursorPos X="25" Y="50"/> <CursorPos X="27" Y="48"/>
<TopLine Value="31"/> <TopLine Value="30"/>
<EditorIndex Value="4"/> <EditorIndex Value="7"/>
<UsageCount Value="34"/> <UsageCount Value="35"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
@ -84,8 +84,8 @@
<UnitName Value="ocr"/> <UnitName Value="ocr"/>
<CursorPos X="73" Y="16"/> <CursorPos X="73" Y="16"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="6"/> <EditorIndex Value="9"/>
<UsageCount Value="34"/> <UsageCount Value="35"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
@ -93,8 +93,8 @@
<UnitName Value="bitmaps"/> <UnitName Value="bitmaps"/>
<CursorPos X="18" Y="81"/> <CursorPos X="18" Y="81"/>
<TopLine Value="47"/> <TopLine Value="47"/>
<EditorIndex Value="12"/> <EditorIndex Value="14"/>
<UsageCount Value="33"/> <UsageCount Value="34"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
@ -102,8 +102,8 @@
<UnitName Value="ocrutil"/> <UnitName Value="ocrutil"/>
<CursorPos X="39" Y="208"/> <CursorPos X="39" Y="208"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="3"/> <EditorIndex Value="6"/>
<UsageCount Value="33"/> <UsageCount Value="34"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
@ -117,17 +117,15 @@
<UnitName Value="tpa"/> <UnitName Value="tpa"/>
<CursorPos X="5" Y="557"/> <CursorPos X="5" Y="557"/>
<TopLine Value="535"/> <TopLine Value="535"/>
<EditorIndex Value="11"/>
<UsageCount Value="31"/> <UsageCount Value="31"/>
<Loaded Value="True"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="../../Units/MMLCore/mufasatypesutil.pas"/> <Filename Value="../../Units/MMLCore/mufasatypesutil.pas"/>
<UnitName Value="mufasatypesutil"/> <UnitName Value="mufasatypesutil"/>
<CursorPos X="25" Y="8"/> <CursorPos X="25" Y="8"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="9"/> <EditorIndex Value="12"/>
<UsageCount Value="30"/> <UsageCount Value="31"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
@ -135,8 +133,8 @@
<UnitName Value="finder"/> <UnitName Value="finder"/>
<CursorPos X="78" Y="455"/> <CursorPos X="78" Y="455"/>
<TopLine Value="432"/> <TopLine Value="432"/>
<EditorIndex Value="5"/> <EditorIndex Value="8"/>
<UsageCount Value="27"/> <UsageCount Value="28"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
@ -156,24 +154,26 @@
<UnitName Value="files"/> <UnitName Value="files"/>
<CursorPos X="7" Y="103"/> <CursorPos X="7" Y="103"/>
<TopLine Value="34"/> <TopLine Value="34"/>
<EditorIndex Value="8"/> <EditorIndex Value="11"/>
<UsageCount Value="24"/> <UsageCount Value="25"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit14> </Unit14>
<Unit15> <Unit15>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<UnitName Value="colourpicker"/> <UnitName Value="colourpicker"/>
<CursorPos X="20" Y="56"/> <CursorPos X="48" Y="238"/>
<TopLine Value="37"/> <TopLine Value="226"/>
<UsageCount Value="10"/> <EditorIndex Value="1"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/> <Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<UnitName Value="windowselector"/> <UnitName Value="windowselector"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="33"/>
<TopLine Value="1"/> <TopLine Value="12"/>
<EditorIndex Value="10"/> <EditorIndex Value="13"/>
<UsageCount Value="16"/> <UsageCount Value="17"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
@ -181,150 +181,175 @@
<UnitName Value="Window"/> <UnitName Value="Window"/>
<CursorPos X="94" Y="338"/> <CursorPos X="94" Y="338"/>
<TopLine Value="323"/> <TopLine Value="323"/>
<EditorIndex Value="2"/>
<UsageCount Value="15"/> <UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="../../Units/MMLCore/mufasatypes.pas"/> <Filename Value="../../Units/MMLCore/mufasatypes.pas"/>
<UnitName Value="MufasaTypes"/> <UnitName Value="MufasaTypes"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="277"/> <TopLine Value="277"/>
<EditorIndex Value="1"/> <EditorIndex Value="5"/>
<UsageCount Value="14"/> <UsageCount Value="15"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/fontloader.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="fontloader"/> <UnitName Value="fontloader"/>
<CursorPos X="34" Y="121"/> <CursorPos X="42" Y="106"/>
<TopLine Value="89"/> <TopLine Value="89"/>
<EditorIndex Value="7"/> <EditorIndex Value="10"/>
<UsageCount Value="22"/> <UsageCount Value="24"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit19> </Unit19>
<Unit20>
<Filename Value="../../Units/MMLCore/os_linux.pas"/>
<UnitName Value="os_linux"/>
<CursorPos X="48" Y="61"/>
<TopLine Value="37"/>
<EditorIndex Value="2"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit20>
<Unit21>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<UnitName Value="IOManager"/>
<CursorPos X="87" Y="102"/>
<TopLine Value="227"/>
<EditorIndex Value="4"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit21>
<Unit22>
<Filename Value="../../Units/MMLCore/os_windows.pas"/>
<UnitName Value="os_windows"/>
<CursorPos X="65" Y="64"/>
<TopLine Value="45"/>
<EditorIndex Value="3"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit22>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="191" Column="50" TopLine="183"/> <Caret Line="11" Column="26" TopLine="1"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="unit1.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="9" Column="66" TopLine="1"/> <Caret Line="84" Column="26" TopLine="66"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="unit1.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="34" Column="16" TopLine="1"/> <Caret Line="87" Column="22" TopLine="69"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="unit1.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="149" Column="13" TopLine="117"/> <Caret Line="73" Column="41" TopLine="55"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="unit1.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="135" Column="69" TopLine="124"/> <Caret Line="11" Column="24" TopLine="1"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="../../Units/MMLCore/ocr.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="340" Column="78" TopLine="325"/> <Caret Line="91" Column="11" TopLine="71"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="62" Column="64" TopLine="46"/> <Caret Line="48" Column="27" TopLine="30"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="unit1.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="91" Column="43" TopLine="74"/> <Caret Line="69" Column="35" TopLine="51"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="unit1.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="89" Column="13" TopLine="71"/> <Caret Line="41" Column="32" TopLine="34"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="../../Units/MMLCore/mufasatypesutil.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="8" Column="25" TopLine="1"/> <Caret Line="66" Column="28" TopLine="45"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="71" Column="47" TopLine="51"/> <Caret Line="87" Column="6" TopLine="82"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="unit1.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="91" Column="1" TopLine="67"/> <Caret Line="200" Column="37" TopLine="194"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="unit1.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="85" Column="41" TopLine="66"/> <Caret Line="348" Column="85" TopLine="330"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="46" Column="37" TopLine="16"/> <Caret Line="233" Column="33" TopLine="215"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="40" Column="1" TopLine="16"/> <Caret Line="17" Column="73" TopLine="1"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="54" Column="20" TopLine="23"/> <Caret Line="233" Column="33" TopLine="215"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="59" Column="1" TopLine="25"/> <Caret Line="32" Column="16" TopLine="14"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="63" Column="22" TopLine="28"/> <Caret Line="8" Column="99" TopLine="1"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="60" Column="28" TopLine="31"/> <Caret Line="12" Column="56" TopLine="5"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="79" Column="59" TopLine="58"/> <Caret Line="87" Column="29" TopLine="65"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="101" Column="18" TopLine="71"/> <Caret Line="36" Column="18" TopLine="18"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="65" Column="13" TopLine="56"/> <Caret Line="69" Column="34" TopLine="56"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="128" Column="18" TopLine="100"/> <Caret Line="36" Column="18" TopLine="18"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="57" Column="21" TopLine="39"/> <Caret Line="87" Column="47" TopLine="70"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="143" Column="16" TopLine="109"/> <Caret Line="226" Column="37" TopLine="196"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="114" Column="30" TopLine="96"/> <Caret Line="87" Column="60" TopLine="69"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="105" Column="14" TopLine="78"/> <Caret Line="95" Column="79" TopLine="70"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="103" Column="9" TopLine="85"/> <Caret Line="191" Column="107" TopLine="170"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="../../Units/MMLCore/fontloader.pas"/> <Filename Value="unit1.pas"/>
<Caret Line="176" Column="56" TopLine="145"/> <Caret Line="10" Column="8" TopLine="1"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="unit1.pas"/> <Filename Value="../../Units/MMLCore/os_windows.pas"/>
<Caret Line="80" Column="59" TopLine="40"/> <Caret Line="167" Column="15" TopLine="144"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@ -6,7 +6,9 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Client, MufasaTypes, Bitmaps, ocr, windowselector,window; StdCtrls, ExtCtrls, Client, MufasaTypes, Bitmaps, ocr, windowselector,
{$IFDEF MSWINDOWS} os_windows, {$ENDIF}
{$IFDEF LINUX} os_linux {$ENDIF};
type type
@ -31,7 +33,7 @@ type
BitmapPath: String; BitmapPath: String;
FontPath: String; FontPath: String;
CliW: TMWindow; CliW: TIOManager;
UseClient: Boolean; UseClient: Boolean;
{ private declarations } { private declarations }
public public
@ -79,14 +81,14 @@ begin
Form1.Image1.Canvas.Rectangle(0, 0, Form1.Image1.Canvas.Width, Form1.Image1.Canvas.Height); Form1.Image1.Canvas.Rectangle(0, 0, Form1.Image1.Canvas.Width, Form1.Image1.Canvas.Height);
// create and init client // create and init client
C := TClient.Create; C := TClient.Create('');
bmp := TMufasaBitmap.Create; bmp := TMufasaBitmap.Create;
if UseClient then if UseClient then
C.MWindow.SetWindow(CliW) C.IOManager.SetTarget(TWindow(CliW.GetImageTarget).GetNativeWindow())
else else
begin begin
bmp.LoadFromFile(BitmapPath); bmp.LoadFromFile(BitmapPath);
C.MWindow.SetTarget(bmp); C.IOManager.SetTarget(bmp);
end; end;
Shadow :=FShadow.Checked; Shadow :=FShadow.Checked;
@ -158,7 +160,7 @@ Var
begin begin
UseClient := True; UseClient := True;
if not assigned(CliW) then if not assigned(CliW) then
CliW := TMWindow.Create; CliW := TIOManager.Create;
WS := TMWindowSelector.Create(CliW); WS := TMWindowSelector.Create(CliW);
CliW.SetTarget(WS.Drag{$IFDEF WINDOWS},w_Window{$ENDIF}); CliW.SetTarget(WS.Drag{$IFDEF WINDOWS},w_Window{$ENDIF});
end; end;

View File

@ -223,6 +223,8 @@ interface
procedure SendText(text: string); procedure SendText(text: string);
function isKeyDown(key: Word): Boolean; function isKeyDown(key: Word): Boolean;
function GetImageTarget: TTarget;
protected protected
keymouse: TTarget; keymouse: TTarget;
image: TTarget; image: TTarget;
@ -231,6 +233,7 @@ interface
bothsame: boolean; bothsame: boolean;
procedure SetImageTarget(target: TTarget); procedure SetImageTarget(target: TTarget);
procedure SetKeyMouseTarget(target: TTarget); procedure SetKeyMouseTarget(target: TTarget);
procedure SetBothTargets(target: TTarget); procedure SetBothTargets(target: TTarget);
procedure NativeInit; virtual; abstract; procedure NativeInit; virtual; abstract;
@ -290,6 +293,12 @@ begin
image:= target; image:= target;
bothsame:= false; bothsame:= false;
end; end;
function TIOManager_Abstract.GetImageTarget: TTarget;
begin
result := image;
end;
procedure TIOManager_Abstract.SetKeyMouseTarget(target: TTarget); procedure TIOManager_Abstract.SetKeyMouseTarget(target: TTarget);
begin begin
if not(bothsame) then keymouse.Free(); if not(bothsame) then keymouse.Free();
@ -340,17 +349,34 @@ begin
result:= frozen <> nil; result:= frozen <> nil;
end; end;
function TIOManager_Abstract.GetColor(x,y : integer) : TColor; begin result:= image.GetColor(x,y); end; function TIOManager_Abstract.GetColor(x,y : integer) : TColor;
function TIOManager_Abstract.ReturnData(xs,ys,width,height: integer): TRetData; begin result:= image.ReturnData(xs,ys,width,height); end; begin
procedure TIOManager_Abstract.FreeReturnData; begin image.freeReturnData(); end; result:= image.GetColor(x,y);
end;
function TIOManager_Abstract.ReturnData(xs,ys,width,height: integer): TRetData;
begin
result:= image.ReturnData(xs,ys,width,height);
end;
procedure TIOManager_Abstract.FreeReturnData;
begin
image.freeReturnData();
end;
function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer;
begin
SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y));
end;
function TIOManager_Abstract.SetTarget(bmp : TMufasaBitmap) : integer;
begin
SetImageTarget(TRawTarget.Create(bmp.FData,bmp.width,bmp.height));
end;
function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; begin SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y)); end;
function TIOManager_Abstract.SetTarget(bmp : TMufasaBitmap) : integer; begin SetImageTarget(TRawTarget.Create(bmp.FData,bmp.width,bmp.height)); end;
function TIOManager_Abstract.SetTarget(name: string; initargs: pointer): integer; function TIOManager_Abstract.SetTarget(name: string; initargs: pointer): integer;
var var
client: TEIOS_Client; client: TEIOS_Client;
begin begin
if not eios_controller.ClientExists(name) then raise Exception.Create('EIOS Client by specified name does not exist'); if not eios_controller.ClientExists(name) then
raise Exception.Create('EIOS Client by specified name does not exist');
client:= eios_controller.GetClient(name); client:= eios_controller.GetClient(name);
SetBothTargets(TEIOS_Target.Create(client, initargs)); SetBothTargets(TEIOS_Target.Create(client, initargs));
end; end;
@ -369,10 +395,23 @@ begin
{not sure if image needs activation or not, if its a native window keymouse == image so it should be good.} {not sure if image needs activation or not, if its a native window keymouse == image so it should be good.}
end; end;
procedure TIOManager_Abstract.GetMousePos(var X, Y: Integer); begin keymouse.GetMousePosition(x,y) end; procedure TIOManager_Abstract.GetMousePos(var X, Y: Integer);
procedure TIOManager_Abstract.SetMousePos(X, Y: Integer); begin keymouse.MoveMouse(x,y); end; begin
procedure TIOManager_Abstract.HoldMouse(x,y : integer; button: TClickType); begin keymouse.HoldMouse(x,y,button); end; keymouse.GetMousePosition(x,y)
procedure TIOManager_Abstract.ReleaseMouse(x,y : integer; button: TClickType); begin keymouse.ReleaseMouse(x,y,button); end; end;
procedure TIOManager_Abstract.SetMousePos(X, Y: Integer);
begin
keymouse.MoveMouse(x,y);
end;
procedure TIOManager_Abstract.HoldMouse(x,y : integer; button: TClickType);
begin
keymouse.HoldMouse(x,y,button);
end;
procedure TIOManager_Abstract.ReleaseMouse(x,y : integer; button: TClickType);
begin
keymouse.ReleaseMouse(x,y,button);
end;
procedure TIOManager_Abstract.ClickMouse(X, Y: Integer; button: TClickType); procedure TIOManager_Abstract.ClickMouse(X, Y: Integer; button: TClickType);
begin begin
HoldMouse(x,y,button); HoldMouse(x,y,button);
@ -380,11 +419,28 @@ begin
ReleaseMouse(x,y,button); ReleaseMouse(x,y,button);
end; end;
procedure TIOManager_Abstract.KeyUp(key: Word); begin keymouse.ReleaseKey(key) end; procedure TIOManager_Abstract.KeyUp(key: Word);
procedure TIOManager_Abstract.KeyDown(key: Word); begin keymouse.HoldKey(key) end; begin
procedure TIOManager_Abstract.PressKey(key: Word); begin keyup(key); keydown(key); end; keymouse.ReleaseKey(key)
procedure TIOManager_Abstract.SendText(text: string); begin keymouse.SendString(text); end; end;
function TIOManager_Abstract.isKeyDown(key: Word): Boolean; begin result:= keymouse.IsKeyHeld(key); end; procedure TIOManager_Abstract.KeyDown(key: Word);
begin
keymouse.HoldKey(key)
end;
procedure TIOManager_Abstract.PressKey(key: Word);
begin
keyup(key);
keydown(key);
end;
procedure TIOManager_Abstract.SendText(text: string);
begin
keymouse.SendString(text);
end;
function TIOManager_Abstract.isKeyDown(key: Word): Boolean;
begin
result:= keymouse.IsKeyHeld(key);
end;
//***implementation*** TTarget //***implementation*** TTarget

View File

@ -54,7 +54,7 @@ uses
procedure FilterShadowBitmap(bmp: TMufasaBitmap); procedure FilterShadowBitmap(bmp: TMufasaBitmap);
procedure FilterCharsBitmap(bmp: TMufasaBitmap); procedure FilterCharsBitmap(bmp: TMufasaBitmap);
function GetTextAt(atX, atY, font, minspacing, maxspacing, color, len: integer): string; function GetTextAt(atX, atY, minspacing, maxspacing, color, tol, len: integer; font: string): string;
function TextToFontTPA(Text, font: String; var w, h: integer): TPointArray; function TextToFontTPA(Text, font: String; var w, h: integer): TPointArray;
function TextToFontBitmap(Text, font: String): TMufasaBitmap; function TextToFontBitmap(Text, font: String): TMufasaBitmap;
function TextToMask(Text, font: String): TMask; function TextToMask(Text, font: String): TMask;
@ -704,9 +704,17 @@ begin
result := GetUpTextAtEx(atX, atY, false); result := GetUpTextAtEx(atX, atY, false);
end; end;
function TMOCR.GetTextAt(atX, atY, font, minspacing, maxspacing, color, len: integer): string; function TMOCR.GetTextAt(atX, atY, minspacing, maxspacing, color, tol, len: integer; font: string): string;
var
fD: TocrData;
TPA: TPointArray;
begin begin
fD := Fonts.GetFont(font);
SetLength(TPA, 0);
TClient(Client).MFinder.FindColorsTolerance(TPA, color, atX, atY, {fuck}0, {fuck}0, tol);
end; end;

View File

@ -57,6 +57,8 @@ interface
procedure HoldKey(key: integer); override; procedure HoldKey(key: integer); override;
procedure ReleaseKey(key: integer); override; procedure ReleaseKey(key: integer); override;
function IsKeyHeld(key: integer): boolean; override; function IsKeyHeld(key: integer): boolean; override;
function GetNativeWindow: x.TWindow;
private private
display: PDisplay; display: PDisplay;
screennum: integer; screennum: integer;
@ -132,6 +134,11 @@ implementation
inherited Destroy; inherited Destroy;
end; end;
function TWindow.GetNativeWindow: x.TWindow;
begin
result := self.window;
end;
procedure TWindow.GetTargetDimensions(var w, h: integer); procedure TWindow.GetTargetDimensions(var w, h: integer);
var var
Old_Handler: TXErrorHandler; Old_Handler: TXErrorHandler;

View File

@ -58,6 +58,8 @@ interface
procedure HoldKey(key: integer); override; procedure HoldKey(key: integer); override;
procedure ReleaseKey(key: integer); override; procedure ReleaseKey(key: integer); override;
function IsKeyHeld(key: integer): boolean; override; function IsKeyHeld(key: integer): boolean; override;
function GetNativeWindow: Hwnd;
private private
handle: Hwnd; handle: Hwnd;
dc: HDC; dc: HDC;
@ -160,6 +162,11 @@ implementation
inherited Destroy; inherited Destroy;
end; end;
function TWindow.GetNativeWindow: Hwnd;
begin
result := handle;
end;
function TWindow.TargetValid: boolean; function TWindow.TargetValid: boolean;
begin begin
result:= IsWindow(handle); result:= IsWindow(handle);