1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-11 11:55:02 -05:00

Added various Set/Get target methods and a system where freeing targets is optional, but avaliable to those that might set lots of targets. All of a script's targets will be freed when the TIOManager is freed.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@476 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
BenLand100 2010-01-26 06:12:49 +00:00
parent 3fef7ac7ed
commit a0a89be1f2
6 changed files with 261 additions and 152 deletions

View File

@ -11,7 +11,7 @@
<Title Value="Simba"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
<ActiveEditorIndexAtStart Value="10"/>
<ActiveEditorIndexAtStart Value="5"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -190,7 +190,7 @@
<UnitName Value="Client"/>
<CursorPos X="15" Y="67"/>
<TopLine Value="49"/>
<EditorIndex Value="7"/>
<EditorIndex Value="8"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit20>
@ -265,9 +265,9 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="mmlpsthread"/>
<CursorPos X="31" Y="260"/>
<TopLine Value="243"/>
<EditorIndex Value="10"/>
<CursorPos X="61" Y="256"/>
<TopLine Value="331"/>
<EditorIndex Value="11"/>
<UsageCount Value="202"/>
<Loaded Value="True"/>
</Unit30>
@ -349,7 +349,7 @@
<UnitName Value="bitmaps"/>
<CursorPos X="12" Y="93"/>
<TopLine Value="83"/>
<EditorIndex Value="11"/>
<EditorIndex Value="12"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
</Unit42>
@ -495,8 +495,10 @@
<Unit64>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="90"/>
<TopLine Value="95"/>
<EditorIndex Value="7"/>
<UsageCount Value="44"/>
<Loaded Value="True"/>
</Unit64>
<Unit65>
<Filename Value="../../Units/PascalScript/uPSCompiler.pas"/>
@ -764,10 +766,10 @@
</Unit102>
<Unit103>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/window.inc"/>
<CursorPos X="12" Y="63"/>
<TopLine Value="30"/>
<CursorPos X="51" Y="34"/>
<TopLine Value="19"/>
<EditorIndex Value="5"/>
<UsageCount Value="16"/>
<UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit103>
<Unit104>
@ -1540,7 +1542,7 @@
<CursorPos X="52" Y="609"/>
<TopLine Value="585"/>
<EditorIndex Value="3"/>
<UsageCount Value="37"/>
<UsageCount Value="38"/>
<Loaded Value="True"/>
</Unit216>
<Unit217>
@ -1590,7 +1592,7 @@
<UnitName Value="framefunctionlist"/>
<CursorPos X="26" Y="295"/>
<TopLine Value="7"/>
<UsageCount Value="182"/>
<UsageCount Value="185"/>
</Unit223>
<Unit224>
<Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/>
@ -1618,7 +1620,7 @@
<CursorPos X="59" Y="173"/>
<TopLine Value="151"/>
<EditorIndex Value="4"/>
<UsageCount Value="12"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit227>
<Unit228>
@ -1647,7 +1649,7 @@
<UnitName Value="simpleanalyzer"/>
<CursorPos X="52" Y="104"/>
<TopLine Value="193"/>
<UsageCount Value="169"/>
<UsageCount Value="172"/>
</Unit231>
<Unit232>
<Filename Value="../../Units/Misc/mPasLex.pas"/>
@ -1705,10 +1707,10 @@
</Unit239>
<Unit240>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<CursorPos X="40" Y="59"/>
<TopLine Value="36"/>
<CursorPos X="75" Y="68"/>
<TopLine Value="51"/>
<EditorIndex Value="6"/>
<UsageCount Value="27"/>
<UsageCount Value="28"/>
<Loaded Value="True"/>
</Unit240>
<Unit241>
@ -1724,7 +1726,7 @@
<UnitName Value="updater"/>
<CursorPos X="38" Y="211"/>
<TopLine Value="65"/>
<UsageCount Value="142"/>
<UsageCount Value="145"/>
</Unit242>
<Unit243>
<Filename Value="updateform.pas"/>
@ -1735,7 +1737,7 @@
<ComponentState Value="1"/>
<CursorPos X="111" Y="102"/>
<TopLine Value="207"/>
<UsageCount Value="137"/>
<UsageCount Value="140"/>
</Unit243>
<Unit244>
<Filename Value="../../../Documents/lazarus/lcl/fileutil.pas"/>
@ -1856,7 +1858,7 @@
<UnitName Value="simbasettings"/>
<CursorPos X="26" Y="9"/>
<TopLine Value="11"/>
<UsageCount Value="100"/>
<UsageCount Value="103"/>
</Unit261>
<Unit262>
<Filename Value="../../Units/MMLAddon/settings.pas"/>
@ -1894,7 +1896,7 @@
<UnitName Value="reportbug"/>
<CursorPos X="53" Y="23"/>
<TopLine Value="21"/>
<UsageCount Value="83"/>
<UsageCount Value="86"/>
</Unit266>
<Unit267>
<Filename Value="../../Units/Synapse/synsock.pas"/>
@ -1951,7 +1953,7 @@
<UnitName Value="newinternets"/>
<CursorPos X="37" Y="171"/>
<TopLine Value="153"/>
<UsageCount Value="79"/>
<UsageCount Value="82"/>
</Unit274>
<Unit275>
<Filename Value="reportbug.lrs"/>
@ -1997,19 +1999,19 @@
<Unit281>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<UnitName Value="IOManager"/>
<CursorPos X="67" Y="53"/>
<TopLine Value="34"/>
<CursorPos X="53" Y="202"/>
<TopLine Value="194"/>
<EditorIndex Value="0"/>
<UsageCount Value="30"/>
<UsageCount Value="31"/>
<Loaded Value="True"/>
</Unit281>
<Unit282>
<Filename Value="../../Units/MMLCore/os_linux.pas"/>
<UnitName Value="os_linux"/>
<CursorPos X="36" Y="69"/>
<TopLine Value="56"/>
<EditorIndex Value="9"/>
<UsageCount Value="29"/>
<CursorPos X="48" Y="61"/>
<TopLine Value="45"/>
<EditorIndex Value="10"/>
<UsageCount Value="30"/>
<Loaded Value="True"/>
</Unit282>
<Unit283>
@ -2022,10 +2024,10 @@
<Unit284>
<Filename Value="../../Units/MMLCore/os_windows.pas"/>
<UnitName Value="os_windows"/>
<CursorPos X="22" Y="164"/>
<TopLine Value="155"/>
<EditorIndex Value="12"/>
<UsageCount Value="25"/>
<CursorPos X="54" Y="348"/>
<TopLine Value="319"/>
<EditorIndex Value="13"/>
<UsageCount Value="26"/>
<Loaded Value="True"/>
</Unit284>
<Unit285>
@ -2048,7 +2050,7 @@
<UnitName Value="libloader"/>
<CursorPos X="1" Y="149"/>
<TopLine Value="128"/>
<UsageCount Value="37"/>
<UsageCount Value="40"/>
</Unit287>
<Unit288>
<Filename Value="../../Units/MMLAddon/tpa.pas"/>
@ -2061,8 +2063,8 @@
<Filename Value="../../Units/PascalScript/x86.inc"/>
<CursorPos X="8" Y="157"/>
<TopLine Value="140"/>
<EditorIndex Value="8"/>
<UsageCount Value="15"/>
<EditorIndex Value="9"/>
<UsageCount Value="16"/>
<Loaded Value="True"/>
</Unit289>
<Unit290>
@ -2084,127 +2086,131 @@
<CursorPos X="70" Y="1393"/>
<TopLine Value="1364"/>
<EditorIndex Value="2"/>
<UsageCount Value="12"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit292>
</Units>
<JumpHistory Count="29" HistoryIndex="28">
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/window.inc"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position1>
<Position2>
<Filename Value="../../Units/PascalScript/x86.inc"/>
<Caret Line="592" Column="60" TopLine="584"/>
</Position2>
<Position3>
<Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="36" Column="17" TopLine="27"/>
</Position3>
<Position4>
<Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="48" Column="50" TopLine="34"/>
</Position4>
<Position5>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="345" Column="27" TopLine="311"/>
</Position5>
<Position6>
<Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="69" Column="36" TopLine="56"/>
</Position6>
<Position7>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="201" Column="29" TopLine="195"/>
</Position7>
<Position8>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="372" Column="45" TopLine="348"/>
</Position8>
<Position9>
</Position1>
<Position2>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="202" Column="29" TopLine="177"/>
</Position9>
<Position10>
</Position2>
<Position3>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="346" Column="59" TopLine="328"/>
</Position10>
<Position11>
</Position3>
<Position4>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="47" Column="34" TopLine="34"/>
</Position11>
<Position12>
</Position4>
<Position5>
<Filename Value="../../Units/MMLCore/tpa.pas"/>
<Caret Line="76" Column="21" TopLine="58"/>
</Position12>
<Position13>
</Position5>
<Position6>
<Filename Value="../../Units/MMLCore/tpa.pas"/>
<Caret Line="77" Column="21" TopLine="58"/>
</Position6>
<Position7>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="31" Column="54" TopLine="23"/>
</Position7>
<Position8>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="85" Column="37" TopLine="69"/>
</Position8>
<Position9>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="25" Column="12" TopLine="12"/>
</Position9>
<Position10>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="26" Column="12" TopLine="12"/>
</Position10>
<Position11>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="20" Column="13" TopLine="12"/>
</Position11>
<Position12>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="656" Column="23" TopLine="625"/>
</Position12>
<Position13>
<Filename Value="../../Units/MMLCore/fontloader.pas"/>
<Caret Line="63" Column="34" TopLine="37"/>
</Position13>
<Position14>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="31" Column="54" TopLine="23"/>
<Caret Line="710" Column="61" TopLine="692"/>
</Position14>
<Position15>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="85" Column="37" TopLine="69"/>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="55" Column="42" TopLine="37"/>
</Position15>
<Position16>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="25" Column="12" TopLine="12"/>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="714" Column="22" TopLine="692"/>
</Position16>
<Position17>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="26" Column="12" TopLine="12"/>
<Filename Value="../../Units/MMLCore/fontloader.pas"/>
<Caret Line="55" Column="29" TopLine="37"/>
</Position17>
<Position18>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="20" Column="13" TopLine="12"/>
<Filename Value="../../Units/MMLCore/fontloader.pas"/>
<Caret Line="79" Column="10" TopLine="61"/>
</Position18>
<Position19>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="656" Column="23" TopLine="625"/>
<Caret Line="729" Column="26" TopLine="702"/>
</Position19>
<Position20>
<Filename Value="../../Units/MMLCore/fontloader.pas"/>
<Caret Line="63" Column="34" TopLine="37"/>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="712" Column="8" TopLine="703"/>
</Position20>
<Position21>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="710" Column="61" TopLine="692"/>
<Caret Line="721" Column="23" TopLine="703"/>
</Position21>
<Position22>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="55" Column="42" TopLine="37"/>
<Caret Line="751" Column="10" TopLine="720"/>
</Position22>
<Position23>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="714" Column="22" TopLine="692"/>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="233" Column="29" TopLine="438"/>
</Position23>
<Position24>
<Filename Value="../../Units/MMLCore/fontloader.pas"/>
<Caret Line="55" Column="29" TopLine="37"/>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="299" Column="27" TopLine="249"/>
</Position24>
<Position25>
<Filename Value="../../Units/MMLCore/fontloader.pas"/>
<Caret Line="79" Column="10" TopLine="61"/>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="294" Column="30" TopLine="282"/>
</Position25>
<Position26>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="729" Column="26" TopLine="702"/>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="317" Column="30" TopLine="302"/>
</Position26>
<Position27>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="712" Column="8" TopLine="703"/>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="249" Column="58" TopLine="230"/>
</Position27>
<Position28>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="721" Column="23" TopLine="703"/>
<Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="354" Column="12" TopLine="331"/>
</Position28>
<Position29>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="751" Column="10" TopLine="720"/>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<Caret Line="14" Column="58" TopLine="1"/>
</Position29>
<Position30>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<Caret Line="24" Column="102" TopLine="12"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@ -26,14 +26,44 @@ begin;
CurrThread.Client.IOManager.SetDesktop;
end;
procedure SetTargetArray(P: Integer; w, h: integer);
function SetTargetArray(P: Integer; w, h: integer): integer;
begin
CurrThread.Client.IOManager.SetTarget(PRGB32(P), classes.point(w,h));
result:= CurrThread.Client.IOManager.SetTarget(PRGB32(P), classes.point(w,h));
end;
procedure SetTargetBitmap(bitmap: Integer);
function SetTargetBitmap(bitmap: Integer): integer;
begin;
CurrThread.Client.IOManager.SetTarget(CurrThread.Client.MBitmaps[Bitmap]);
result:= CurrThread.Client.IOManager.SetTarget(CurrThread.Client.MBitmaps[Bitmap]);
end;
function SetEIOSTarget(name: string; args: Variant): integer;
begin
result:= CurrThread.Client.IOManager.SetTarget(name, @args);
end;
procedure SetImageTarget(idx: integer);
begin
CurrThread.Client.IOManager.SetImageTarget(idx);
end;
procedure SetKeyMouseTarget(idx: integer);
begin
CurrThread.Client.IOManager.SetKeyMouseTarget(idx);
end;
function GetImageTarget: integer;
begin
CurrThread.Client.IOManager.GetImageTarget(result);
end;
function GetKeyMouseTarget: integer;
begin
CurrThread.Client.IOManager.GetKeyMouseTarget(result);
end;
procedure FreeTarget(idx: integer);
begin
CurrThread.Client.IOManager.FreeTarget(idx);
end;
procedure GetClientDimensions(out w, h: integer);

