1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-24 18:22:25 -05:00
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@18 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-09-04 04:26:56 +00:00
parent a6a7f0b247
commit adc6d0b6f5
5 changed files with 703 additions and 682 deletions

View File

@ -1,436 +1,443 @@
unit Window; unit Window;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
interface interface
uses uses
Classes, SysUtils, mufasatypes, Classes, SysUtils, mufasatypes,
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
windows, // For windows API windows, // For windows API
{$ENDIF} {$ENDIF}
graphics, graphics,
LCLType, LCLType,
LCLIntf // for ReleaseDC and such LCLIntf // for ReleaseDC and such
{$IFDEF LINUX}, xlib, x, xutil, ctypes{$ENDIF}; {$IFDEF LINUX}, xlib, x, xutil, ctypes{$ENDIF};
type type
{ TMWindow } { TMWindow }
TMWindow = class(TObject) TMWindow = class(TObject)
function ReturnData(xs, ys, width, height: Integer): TRetData; function ReturnData(xs, ys, width, height: Integer): TRetData;
procedure FreeReturnData; procedure FreeReturnData;
procedure GetDimensions(var W, H: Integer); procedure GetDimensions(var W, H: Integer);
function CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap; function CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap;
procedure ActivateClient; procedure ActivateClient;
{$IFDEF LINUX} {$IFDEF LINUX}
function SetTarget(XWindow: x.TWindow): integer; overload; function SetTarget(XWindow: x.TWindow): integer; overload;
{$ENDIF} {$ENDIF}
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
function UpdateDrawBitmap:boolean; function UpdateDrawBitmap:boolean;
{$ENDIF} {$ENDIF}
function SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload; function SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload;
function SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload; function SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload;
constructor Create(Client: TObject); constructor Create(Client: TObject);
destructor Destroy; override; destructor Destroy; override;
public public
// Reference to client. // Reference to client.
Client: TObject; Client: TObject;
// Target Window Mode. // Target Window Mode.
TargetMode: TTargetWindowMode; TargetMode: TTargetWindowMode;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
//Target handle; HWND //Target handle; HWND
TargetHandle : Hwnd; TargetHandle : Hwnd;
DrawBmpDataPtr : PRGB32; DrawBmpDataPtr : PRGB32;
//Works on linux as well, test it out //Works on linux as well, test it out
TargetDC : HDC; TargetDC : HDC;
DrawBitmap : TBitmap; DrawBitmap : TBitmap;
DrawBmpW,DrawBmpH : integer; DrawBmpW,DrawBmpH : integer;
{$ENDIF} {$ENDIF}
{$IFDEF LINUX} {$IFDEF LINUX}
// X Display // X Display
XDisplay: PDisplay; XDisplay: PDisplay;
// Connection Number // Connection Number
XConnectionNumber: Integer; XConnectionNumber: Integer;
// X Window // X Window
CurWindow: x.TWindow; CurWindow: x.TWindow;
// Desktop Window // Desktop Window
DesktopWindow: x.TWindow; DesktopWindow: x.TWindow;
// X Screen // X Screen
XScreen: PScreen; XScreen: PScreen;
// X Screen Number // X Screen Number
XScreenNum: Integer; XScreenNum: Integer;
// The X Image pointer. // The X Image pointer.
XWindowImage: PXImage; XWindowImage: PXImage;
{$IFDEF M_MEMORY_DEBUG} {$IFDEF M_MEMORY_DEBUG}
// XImageFreed should be True if there is currently no // XImageFreed should be True if there is currently no
// XImage loaded. If one is loaded, XImageFreed is true. // XImage loaded. If one is loaded, XImageFreed is true.
// If ReturnData is called while XImageFreed is false, // If ReturnData is called while XImageFreed is false,
// we throw an exception. // we throw an exception.
// Same for FreeReturnData with XImageFreed true. // Same for FreeReturnData with XImageFreed true.
XImageFreed: Boolean; XImageFreed: Boolean;
{$ENDIF} {$ENDIF}
{$ELSE} {$ELSE}
{$ENDIF} {$ENDIF}
ArrayPtr: PRGB32; ArrayPtr: PRGB32;
ArraySize: TPoint; ArraySize: TPoint;
end; end;
implementation implementation
uses uses
Client, // For the Client Class Client, // For the Client Class
windowutil, // For utilities such as XImageToRawImage windowutil, // For utilities such as XImageToRawImage
GraphType // For TRawImage GraphType // For TRawImage
; ;
constructor TMWindow.Create(Client: TObject); constructor TMWindow.Create(Client: TObject);
begin begin
inherited Create; inherited Create;
Self.Client := Client; Self.Client := Client;
Self.ArrayPtr := nil; Self.ArrayPtr := nil;
Self.ArraySize := Classes.Point(-1, -1); Self.ArraySize := Classes.Point(-1, -1);
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
Self.DrawBitmap := TBitmap.Create; Self.DrawBitmap := TBitmap.Create;
Self.DrawBitmap.PixelFormat:= pf32bit; Self.DrawBitmap.PixelFormat:= pf32bit;
Self.TargetMode:= w_Window; Self.TargetMode:= w_Window;
Self.TargetHandle:= windows.GetDesktopWindow; Self.TargetHandle:= windows.GetDesktopWindow;
Self.TargetDC:= GetWindowDC(Self.TargetHandle); Self.TargetDC:= GetWindowDC(Self.TargetHandle);
Self.UpdateDrawBitmap; Self.UpdateDrawBitmap;
{$ENDIF} {$ENDIF}
{$IFDEF LINUX} {$IFDEF LINUX}
Self.TargetMode := w_XWindow; Self.TargetMode := w_XWindow;
Self.XDisplay := XOpenDisplay(nil); Self.XDisplay := XOpenDisplay(nil);
if Self.XDisplay = nil then if Self.XDisplay = nil then
begin begin
// throw Exception // throw Exception
end; end;
Self.XConnectionNumber:= ConnectionNumber(Self.XDisplay); Self.XConnectionNumber:= ConnectionNumber(Self.XDisplay);
Self.XScreen := XDefaultScreenOfDisplay(Self.XDisplay); Self.XScreen := XDefaultScreenOfDisplay(Self.XDisplay);
Self.XScreenNum:= DefaultScreen(Self.XDisplay); Self.XScreenNum:= DefaultScreen(Self.XDisplay);
// The Root Window is the Desktop. :-) // The Root Window is the Desktop. :-)
Self.DesktopWindow:= RootWindow(Self.XDisplay, Self.XScreenNum); Self.DesktopWindow:= RootWindow(Self.XDisplay, Self.XScreenNum);
Self.CurWindow:= Self.DesktopWindow; Self.CurWindow:= Self.DesktopWindow;
{$ENDIF} {$ENDIF}
end; end;
destructor TMWindow.Destroy; destructor TMWindow.Destroy;
begin begin
{$IFDEF LINUX} {$IFDEF LINUX}
XCloseDisplay(Self.XDisplay); XCloseDisplay(Self.XDisplay);
{$ENDIF} {$ENDIF}
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
if TargetMode = w_Window then if TargetMode = w_Window then
ReleaseDC(TargetHandle,TargetDC); ReleaseDC(TargetHandle,TargetDC);
DrawBitmap.Free; DrawBitmap.Free;
{$ENDIF} {$ENDIF}
inherited; inherited;
end; end;
function TMWindow.ReturnData(xs, ys, width, height: Integer): TRetData; function TMWindow.ReturnData(xs, ys, width, height: Integer): TRetData;
var var
{$IFDEF LINUX} {$IFDEF LINUX}
Old_Handler: TXErrorHandler; Old_Handler: TXErrorHandler;
{$ENDIF} {$ENDIF}
TmpData: PRGB32; TmpData: PRGB32;
begin begin
case Self.TargetMode of case Self.TargetMode of
w_Window: w_Window:
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
BitBlt(Self.DrawBitmap.Canvas.Handle,0,0, width, height, Self.TargetDC, xs,ys, SRCCOPY); BitBlt(Self.DrawBitmap.Canvas.Handle,0,0, width, height, Self.TargetDC, xs,ys, SRCCOPY);
Result.Ptr:= Self.DrawBmpDataPtr; Result.Ptr:= Self.DrawBmpDataPtr;
Result.IncPtrWith:= DrawBmpW - Width; Result.IncPtrWith:= DrawBmpW - Width;
{$ENDIF} {$ENDIF}
end; end;
w_XWindow: w_XWindow:
begin begin
{$IFDEF LINUX} {$IFDEF LINUX}
{ Should be this. } { Should be this. }
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
Self.XWindowImage := XGetImage(Self.XDisplay, Self.curWindow, xs, ys, width, height, AllPlanes, ZPixmap); Self.XWindowImage := XGetImage(Self.XDisplay, Self.curWindow, xs, ys, width, height, AllPlanes, ZPixmap);
if QWord(Self.XWindowImage) = 0 then if QWord(Self.XWindowImage) = 0 then
begin begin
Writeln('ReturnData: XGetImage Error. Dumping data now:'); Writeln('ReturnData: XGetImage Error. Dumping data now:');
Writeln('xs, ys, width, height: ' + inttostr(xs) + ', ' + inttostr(ys) + Writeln('xs, ys, width, height: ' + inttostr(xs) + ', ' + inttostr(ys) +
', ' + inttostr(width) + ', ' + inttostr(height)); ', ' + inttostr(width) + ', ' + inttostr(height));
Result := nil; Result.Ptr := nil;
XSetErrorHandler(Old_Handler); Result.IncPtrWith := 0;
Exit;
end; XSetErrorHandler(Old_Handler);
WriteLn(IntToStr(Self.XWindowImage^.width) + ', ' + IntToStr(Self.XWindowImage^.height)); Exit;
Result.Ptr := PRGB32(Self.XWindowImage^.data); end;
Result.IncPtrWith := 0; WriteLn(IntToStr(Self.XWindowImage^.width) + ', ' + IntToStr(Self.XWindowImage^.height));
Result.Ptr := PRGB32(Self.XWindowImage^.data);
XSetErrorHandler(Old_Handler); Result.IncPtrWith := 0;
{$ELSE}
WriteLn('Windows doesn''t support XImage'); XSetErrorHandler(Old_Handler);
{$ENDIF} {$ELSE}
end; WriteLn('Windows doesn''t support XImage');
w_ArrayPtr: {$ENDIF}
begin end;
TmpData := Self.ArrayPtr; w_ArrayPtr:
Inc(TmpData, ys * Height + xs); begin
Result.Ptr := TmpData; TmpData := Self.ArrayPtr;
Result.IncPtrWith:= Self.ArraySize.x - width; Inc(TmpData, ys * Height + xs);
Result.Ptr := TmpData;
end; Result.IncPtrWith:= Self.ArraySize.x - width;
end;
end; end;
end;
procedure TMWindow.FreeReturnData; end;
begin
if Self.TargetMode <> w_XWindow then procedure TMWindow.FreeReturnData;
begin begin
// throw exception. if Self.TargetMode <> w_XWindow then
exit; begin
end; // throw exception.
{$IFDEF LINUX} exit;
if(QWord(Self.XWindowImage) <> 0) then // 0, nil? end;
begin {$IFDEF LINUX}
XDestroyImage(Self.XWindowImage); if(QWord(Self.XWindowImage) <> 0) then // 0, nil?
end; begin
{$ENDIF} XDestroyImage(Self.XWindowImage);
end; end;
{$ENDIF}
function TMWindow.CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap; end;
var
w,h : Integer;
ww, hh: Integer; // Bugged. For params other than 0, 0, ClientWidth, ClientHeight
Raw: TRawImage; // if other type than w_XImage
Bmp: TBitmap;
{$IFDEF LINUX} // Also thread bugged
Old_Handler: TXErrorHandler; function TMWindow.CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap;
Img: PXImage; var
{$ENDIF} w,h : Integer;
ww, hh: Integer;
begin Raw: TRawImage;
Self.GetDimensions(w, h); Bmp: TBitmap;
writeln(inttostr(xs) + ', ' + inttostr(ys) + ' : ' + inttostr(xe) + ', ' + {$IFDEF LINUX}
inttostr(ye)); Old_Handler: TXErrorHandler;
ww := xe-xs; Img: PXImage;
hh := ye-ys; {$ENDIF}
if(xs < 0) or (ys < 0) or (xe > W) or (ye > H) then
begin begin
writeln('Faulty coordinates'); Self.GetDimensions(w, h);
exit; writeln(inttostr(xs) + ', ' + inttostr(ys) + ' : ' + inttostr(xe) + ', ' +
end; inttostr(ye));
ww := xe-xs;
case Self.TargetMode Of hh := ye-ys;
w_Window: if(xs < 0) or (ys < 0) or (xe > W) or (ye > H) then
begin begin
{$IFDEF MSWINDOWS} writeln('Faulty coordinates');
Result := TBitmap.Create; exit;
Result.SetSize(ww+1,hh+1); end;
BitBlt(result.canvas.handle,0,0,ww+1,hh+1,
self.TargetDC,xs,ys, SRCCOPY); case Self.TargetMode Of
{$ENDIF} w_Window:
end; begin
w_XWindow: {$IFDEF MSWINDOWS}
begin Result := TBitmap.Create;
{$IFDEF LINUX} Result.SetSize(ww+1,hh+1);
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); BitBlt(result.canvas.handle,0,0,ww+1,hh+1,
self.TargetDC,xs,ys, SRCCOPY);
Img := XGetImage(Self.XDisplay, Self.curWindow, xs, ys, ww, hh, AllPlanes, ZPixmap); {$ENDIF}
end;
Bmp := TBitmap.Create; w_XWindow:
Bmp.LoadFromRawImage(Raw, False); begin
Result := Bmp; {$IFDEF LINUX}
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
{
If you want to use some internal Bitmap system, BitBlt to it here. Img := XGetImage(Self.XDisplay, Self.curWindow, xs, ys, ww, hh, AllPlanes, ZPixmap);
Don't forget to free Bmp! XImageToRawImage(Img, Raw);
}
//lclintf.BitBlt(Bmps[bitmap].Canvas.Handle, 0, 0, ww + 1, hh + 1, Bmp.Canvas.Handle, xs, ys, SRCCOPY); Bmp := TBitmap.Create;
//Bmp.Free; Bmp.LoadFromRawImage(Raw, False);
Result := Bmp;
XDestroyImage(Img);
XSetErrorHandler(Old_Handler); {
{$ELSE} If you want to use some internal Bitmap system, BitBlt to it here.
writeln('Windows and tXWindow'); Don't forget to free Bmp!
{$ENDIF} }
end; //lclintf.BitBlt(Bmps[bitmap].Canvas.Handle, 0, 0, ww + 1, hh + 1, Bmp.Canvas.Handle, xs, ys, SRCCOPY);
w_ArrayPtr: //Bmp.Free;
begin
XDestroyImage(Img);
ArrDataToRawImage(Self.ArrayPtr, Self.ArraySize, Raw); XSetErrorHandler(Old_Handler);
{$ELSE}
Bmp := TBitmap.Create; writeln('Windows and tXWindow');
Bmp.LoadFromRawImage(Raw, False); {$ENDIF}
Result := Bmp; end;
end; w_ArrayPtr:
end; begin
end;
ArrDataToRawImage(Self.ArrayPtr, Self.ArraySize, Raw);
procedure TMWindow.ActivateClient;
begin Bmp := TBitmap.Create;
{$IFDEF MSWINDOWS} Bmp.LoadFromRawImage(Raw, False);
if TargetMode = w_Window then Result := Bmp;
SetForegroundWindow(Self.TargetHandle); end;
{$ENDIF} end;
{$IFDEF LINUX} end;
if TargetMode = w_XWindow then
XSetInputFocus(Self.XDisplay,Self.CurWindow,RevertToParent,CurrentTime); procedure TMWindow.ActivateClient;
{$ENDIF} begin
end; {$IFDEF MSWINDOWS}
if TargetMode = w_Window then
SetForegroundWindow(Self.TargetHandle);
{$IFDEF MSWINDOWS} //Probably need one for Linux as well {$ENDIF}
function TMWindow.UpdateDrawBitmap :boolean; {$IFDEF LINUX}
var if TargetMode = w_XWindow then
w,h : integer; XSetInputFocus(Self.XDisplay,Self.CurWindow,RevertToParent,CurrentTime);
BmpInfo : Windows.TBitmap; {$ENDIF}
begin end;
GetDimensions(w,h);
DrawBitmap.SetSize(w,h); {$IFDEF MSWINDOWS} //Probably need one for Linux as well
// DrawBitmap.PixelFormat:= function TMWindow.UpdateDrawBitmap :boolean;
DrawBmpW := w; var
DrawBmpH := h; w,h : integer;
GetObject(DrawBitmap.Handle, SizeOf(BmpInfo), @BmpInfo); BmpInfo : Windows.TBitmap;
DrawBmpDataPtr := BmpInfo.bmBits; begin
end; GetDimensions(w,h);
{$ENDIF} DrawBitmap.SetSize(w,h);
// DrawBitmap.PixelFormat:=
procedure TMWindow.GetDimensions(var W, H: Integer); DrawBmpW := w;
{$IFDEF LINUX} DrawBmpH := h;
var GetObject(DrawBitmap.Handle, SizeOf(BmpInfo), @BmpInfo);
Attrib: TXWindowAttributes; DrawBmpDataPtr := BmpInfo.bmBits;
newx,newy : integer; end;
childwindow : x.TWindow; {$ENDIF}
Old_Handler: TXErrorHandler;
{$ENDIF} procedure TMWindow.GetDimensions(var W, H: Integer);
{$IFDEF MSWINDOWS} {$IFDEF LINUX}
var var
Rect : TRect; Attrib: TXWindowAttributes;
{$ENDIF} newx,newy : integer;
begin childwindow : x.TWindow;
case TargetMode of Old_Handler: TXErrorHandler;
w_Window: {$ENDIF}
begin {$IFDEF MSWINDOWS}
{$IFDEF MSWINDOWS} var
GetWindowRect(Self.TargetHandle, Rect); Rect : TRect;
w:= Rect.Right - Rect.left + 1; {$ENDIF}
h:= Rect.Bottom - Rect.Top + 1; begin
{$ENDIF} case TargetMode of
end; w_Window:
w_XWindow: begin
begin {$IFDEF MSWINDOWS}
{$IFDEF LINUX} GetWindowRect(Self.TargetHandle, Rect);
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); w:= Rect.Right - Rect.left + 1;
if XGetWindowAttributes(Self.XDisplay, Self.CurWindow, @Attrib) <> 0 Then h:= Rect.Bottom - Rect.Top + 1;
begin {$ENDIF}
XTranslateCoordinates(Self.XDisplay, Self.CurWindow, Self.DesktopWindow, 0,0, @newx, @newy, @childwindow); end;
W := Attrib.Width; w_XWindow:
H := Attrib.Height; begin
end else {$IFDEF LINUX}
begin Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
W := -1; if XGetWindowAttributes(Self.XDisplay, Self.CurWindow, @Attrib) <> 0 Then
H := -1; begin
end; XTranslateCoordinates(Self.XDisplay, Self.CurWindow, Self.DesktopWindow, 0,0, @newx, @newy, @childwindow);
XSetErrorHandler(Old_Handler); W := Attrib.Width;
{$ELSE} H := Attrib.Height;
WriteLn('You dummy! How are you going to use w_XWindow on non Linux systems?'); end else
{$ENDIF} begin
end; W := -1;
w_ArrayPtr: H := -1;
begin end;
W := Self.ArraySize.X; XSetErrorHandler(Old_Handler);
H := Self.ArraySize.Y; {$ELSE}
end; WriteLn('You dummy! How are you going to use w_XWindow on non Linux systems?');
end; {$ENDIF}
end; end;
w_ArrayPtr:
{$IFDEF LINUX} begin
function TMWindow.SetTarget(XWindow: x.TWindow): integer; overload; W := Self.ArraySize.X;
var H := Self.ArraySize.Y;
Old_Handler: TXErrorHandler; end;
begin end;
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); end;
Self.CurWindow := XWindow;
Self.TargetMode:= w_XWindow; {$IFDEF LINUX}
XSetErrorHandler(Old_Handler); function TMWindow.SetTarget(XWindow: x.TWindow): integer; overload;
end; var
{$ENDIF} Old_Handler: TXErrorHandler;
begin
function TMWindow.SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload; Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
begin Self.CurWindow := XWindow;
if NewType in [ w_XWindow, w_ArrayPtr ] then Self.TargetMode:= w_XWindow;
begin XSetErrorHandler(Old_Handler);
// throw exception end;
Exit; {$ENDIF}
end;
case NewType of function TMWindow.SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload;
w_Window : begin
begin; if NewType in [ w_XWindow, w_ArrayPtr ] then
begin
{$IFDEF MSWINDOWS} // throw exception
ReleaseDC(Self.TargetHandle,Self.TargetDC); Exit;
Self.TargetHandle := Window; end;
Self.TargetDC := GetWindowDC(Window); case NewType of
{$ENDIF} w_Window :
end; begin;
end;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
UpdateDrawBitmap; ReleaseDC(Self.TargetHandle,Self.TargetDC);
{$ENDIF} Self.TargetHandle := Window;
end; Self.TargetDC := GetWindowDC(Window);
{$ENDIF}
{ end;
This functionality is very BETA. end;
We have no way to send events to a window, so we should probably use the {$IFDEF MSWINDOWS}
desktop window? UpdateDrawBitmap;
{$ENDIF}
eg: In mouse/keys: if Self.TargetMode not in [w_Window, w_XWindow], send it end;
to the desktop.
} {
function TMWindow.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload; This functionality is very BETA.
begin We have no way to send events to a window, so we should probably use the
Self.ArrayPtr := ArrPtr; desktop window?
Self.ArraySize := Size;
Self.TargetMode:= w_ArrayPtr; eg: In mouse/keys: if Self.TargetMode not in [w_Window, w_XWindow], send it
to the desktop.
{$IFDEF LINUX} }
Self.CurWindow := Self.DesktopWindow; function TMWindow.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload;
{$ENDIF} begin
Self.ArrayPtr := ArrPtr;
{$IFDEF WINDOWS} Self.ArraySize := Size;
Self.TargetHandle:= windows.GetDesktopWindow; Self.TargetMode:= w_ArrayPtr;
{$ENDIF}
{$IFDEF LINUX}
end; Self.CurWindow := Self.DesktopWindow;
{$ENDIF}
end.
{$IFDEF WINDOWS}
Self.TargetHandle:= windows.GetDesktopWindow;
{$ENDIF}
end;
end.

View File

@ -38,7 +38,7 @@
<CursorPos X="1" Y="19"/> <CursorPos X="1" Y="19"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="51"/> <UsageCount Value="53"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@ -49,7 +49,7 @@
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<CursorPos X="33" Y="57"/> <CursorPos X="33" Y="57"/>
<TopLine Value="32"/> <TopLine Value="32"/>
<UsageCount Value="51"/> <UsageCount Value="53"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="client.pas"/> <Filename Value="client.pas"/>
@ -57,7 +57,7 @@
<UnitName Value="Client"/> <UnitName Value="Client"/>
<CursorPos X="18" Y="34"/> <CursorPos X="18" Y="34"/>
<TopLine Value="10"/> <TopLine Value="10"/>
<UsageCount Value="51"/> <UsageCount Value="53"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/> <Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
@ -72,7 +72,7 @@
<UnitName Value="MufasaTypes"/> <UnitName Value="MufasaTypes"/>
<CursorPos X="52" Y="20"/> <CursorPos X="52" Y="20"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="51"/> <UsageCount Value="53"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="window.pas"/> <Filename Value="window.pas"/>
@ -80,7 +80,7 @@
<UnitName Value="Window"/> <UnitName Value="Window"/>
<CursorPos X="4" Y="100"/> <CursorPos X="4" Y="100"/>
<TopLine Value="85"/> <TopLine Value="85"/>
<UsageCount Value="51"/> <UsageCount Value="53"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="../Documents/fpc/rtl/inc/systemh.inc"/> <Filename Value="../Documents/fpc/rtl/inc/systemh.inc"/>
@ -94,7 +94,7 @@
<UnitName Value="Input"/> <UnitName Value="Input"/>
<CursorPos X="5" Y="20"/> <CursorPos X="5" Y="20"/>
<TopLine Value="15"/> <TopLine Value="15"/>
<UsageCount Value="50"/> <UsageCount Value="52"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/> <Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
@ -109,7 +109,7 @@
<CursorPos X="46" Y="8"/> <CursorPos X="46" Y="8"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="5"/> <EditorIndex Value="5"/>
<UsageCount Value="22"/> <UsageCount Value="23"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
@ -118,35 +118,35 @@
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="6"/> <EditorIndex Value="6"/>
<UsageCount Value="22"/> <UsageCount Value="23"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
<Filename Value="Units/MMLCore/mufasatypes.pas"/> <Filename Value="Units/MMLCore/mufasatypes.pas"/>
<UnitName Value="MufasaTypes"/> <UnitName Value="MufasaTypes"/>
<CursorPos X="1" Y="18"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<UsageCount Value="22"/> <UsageCount Value="23"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<UnitName Value="Window"/> <UnitName Value="Window"/>
<CursorPos X="52" Y="394"/> <CursorPos X="5" Y="316"/>
<TopLine Value="394"/> <TopLine Value="291"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<UsageCount Value="22"/> <UsageCount Value="23"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="windowutil"/> <UnitName Value="windowutil"/>
<CursorPos X="53" Y="122"/> <CursorPos X="54" Y="20"/>
<TopLine Value="98"/> <TopLine Value="80"/>
<EditorIndex Value="3"/> <EditorIndex Value="3"/>
<UsageCount Value="43"/> <UsageCount Value="45"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
@ -182,10 +182,10 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<CursorPos X="41" Y="71"/> <CursorPos X="37" Y="112"/>
<TopLine Value="54"/> <TopLine Value="103"/>
<EditorIndex Value="4"/> <EditorIndex Value="4"/>
<UsageCount Value="19"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
@ -287,123 +287,123 @@
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="215" Column="10" TopLine="205"/> <Caret Line="10" Column="10" TopLine="1"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="225" Column="19" TopLine="215"/> <Caret Line="367" Column="46" TopLine="353"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="239" Column="19" TopLine="229"/> <Caret Line="115" Column="36" TopLine="106"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="261" Column="17" TopLine="251"/> <Caret Line="114" Column="24" TopLine="99"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="68" Column="20" TopLine="53"/> <Caret Line="94" Column="26" TopLine="79"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="329" Column="14" TopLine="298"/> <Caret Line="58" Column="78" TopLine="45"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="10" Column="10" TopLine="1"/> <Caret Line="63" Column="37" TopLine="48"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="367" Column="46" TopLine="353"/> <Caret Line="69" Column="41" TopLine="68"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="115" Column="36" TopLine="106"/> <Caret Line="73" Column="37" TopLine="64"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="114" Column="24" TopLine="99"/> <Caret Line="26" Column="40" TopLine="11"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="94" Column="26" TopLine="79"/> <Caret Line="276" Column="28" TopLine="250"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="58" Column="78" TopLine="45"/> <Caret Line="22" Column="5" TopLine="12"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="63" Column="37" TopLine="48"/> <Caret Line="48" Column="39" TopLine="32"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="69" Column="41" TopLine="68"/> <Caret Line="52" Column="50" TopLine="39"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="73" Column="37" TopLine="64"/> <Caret Line="9" Column="10" TopLine="1"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="26" Column="40" TopLine="11"/> <Caret Line="10" Column="17" TopLine="1"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="276" Column="28" TopLine="250"/> <Caret Line="11" Column="3" TopLine="1"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="22" Column="5" TopLine="12"/> <Caret Line="12" Column="13" TopLine="1"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="48" Column="39" TopLine="32"/> <Caret Line="88" Column="1" TopLine="1"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="52" Column="50" TopLine="39"/> <Caret Line="275" Column="60" TopLine="251"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/client.pas"/>
<Caret Line="9" Column="10" TopLine="1"/> <Caret Line="8" Column="46" TopLine="1"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="10" Column="17" TopLine="1"/> <Caret Line="419" Column="3" TopLine="390"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="11" Column="3" TopLine="1"/> <Caret Line="382" Column="66" TopLine="369"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="12" Column="13" TopLine="1"/> <Caret Line="202" Column="11" TopLine="187"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="Units/MMLCore/windowutil.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="88" Column="1" TopLine="1"/> <Caret Line="1" Column="1" TopLine="171"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="275" Column="60" TopLine="251"/> <Caret Line="180" Column="31" TopLine="175"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="Units/MMLCore/client.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="8" Column="46" TopLine="1"/> <Caret Line="190" Column="23" TopLine="175"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="419" Column="3" TopLine="390"/> <Caret Line="198" Column="65" TopLine="176"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="382" Column="66" TopLine="369"/> <Caret Line="26" Column="40" TopLine="6"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="202" Column="11" TopLine="187"/> <Caret Line="27" Column="37" TopLine="1"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@ -1,21 +1,21 @@
object Form1: TForm1 object Form1: TForm1
Left = 462 Left = 320
Height = 527 Height = 527
Top = 227 Top = 238
Width = 779 Width = 779
ActiveControl = Button1 ActiveControl = Button1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 527 ClientHeight = 527
ClientWidth = 779 ClientWidth = 779
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '0.9.29' LCLVersion = '0.9.29'
object Button1: TButton object Button1: TButton
Left = 69 Left = 69
Height = 25 Height = 25
Top = 32 Top = 32
Width = 75 Width = 75
Caption = 'Button1' Caption = 'Button1'
OnClick = Button1Click OnClick = Button1Click
TabOrder = 0 TabOrder = 0
end end
end end

View File

@ -1,10 +1,10 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[ LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#206#1#6'Height'#3#15#2#3'Top'#3#227#0#5'W' 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'@'#1#6'Height'#3#15#2#3'Top'#3#238#0#5'Wi'
+'idth'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'Client' +'dth'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'ClientH'
+'Height'#3#15#2#11'ClientWidth'#3#11#3#8'Position'#7#14'poScreenCenter'#10'L' +'eight'#3#15#2#11'ClientWidth'#3#11#3#8'Position'#7#14'poScreenCenter'#10'LC'
+'CLVersion'#6#6'0.9.29'#0#7'TButton'#7'Button1'#4'Left'#2'E'#6'Height'#2#25#3 +'LVersion'#6#6'0.9.29'#0#7'TButton'#7'Button1'#4'Left'#2'E'#6'Height'#2#25#3
+'Top'#2' '#5'Width'#2'K'#7'Caption'#6#7'Button1'#7'OnClick'#7#12'Button1Clic' +'Top'#2' '#5'Width'#2'K'#7'Caption'#6#7'Button1'#7'OnClick'#7#12'Button1Clic'
+'k'#8'TabOrder'#2#0#0#0#0 +'k'#8'TabOrder'#2#0#0#0#0
]); ]);

View File

@ -1,149 +1,163 @@
unit TestUnit; unit TestUnit;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Client, MufasaTypes; StdCtrls, Client, MufasaTypes;
type type
{ TForm1 } { TForm1 }
TForm1 = class(TForm) TForm1 = class(TForm)
Button1: TButton; Button1: TButton;
procedure Button1Click(Sender: TObject); procedure Button1Click(Sender: TObject);
private private
{ private declarations } { private declarations }
public public
{ public declarations } { public declarations }
end; end;
var var
Form1: TForm1; Form1: TForm1;
implementation implementation
type type
TMyThread = class(TThread) TMyThread = class(TThread)
private private
protected protected
procedure Execute; override; procedure Execute; override;
public public
Constructor Create(CreateSuspended : boolean); Constructor Create(CreateSuspended : boolean);
end; end;
constructor TMyThread.Create(CreateSuspended : boolean); constructor TMyThread.Create(CreateSuspended : boolean);
begin begin
FreeOnTerminate := True; FreeOnTerminate := True;
inherited Create(CreateSuspended); inherited Create(CreateSuspended);
end; end;
procedure TMyThread.Execute; procedure TMyThread.Execute;
Var Var
Client: TClient; Client: TClient;
w,h, x, y, xx, yy, i:integer; w,h, x, y, xx, yy, i:integer;
bmp: TBitmap; bmp: TBitmap;
ReturnData : TRetData; ReturnData : TRetData;
arr: Array Of Integer; arr: Array Of Integer;
LoopY,LoopX : integer; LoopY,LoopX : integer;
begin begin
while (not Terminated) do while (not Terminated) do
begin begin
Writeln('Creating the client'); Writeln('Creating the client');
Client := TClient.Create; Client := TClient.Create;
Writeln('Getting the dimensions'); Writeln('Getting the dimensions');
Client.MWindow.GetDimensions(w, h); Client.MWindow.GetDimensions(w, h);
writeln(inttostr(w) + ' , ' + inttostr(h)); writeln(inttostr(w) + ' , ' + inttostr(h));
Writeln('Setting target'); Writeln('Setting target');
// Client.MWindow.SetTarget(67232,w_window); // Client.MWindow.SetTarget(67232,w_window);
{ SetLength(Arr, 9); { SetLength(Arr, 9);
for i := 0 to high(arr) do for i := 0 to high(arr) do
arr[i] := $FFFFFF; arr[i] := $FFFFFF;
Client.MWIndow.SetTarget(PRGB32(@Arr[0]), Point(3, 3)); } Client.MWIndow.SetTarget(PRGB32(@Arr[0]), Point(3, 3)); }
// Client.MWindow.ActivateClient; // Client.MWindow.ActivateClient;
Client.MWindow.GetDimensions(w, h);
Writeln('Copying BMP'); Client.MWindow.GetDimensions(w, h);
bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h); Writeln('Copying BMP');
bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h);
{$IFDEF WINDOWS} Writeln('Saving BMP');
bmp.SaveToFile('c:\test1.bmp');
{$ENDIF} {$IFDEF WINDOWS}
{$IFDEF LINUX} bmp.SaveToFile('c:\test1.bmp');
bmp.SaveToFile('/tmp/test1.bmp'); {$ENDIF}
{$ENDIF} {$IFDEF LINUX}
// bmp.Free; bmp.SaveToFile('/tmp/test1.bmp');
{$ENDIF}
//Sleep(1000);
Client.MInput.GetMousePos(x, y); writeln('Copied Bitmap');
writeln(inttostr(x) + ' , ' + inttostr(y)); // bmp.Free;
Client.MInput.SetMousePos(50, 50); //Sleep(1000);
Client.MInput.GetMousePos(x, y); Client.MInput.GetMousePos(x, y);
writeln(inttostr(x) + ' , ' + inttostr(y)); writeln(inttostr(x) + ' , ' + inttostr(y));
Client.MInput.ClickMouse(60, 60, mouse_Right); Client.MInput.SetMousePos(50, 50);
LoopX:= w div 2; Client.MInput.GetMousePos(x, y);
LoopY:= h div 2; writeln(inttostr(x) + ' , ' + inttostr(y));
bmp.SetSize(Loopx + 1, Loopy + 1);
ReturnData := Client.MWindow.ReturnData(0, 0, Loopx + 1, Loopy + 1); Client.MInput.ClickMouse(60, 60, mouse_Right);
SetLength(Arr,(Loopy + 1) * (Loopx + 1));
for yy := 0 to Loopy do LoopX:= w div 2;
begin; LoopY:= h div 2;
for xx := 0 to Loopx do bmp.SetSize(Loopx + 1, Loopy + 1);
begin ReturnData := Client.MWindow.ReturnData(0, 0, Loopx + 1, Loopy + 1);
{ Do comparison here }
Arr[yy * (loopx + 1) + xx] :=RGBToColor(ReturnData.Ptr^.B,ReturnData.Ptr^.G,ReturnData.Ptr^.R); SetLength(Arr,(Loopy + 1) * (Loopx + 1));
Bmp.Canvas.Pixels[xx,yy] := clwhite xor RGBToColor(ReturnData.Ptr^.R,ReturnData.Ptr^.G,ReturnData.Ptr^.B);
inc(ReturnData.Ptr); for yy := 0 to Loopy do
end; begin;
Inc(ReturnData.Ptr,ReturnData.IncPtrWith); for xx := 0 to Loopx do
end; begin
{$IFDEF WINDOWS} { Do comparison here }
bmp.SaveToFile('c:\test2.bmp'); Arr[yy * (loopx + 1) + xx] :=RGBToColor(ReturnData.Ptr^.B,ReturnData.Ptr^.G,ReturnData.Ptr^.R);
{$ENDIF}
{$IFDEF LINUX} // not thread stable on linux.
bmp.SaveToFile('/tmp/test2.bmp'); //Bmp.Canvas.Pixels[xx,yy] := RGBToColor(ReturnData.Ptr^.R,ReturnData.Ptr^.G,ReturnData.Ptr^.B);
{$ENDIF}
Bmp.free; inc(ReturnData.Ptr);
// Client.MWIndow.SetTarget(PRGB32(@Arr[0]), Point(Loopx + 1, Loopy + 1)); end;
Client.MWindow.FreeReturnData; Inc(ReturnData.Ptr,ReturnData.IncPtrWith);
end;
Client.MInput.IsMouseButtonDown(mouse_Left);
Sleep(1000);
if Client.MInput.IsMouseButtonDown(mouse_Left) then
writeln('Left mouse is down!'); {$IFDEF WINDOWS}
if Client.MInput.IsMouseButtonDown(mouse_Right) then bmp.SaveToFile('c:\test2.bmp');
writeln('Right mouse is down!'); {$ENDIF}
if Client.MInput.IsMouseButtonDown(mouse_Middle) then {$IFDEF LINUX}
writeln('Middle mouse is down!'); bmp.SaveToFile('/tmp/test2.bmp');
Client.Destroy; {$ENDIF}
writeln('Test completed successfully'); Bmp.free;
break;
end; // Client.MWIndow.SetTarget(PRGB32(@Arr[0]), Point(Loopx + 1, Loopy + 1));
end; Client.MWindow.FreeReturnData;
Client.MInput.IsMouseButtonDown(mouse_Left);
{ TForm1 } Sleep(1000);
if Client.MInput.IsMouseButtonDown(mouse_Left) then
procedure TForm1.Button1Click(Sender: TObject); writeln('Left mouse is down!');
Var if Client.MInput.IsMouseButtonDown(mouse_Right) then
MyThread: TMyThread; writeln('Right mouse is down!');
if Client.MInput.IsMouseButtonDown(mouse_Middle) then
begin writeln('Middle mouse is down!');
MyThread := TMyThread.Create(True); Client.Destroy;
MyThread.Resume; writeln('Test completed successfully');
end; break;
end;
initialization end;
{$I testunit.lrs}
end. { TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
Var
MyThread: TMyThread;
begin
MyThread := TMyThread.Create(True);
MyThread.Resume;
end;
initialization
{$I testunit.lrs}
end.