1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-17 06:45:11 -05:00

Added ClickMouse, HoldMouse and ReleaseMouse.

Also added TClickType and TMousePress.



git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@222 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-11-10 00:46:34 +00:00
parent f9b8611336
commit afca6a0e10
5 changed files with 120 additions and 76 deletions

View File

@ -7,7 +7,7 @@
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="Mufasa Stand Alone"/> <Title Value="Mufasa Stand Alone"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="5"/> <ActiveEditorIndexAtStart Value="4"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -162,8 +162,8 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<CursorPos X="46" Y="935"/> <CursorPos X="10" Y="35"/>
<TopLine Value="922"/> <TopLine Value="21"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -221,7 +221,7 @@
<UnitName Value="Client"/> <UnitName Value="Client"/>
<CursorPos X="23" Y="42"/> <CursorPos X="23" Y="42"/>
<TopLine Value="21"/> <TopLine Value="21"/>
<EditorIndex Value="2"/> <EditorIndex Value="3"/>
<UsageCount Value="201"/> <UsageCount Value="201"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit25> </Unit25>
@ -229,9 +229,11 @@
<Filename Value="../../Units/MMLCore/mufasatypes.pas"/> <Filename Value="../../Units/MMLCore/mufasatypes.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="MufasaTypes"/> <UnitName Value="MufasaTypes"/>
<CursorPos X="84" Y="44"/> <CursorPos X="3" Y="51"/>
<TopLine Value="37"/> <TopLine Value="36"/>
<EditorIndex Value="1"/>
<UsageCount Value="201"/> <UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit26> </Unit26>
<Unit27> <Unit27>
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/> <Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
@ -273,9 +275,9 @@
<Unit32> <Unit32>
<Filename Value="../../Units/MMLCore/input.pas"/> <Filename Value="../../Units/MMLCore/input.pas"/>
<UnitName Value="Input"/> <UnitName Value="Input"/>
<CursorPos X="47" Y="78"/> <CursorPos X="44" Y="21"/>
<TopLine Value="67"/> <TopLine Value="1"/>
<EditorIndex Value="3"/> <EditorIndex Value="4"/>
<UsageCount Value="79"/> <UsageCount Value="79"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit32> </Unit32>
@ -305,9 +307,9 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="mmlpsthread"/> <UnitName Value="mmlpsthread"/>
<CursorPos X="15" Y="96"/> <CursorPos X="30" Y="198"/>
<TopLine Value="71"/> <TopLine Value="183"/>
<EditorIndex Value="6"/> <EditorIndex Value="7"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit36> </Unit36>
@ -374,9 +376,9 @@
</Unit45> </Unit45>
<Unit46> <Unit46>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<CursorPos X="88" Y="96"/> <CursorPos X="60" Y="105"/>
<TopLine Value="71"/> <TopLine Value="91"/>
<EditorIndex Value="7"/> <EditorIndex Value="10"/>
<UsageCount Value="94"/> <UsageCount Value="94"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit46> </Unit46>
@ -411,7 +413,7 @@
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="8"/> <EditorIndex Value="11"/>
<UsageCount Value="38"/> <UsageCount Value="38"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit51> </Unit51>
@ -563,9 +565,11 @@
</Unit73> </Unit73>
<Unit74> <Unit74>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/mouse.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/mouse.inc"/>
<CursorPos X="5" Y="32"/> <CursorPos X="33" Y="31"/>
<TopLine Value="1"/> <TopLine Value="20"/>
<EditorIndex Value="9"/>
<UsageCount Value="15"/> <UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit74> </Unit74>
<Unit75> <Unit75>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/>
@ -611,7 +615,7 @@
<UnitName Value="plugins"/> <UnitName Value="plugins"/>
<CursorPos X="32" Y="80"/> <CursorPos X="32" Y="80"/>
<TopLine Value="80"/> <TopLine Value="80"/>
<EditorIndex Value="1"/> <EditorIndex Value="2"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit81> </Unit81>
@ -644,8 +648,10 @@
<Unit86> <Unit86>
<Filename Value="../../Units/MMLAddon/PSInc/psdefines.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/psdefines.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="8"/>
<EditorIndex Value="8"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit86> </Unit86>
<Unit87> <Unit87>
<Filename Value="../../Units/PascalScript/x86.inc"/> <Filename Value="../../Units/PascalScript/x86.inc"/>
@ -1184,7 +1190,7 @@
<UnitName Value="framescript"/> <UnitName Value="framescript"/>
<CursorPos X="15" Y="195"/> <CursorPos X="15" Y="195"/>
<TopLine Value="180"/> <TopLine Value="180"/>
<EditorIndex Value="9"/> <EditorIndex Value="12"/>
<UsageCount Value="107"/> <UsageCount Value="107"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit161> </Unit161>
@ -1498,9 +1504,9 @@
<ComponentName Value="ColourHistoryForm"/> <ComponentName Value="ColourHistoryForm"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="colourhistory"/> <UnitName Value="colourhistory"/>
<CursorPos X="30" Y="133"/> <CursorPos X="37" Y="126"/>
<TopLine Value="108"/> <TopLine Value="41"/>
<EditorIndex Value="5"/> <EditorIndex Value="6"/>
<UsageCount Value="44"/> <UsageCount Value="44"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit208> </Unit208>
@ -1616,8 +1622,8 @@
<Filename Value="../../Units/MMLCore/mmlkeyinput.pas"/> <Filename Value="../../Units/MMLCore/mmlkeyinput.pas"/>
<UnitName Value="MMLKeyInput"/> <UnitName Value="MMLKeyInput"/>
<CursorPos X="83" Y="46"/> <CursorPos X="83" Y="46"/>
<TopLine Value="31"/> <TopLine Value="21"/>
<EditorIndex Value="4"/> <EditorIndex Value="5"/>
<UsageCount Value="20"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit225> </Unit225>
@ -1683,123 +1689,127 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit234> </Unit234>
</Units> </Units>
<JumpHistory Count="29" HistoryIndex="28"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="365" Column="12" TopLine="358"/> <Caret Line="486" Column="20" TopLine="460"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="234" Column="32" TopLine="222"/> <Caret Line="508" Column="13" TopLine="493"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="247" Column="30" TopLine="222"/> <Caret Line="249" Column="9" TopLine="241"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="628" Column="24" TopLine="613"/> <Caret Line="266" Column="24" TopLine="241"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="1325" Column="30" TopLine="1310"/> <Caret Line="267" Column="24" TopLine="241"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="1337" Column="30" TopLine="1"/> <Caret Line="322" Column="21" TopLine="307"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="638" Column="19" TopLine="623"/> <Caret Line="461" Column="7" TopLine="446"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="64" Column="42" TopLine="46"/> <Caret Line="462" Column="11" TopLine="446"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="248" Column="54" TopLine="233"/> <Caret Line="324" Column="45" TopLine="306"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="testunit.pas"/> <Filename Value="framescript.pas"/>
<Caret Line="458" Column="19" TopLine="443"/> <Caret Line="64" Column="17" TopLine="49"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="testunit.pas"/> <Filename Value="framescript.pas"/>
<Caret Line="460" Column="20" TopLine="443"/> <Caret Line="180" Column="15" TopLine="165"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="475" Column="19" TopLine="460"/> <Caret Line="327" Column="12" TopLine="306"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="486" Column="20" TopLine="460"/> <Caret Line="330" Column="19" TopLine="309"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="508" Column="13" TopLine="493"/> <Caret Line="331" Column="22" TopLine="309"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLAddon/plugins.pas"/>
<Caret Line="249" Column="9" TopLine="241"/> <Caret Line="68" Column="23" TopLine="50"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLAddon/plugins.pas"/>
<Caret Line="266" Column="24" TopLine="241"/> <Caret Line="206" Column="8" TopLine="183"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLAddon/plugins.pas"/>
<Caret Line="267" Column="24" TopLine="241"/> <Caret Line="59" Column="26" TopLine="44"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="322" Column="21" TopLine="307"/> <Caret Line="198" Column="24" TopLine="181"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="461" Column="7" TopLine="446"/> <Caret Line="35" Column="10" TopLine="21"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="462" Column="11" TopLine="446"/> <Caret Line="171" Column="18" TopLine="151"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="324" Column="45" TopLine="306"/> <Caret Line="243" Column="19" TopLine="231"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="framescript.pas"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/mouse.inc"/>
<Caret Line="64" Column="17" TopLine="49"/> <Caret Line="34" Column="54" TopLine="8"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="framescript.pas"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/mouse.inc"/>
<Caret Line="180" Column="15" TopLine="165"/> <Caret Line="36" Column="38" TopLine="13"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/input.pas"/>
<Caret Line="327" Column="12" TopLine="306"/> <Caret Line="48" Column="40" TopLine="33"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/input.pas"/>
<Caret Line="330" Column="19" TopLine="309"/> <Caret Line="49" Column="40" TopLine="33"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/input.pas"/>
<Caret Line="331" Column="22" TopLine="309"/> <Caret Line="50" Column="33" TopLine="26"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="../../Units/MMLAddon/plugins.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="68" Column="23" TopLine="50"/> <Caret Line="244" Column="19" TopLine="231"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="../../Units/MMLAddon/plugins.pas"/> <Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="206" Column="8" TopLine="183"/> <Caret Line="106" Column="95" TopLine="81"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="../../Units/MMLAddon/plugins.pas"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/mouse.inc"/>
<Caret Line="59" Column="26" TopLine="44"/> <Caret Line="31" Column="33" TopLine="20"/>
</Position29> </Position29>
<Position30>
<Filename Value="../../Units/MMLCore/input.pas"/>
<Caret Line="46" Column="34" TopLine="31"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -30,3 +30,20 @@ procedure GetMousePos(var x, y: integer);
begin begin
CurrThread.Client.MInput.GetMousePos(X, Y); CurrThread.Client.MInput.GetMousePos(X, Y);
end; end;
procedure HoldMouse(x, y: integer; clickType: TClickType);
begin
CurrThread.Client.MInput.SetMousePos(x, y);
CurrThread.Client.MInput.MouseButtonAction(x, y, clickType, mouse_Down);
end;
procedure ReleaseMouse(x, y: integer; clickType: TClickType);
begin
CurrThread.Client.MInput.SetMousePos(x, y);
CurrThread.Client.MInput.MouseButtonAction(x, y, clickType, mouse_Up);
end;
procedure ClickMouse(x, y: integer; clickType: TClickType);
begin
CurrThread.Client.MInput.ClickMouse(x, y, clickType);
end;