View File

@ -63,9 +63,15 @@ SetCurrSection('Window');
AddFunction(@Freeze, 'function Freeze: boolean;');
AddFunction(@Unfreeze, 'function Unfreeze: boolean;');
AddFunction(@GetClientDimensions, 'procedure GetClientDimensions(var w, h:integer);');
AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer);');
AddFunction(@SetTargetBitmap,'function SetTargetBitmap(Bitmap : integer): integer;');
AddFunction(@SetTargetArray, 'function SetTargetArray(P: Integer; w, h: integer): integer;');
AddFunction(@SetEIOSTarget, 'function SetEIOSTarget(name: string; initargs: Variant): integer;');
AddFunction(@SetImageTarget,'procedure SetImageTarget(idx: integer);');
AddFunction(@SetKeyMouseTarget,'procedure SetKeyMouseTarget(idx: integer);');
AddFunction(@GetImageTarget,'function GetImageTarget: integer;');
AddFunction(@GetKeyMouseTarget,'function GetKeyMouseTarget: integer;');
AddFunction(@FreeTarget,'procedure FreeTarget(idx: integer);');
AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient');
AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; w, h: integer);');
AddFunction(@ActivateClient, 'procedure ActivateClient;');
AddFunction(@IsTargetValid, 'function IsTargetValid: boolean;');

