Results 1 to 7 of 7

Thread: WindowOverlay - Draw and receive events on any window

  1. #1
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default WindowOverlay - Draw and receive events on any window

    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.
    Last edited by Olly; 02-12-2018 at 02:43 PM.

  2. #2
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default

    successor > predecessor

    Great work mate ive only just stopped playing with LibLayer.
    Previously Known or not Known as CRU1Z1N.
    If you want to succeed you should strike out on new paths, rather than travel the worn paths of accepted success.(John D. Rockefeller)

  3. #3
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Mark View Post
    successor > predecessor
    duh

  4. #4
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,164
    Mentioned
    26 Post(s)
    Quoted
    433 Post(s)

  5. #5
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Drawing from a thread other than "Main" thou shall not.
    I am Ggzz..
    Hackintosher

  6. #6
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Drawing from a thread other than "Main" thou shall not.
    Nor am i painting in WM_PAINT message... blasphemy!

    Seems to work just fine tho.

  7. #7
    Join Date
    May 2020
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No matter what I do I can't get this to work with your WindowOverlay include. I've tried to use both 32 bit and 64 bit (which I believe is not the latest version that's compiled btw) and several simba versions including your own Simba 1400... I ended up sketching some functions myself to get some basic functionality out of this but if you could teach me how to use this I would appreciate it!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •