From: BillSn0w
Is there any way to make SMART compatible with other games?…
I'd like to use simba with a Java based game. I used to use Scar to draw on top of the game screen using getclientcanvas.
Example:
getclientcanvas.Pen.Color := clRed;
getclientcanvas.Rectangle(207, 155, 472, 195);
In Scar, this would draw a red rectangle from (207, 155) to (472, 195)…
From all of my research, I can only find mention of drawing with Simba onto the SMART canvas. I don't need the minimizable mouse integration or any of that… I just need the canvas.
If there's any other canvas that can be used with Simba, or any way to just create a blank debug canvas, it would be great to use it without SMART…
Get someone to export "GetDisplayHandle" or "GetNativeDisplay" from Simba..
{$IFDEF LINUX}
function TWindow.GetNativeDisplay: PtrUInt;
begin
Result := self.display;
end;
{$ELSE}
function TWindow.GetNativeDisplay: PtrUInt;
begin
Result := self.dc;
end;
{$ENDIF}
OR:
{$IFDEF LINUX}
Function GetDisplayHandle(Wnd: TNativeWindow): PtrUInt;
begin
Result := XOpenDisplay(NULL);
end;
Procedure FreeDisplayHandle(Wnd: TNativeWindow; Dpy: PtrUInt);
begin
XCloseDisplay(Dpy);
end;
{$ELSE}
Function GetDisplayHandle(Wnd: TNativeWindow): PtrUInt;
begin
Result := GetDC(Wnd);
end;
Procedure FreeDisplayHandle(Wnd: TNativeWindow; DC: PtrUInt);
begin
ReleaseDC(Wnd, DC);
end;
{$ENDIF}
Either set will allow you to draw on external windows.. They're not currently exported and don't currently exist..
If it does get exported or added, then you could do:
var
T: TCanvas;
begin
T.Init();
T.setHandle(GetNativeDisplay()); //whatever window you drag the cross-hairs on OR target.
T.SetPixels(TPAFromBox(IntToBox(100, 100, 200, 200)), $FF); //draw a red box
T.Free();
end.
But for now you'll have to use plugins.