View File

@ -223,21 +223,33 @@ interface
procedure SendText(text: string);
function isKeyDown(key: Word): Boolean;
function GetImageTarget: TTarget;
function GetImageTarget: TTarget; overload;
function GetKeyMouseTarget: TTarget; overload;
procedure GetImageTarget(var idx: integer); overload;
procedure GetKeyMouseTarget(var idx: integer); overload;
procedure SetImageTarget(idx: integer);
procedure SetKeyMouseTarget(idx: integer);
procedure FreeTarget(idx: integer);
protected
function SetImageTarget(target: TTarget): integer;
function SetKeyMouseTarget(target: TTarget): integer;
function SetBothTargets(target: TTarget): integer;
procedure NativeInit; virtual; abstract;
procedure NativeFree; virtual; abstract;
private
keymouse: TTarget;
image: TTarget;
frozen: TTarget;
freezebuffer: prgb32;
bothsame: boolean;
procedure SetImageTarget(target: TTarget);
procedure SetKeyMouseTarget(target: TTarget);
procedure SetBothTargets(target: TTarget);
procedure NativeInit; virtual; abstract;
procedure NativeFree; virtual; abstract;
idxarr: array of TTarget;
function GetTargetIdx(target: TTarget): integer;
function GetIdxTarget(idx: integer): TTarget;
end;
implementation
@ -253,16 +265,13 @@ implementation
constructor TIOManager_Abstract.Create(plugin_dir: string);
begin
inherited Create;
SetLength(idxarr,0);
eios_controller.AddPath(plugin_dir);
keymouse:= nil;
image:= nil;
frozen:= nil;
NativeInit;
SetDesktop;
{
self.create;
eios_controller.AddAndLoadPath(plugin_dir);
}
end;
constructor TIOManager_Abstract.Create;
@ -276,22 +285,61 @@ begin
end;
destructor TIOManager_Abstract.Destroy;
var
i: integer;
begin
if bothsame then keymouse.Destroy() else
begin
keymouse.Free();
image.Free();
end;
if IsFrozen then frozen.Destroy();
for i:= high(idxarr) downto 0 do
idxarr[i].Free;
end;
procedure TIOManager_Abstract.SetImageTarget(target: TTarget);
procedure TIOManager_Abstract.FreeTarget(idx: integer);
begin
if idx > high(idxarr) then
raise Exception.Create('Invalid target index');
if idxarr[idx] = nil then
raise Exception.Create('Double free of target');
idxarr[idx].Free;
idxarr[idx]:= nil;
end;
function TIOManager_Abstract.GetTargetIdx(target: TTarget): integer;
var
i: integer;
begin
result:= -1;
for i:= 0 to high(idxarr) do
begin
if idxarr[i] = target then
begin
result:= i;
exit;
end;
if (idxarr[i] = nil) and (result = -1) then
result:= i;
end;
if result = -1 then
begin
SetLength(idxarr,Length(idxarr) + 1);
result:= high(idxarr);
end;
idxarr[result]:= target;
end;
function TIOManager_Abstract.GetIdxTarget(idx: integer): TTarget;
begin
if idx > high(idxarr) then
raise Exception.Create('Invalid target index');
if idxarr[idx] = nil then
raise Exception.Create('No target with specified index');
result:= idxarr[idx];
end;
function TIOManager_Abstract.SetImageTarget(target: TTarget): integer;
begin
if IsFrozen then
raise Exception.Create('You cannot set a target when Frozen');
if not(bothsame) then image.Free();
result:= GetTargetIdx(target);
image:= target;
bothsame:= false;
end;
function TIOManager_Abstract.GetImageTarget: TTarget;
@ -299,24 +347,24 @@ begin
result := image;
end;
procedure TIOManager_Abstract.SetKeyMouseTarget(target: TTarget);
function TIOManager_Abstract.SetKeyMouseTarget(target: TTarget): integer;
begin
if not(bothsame) then keymouse.Free();
result:= GetTargetIdx(target);
keymouse:= target;
bothsame:= false;
end;
procedure TIOManager_Abstract.SetBothTargets(target: TTarget);
function TIOManager_Abstract.GetKeyMouseTarget: TTarget;
begin
result := keymouse;
end;
function TIOManager_Abstract.SetBothTargets(target: TTarget): integer;
begin
if IsFrozen then
raise Exception.Create('You cannot set a target when Frozen');
if bothsame then image.Destroy() else
begin
image.Free();
keymouse.Free();
end;
result:= GetTargetIdx(target);
image:= target;
keymouse:= target;
bothsame:= true;
end;
procedure TIOManager_Abstract.SetFrozen(makefrozen: boolean);
@ -326,9 +374,6 @@ var
begin
if (makefrozen) and (IsFrozen) then
raise Exception.Create('The window is already frozen.');
//BenLand100 edit: I say we leave this exception out. POLS
//if not(isfrozen) and (frozen = nil) then
// raise Exception.Create('The window is not frozen.');
if makefrozen then //No need for the Frozen = nil check, already done above with the exception.
begin
frozen:= image;
@ -364,11 +409,11 @@ end;
function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer;
begin
SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y));
result:= 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));
result:= SetImageTarget(TRawTarget.Create(bmp.FData,bmp.width,bmp.height));
end;
function TIOManager_Abstract.SetTarget(name: string; initargs: pointer): integer;
@ -378,7 +423,29 @@ begin
if not eios_controller.ClientExists(name) then
raise Exception.Create('EIOS Client by specified name does not exist');
client:= eios_controller.GetClient(name);
SetBothTargets(TEIOS_Target.Create(client, initargs));
result:= SetBothTargets(TEIOS_Target.Create(client, initargs));
end;
procedure TIOManager_Abstract.SetImageTarget(idx: integer);
begin
image:= GetIdxTarget(idx);
end;
procedure TIOManager_Abstract.SetKeyMouseTarget(idx: integer);
begin
keymouse:= GetIdxTarget(idx);
end;
procedure TIOManager_Abstract.GetImageTarget(var idx: integer);
begin
if IsFrozen then
raise Exception.Create('Cannot get image target while frozen');
idx:= GetTargetIdx(image);
end;
procedure TIOManager_Abstract.GetKeyMouseTarget(var idx: integer);
begin
idx:= GetTargetIdx(keymouse);
end;
function TIOManager_Abstract.TargetValid: Boolean;