View File

@ -32,8 +32,11 @@ Sender.Comp.AddTypeS('TMask','record White, Black : TPointArray; WhiteHi,BlackH
Sender.Comp.AddTypes('TDTMPointDef', 'record x, y, Color, Tolerance, AreaSize, AreaShape: integer; end;'); Sender.Comp.AddTypes('TDTMPointDef', 'record x, y, Color, Tolerance, AreaSize, AreaShape: integer; end;');
Sender.Comp.AddTypes('TDTMPointDefArray', 'Array Of TDTMPointDef;'); Sender.Comp.AddTypes('TDTMPointDefArray', 'Array Of TDTMPointDef;');
Sender.Comp.AddTypes('TDTM','record MainPoint: TDTMPointDef; SubPoints: TDTMPointDefArray; end;'); Sender.Comp.AddTypes('TDTM','record MainPoint: TDTMPointDef; SubPoints: TDTMPointDefArray; end;');
Sender.Comp.AddTypeS('pDTM','record p: TPointArray; c, t, asz, ash: TIntegerArray; end'); Sender.Comp.AddTypeS('pDTM','record p: TPointArray; c, t, asz, ash: TIntegerArray; end;');
Sender.Comp.AddTypeS('T2DExtendedArray', 'array of array of extended'); Sender.Comp.AddTypeS('T2DExtendedArray', 'array of array of extended;');
Sender.Comp.AddTypeS('TClickType', '(mouse_Left, mouse_Right, mouse_Middle);');
Sender.Comp.AddTypeS('TMousePress', '(mouse_Down, mouse_Up);');
Sender.AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;'); Sender.AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
Sender.AddFunction(@psWriteln,'procedure writeln(s : string);'); Sender.AddFunction(@psWriteln,'procedure writeln(s : string);');
@ -98,6 +101,10 @@ Sender.AddFunction(@ColorToHSL, 'procedure ColorToHSL(c: integer; var r,g,b: ext
{Mouse etc.} {Mouse etc.}
Sender.AddFunction(@MoveMouse, 'procedure MoveMouse(x, y: integer);'); Sender.AddFunction(@MoveMouse, 'procedure MoveMouse(x, y: integer);');
Sender.AddFunction(@GetMousePos, 'procedure GetMousePos(var x, y: integer);'); Sender.AddFunction(@GetMousePos, 'procedure GetMousePos(var x, y: integer);');
Sender.AddFunction(@HoldMouse, 'procedure HoldMouse(x, y: integer; clickType: TClickType);');
Sender.AddFunction(@ReleaseMouse, 'procedure ReleaseMouse(x, y: integer; clickType: TClickType);');
Sender.AddFunction(@ClickMouse, 'procedure ClickMouse(x, y: integer; clickType: TClickType);');
{Keyboard} {Keyboard}
Sender.AddFunction(@KeyDown, 'procedure KeyDown(key: Word);'); Sender.AddFunction(@KeyDown, 'procedure KeyDown(key: Word);');

View File

@ -196,6 +196,7 @@ end;
{$I PSInc/Wrappers/colour.inc} {$I PSInc/Wrappers/colour.inc}
{$I PSInc/Wrappers/math.inc} {$I PSInc/Wrappers/math.inc}
{$I PSInc/Wrappers/mouse.inc} {$I PSInc/Wrappers/mouse.inc}
{$I PSInc/Wrappers/keyboard.inc} {$I PSInc/Wrappers/keyboard.inc}
{$I PSInc/Wrappers/dtm.inc} {$I PSInc/Wrappers/dtm.inc}
{$I PSInc/Wrappers/ocr.inc} {$I PSInc/Wrappers/ocr.inc}

View File

@ -174,7 +174,16 @@ var
i: integer; i: integer;
begin begin
for i := 1 to length(text) do for i := 1 to length(text) do
Self.PressKey(GetSimpleKeyCode(text[i])); begin
if((text[i] >= 'A') and (text[i] <= 'Z')) then
Self.KeyDown(VK_SHIFT);
Self.PressKey(ord(upcase(text[i])));
//Self.PressKey(GetSimpleKeyCode(text[i]));
if((text[i] >= 'A') and (text[i] <= 'Z')) then
Self.KeyUp(VK_SHIFT);
end;
end; end;
procedure TMInput.GetMousePos(var X, Y: Integer); procedure TMInput.GetMousePos(var X, Y: Integer);