Hi all, this is a successor of my libLayer. It allows you to draw on any window and receive and even block mouse clicks + key presses.
This is the most simple example. Select the window with Simba's target picker and run. check the Examples for more advanced examples.
Simba Code:
{$i WindowOverlay/WindowOverlay.simba}
var
Overlay: TWindowOverlay;
begin
Overlay := TWindowOverlay.Create();
Overlay.DrawText('Hello world', 'Arial', 30, False, Point(5, 5), $0000FF);
Overlay.Paint();
while True do
Wait(100);
end.
The following drawing methods are exported (under TWindowOverlay and TOverlayBitmap) but you can still use a TMufasaBitmap if you wish. Check the MufasaBitmap example for usage.
Simba Code:
procedure TWindowOverlay.DrawText(Text, Font: String; Size: Int32; Bold, Smooth: Boolean; Position: TPoint; Color: Int32); constref;
procedure TWindowOverlay.DrawCircle(P: TPoint; Radius: Int32; Fill: Boolean; Color: Int32); constref;
procedure TWindowOverlay.DrawBox(Box: TBox; Fill: Boolean; Color: Int32); constref;
procedure TWindowOverlay.DrawTPA(TPA: TPointArray; Color: Int32); constref;
procedure TWindowOverlay.DrawATPA(ATPA: T2DPointArray); constref;
procedure TWindowOverlay.Clear(Color: Int32 = 0); constref; overload;
procedure TWindowOverlay.Clear(Box: TBox; Color: Int32 = 0); constref; overload;
procedure TWindowOverlay.CalculateText(Text, Font: String; Size: Int32; Bold: Boolean; var W, H: Int32); constref; overload;
procedure TWindowOverlay.DrawText(Text, Font: String; Size: Int32; Bold, Smooth: Boolean; WordBreak: Boolean; Box: TBox; Color: Int32); constref; overload;
procedure TWindowOverlay.CalculateText(Text, Font: String; Size: Int32; Bold, WordBreak: Boolean; var Box: TBox); constref; overload;
function TWindowOverlay.Width: Int32; constref;
function TWindowOverlay.Height: Int32; constref;
function TWindowOverlay.Data: PRGB32; constref;
procedure TWindowOverlay.Draw(P: TPoint; Src: PRGB32; SrcW, SrcH: Int32); constref; overload;
procedure TWindowOverlay.Draw(P: TPoint; FilePath: PChar); constref; overload;
procedure TWindowOverlay.Draw(P: TPoint; BMP: TOverlayBitmap); constref; overload;
procedure TWindowOverlay.DrawLine(Start, Stop: TPoint; Color: Int32); constref;
procedure TWindowOverlay.DrawTPARainbow(TPA: TPointArray); constref;
procedure TWindowOverlay.SetPixel(X, Y: Int32; Color: Int32); constref;
function TWindowOverlay.GetPixel(X, Y: Int32): Int32; constref;
procedure TWindowOverlay.Draw(P: TPoint; FilePath: String); constref; overload;
procedure TWindowOverlay.Draw(P: TPoint; BMP: TMufasaBitmap); constref; overload;
function TWindowOverlay.ToMufasaBitmap: TMufasaBitmap; constref;
Callbacks:
Simba Code:
procedure TWindowOverlay.SetOnClick(Event: TOverlayClickEvent);
procedure TWindowOverlay.SetOnKeyPress(Event: TOverlayKeyEvent);
TOverlayClickEvent = procedure(Sender: TObject; X, Y: Int32; Button: Int32; var Block: Boolean);
TOverlayKeyEvent = procedure(Sender: TObject; VirtualKey: Int32; Char: Char; var Block: Boolean);
Other:
Simba Code:
function TWindowOverlay.Add(Area: TBox): TOverlayBitmap; // Add a new bitmap which will always be drawn on top of everything else.
procedure TWindowOverlay.PaintInterval(Interval: Int32); // Automatically paint every x milliseconds
procedure TWindowOverlay.BeginUpdate; // Pause automatic painting
procedure TWindowOverlay.EndUpdate; // Resume automatic painting
procedure TWindowOverlay.DrawMouse(Toggle: Boolean); // Draw mouse tails (rainbow)
procedure TWindowOverlay.DrawMouseManual(Toggle: Boolean); // True for mouse trails when Simba moves the mouse, false for mouse trails when you move the mouse
procedure TWindowOverlay.DrawMouseCursor(Toggle: Boolean); // Draw mouse cursor (red cross)
To download grab the latest WindowOverlay.zip from github and extract into your Simba includes folder.