View File

@ -58,7 +58,7 @@ interface
procedure ReleaseKey(key: integer); override;
function IsKeyHeld(key: integer): boolean; override;
function GetNativeWindow: x.TWindow;
function GetNativeWindow: TNativeWindow;
private
display: PDisplay;
screennum: integer;
@ -134,7 +134,7 @@ implementation
inherited Destroy;
end;
function TWindow.GetNativeWindow: x.TWindow;
function TWindow.GetNativeWindow: TNativeWindow;
begin
result := self.window;
end;

View File

@ -59,7 +59,7 @@ interface
procedure ReleaseKey(key: integer); override;
function IsKeyHeld(key: integer): boolean; override;
function GetNativeWindow: Hwnd;
function GetNativeWindow: TNativeWindow;
private
handle: Hwnd;
dc: HDC;
@ -74,7 +74,7 @@ interface
public
constructor Create;
constructor Create(plugin_dir: string);
function SetTarget(target: Hwnd): integer; overload;
function SetTarget(target: TNativeWindow): integer; overload;
procedure SetDesktop; override;
protected
DesktopHWND : Hwnd;
@ -162,7 +162,7 @@ implementation
inherited Destroy;
end;
function TWindow.GetNativeWindow: Hwnd;
function TWindow.GetNativeWindow: TNativeWindow;
begin
result := handle;
end;
@ -345,7 +345,7 @@ implementation
SetBothTargets(TWindow.Create(DesktopHWND));
end;
function TIOManager.SetTarget(target: Hwnd): integer;
function TIOManager.SetTarget(target: TNativeWindow): integer;
begin
SetBothTargets(TWindow.Create(target));
end;