Page 4 of 5 FirstFirst ... 2345 LastLast
Results 76 to 100 of 105

Thread: TMufasaLayer - Draw on any window!

  1. #76
    Join Date
    Feb 2016
    Posts
    14
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    You can draw on the SMART canvas (ie. the RS screen) directly without needing to use TMufasaLayer.
    I was more aiming to create a little overlay that I could look at while debugging my code as I go, because drawing on smart's canvas means smart has to be active so that it's actually capturing the graphics.
    But I realised that aerolib actually also uses the smart canvas for it's colour processing functions, so that isn't actually useful for me.

    Anyway, my workaround was to increase the size and offset the Layer to the smart client (because for some reason it isn't recognising child windows anymore).

    I'll just use smart's canvas for now.
    Last edited by Wolfskull; 04-17-2016 at 04:08 AM.

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

    Default

    Quote Originally Posted by Wolfskull View Post
    I was more aiming to create a little overlay that I could look at while debugging my code as I go, because drawing on smart's canvas means smart has to be active so that it's actually capturing the graphics.
    But I realised that aerolib actually also uses the smart canvas for it's colour processing functions, so that isn't actually useful for me.

    Anyway, my workaround was to increase the size and offset the Layer to the smart client (because for some reason it isn't recognising child windows anymore).

    I'll just use smart's canvas for now.
    More info? (With what's not working with the layer)

  3. #78
    Join Date
    Feb 2016
    Posts
    14
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Essentially 2 separate problems I'm having

    1. When directly targetting RS's playable area with simba client selecting tool, the layer is set up off-set, left and upwards, as if it's ignoring the window's borders. This happens for both the official client and SMART, but not for osbuddy.
    I saw you mention earlier in the thread you'd fixed to work on child windows, and I assume the canvas in SMART and official client come under that.
    Really, if this worked for me I wouldn't really need to fix the second problem as this gives me a simple enough work around with directly targeting rs.

    2. Seems to be mainly due to aerolib/smart, but when I set up the layer after initialising aerolib (and therefore the SMART client), it doesn't set up the layer correctly and instead creates a 320x240 frame on my screen. The layer's bitmap is set up correctly, right size and can be drawn to.
    I think this is just Aerolib changing simba's client. (GetNativeWindow returns a different window (Though I'm not sure what, and it never changes), but the layer doesn't recognise it as being valid, but it is the same as OS_smart.target())

  4. #79
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    995
    Mentioned
    145 Post(s)
    Quoted
    596 Post(s)

    Default

    Quote Originally Posted by Wolfskull View Post
    Essentially 2 separate problems I'm having

    1. When directly targetting RS's playable area with simba client selecting tool, the layer is set up off-set, left and upwards, as if it's ignoring the window's borders. This happens for both the official client and SMART, but not for osbuddy.
    I saw you mention earlier in the thread you'd fixed to work on child windows, and I assume the canvas in SMART and official client come under that.
    Really, if this worked for me I wouldn't really need to fix the second problem as this gives me a simple enough work around with directly targeting rs.

    2. Seems to be mainly due to aerolib/smart, but when I set up the layer after initialising aerolib (and therefore the SMART client), it doesn't set up the layer correctly and instead creates a 320x240 frame on my screen. The layer's bitmap is set up correctly, right size and can be drawn to.
    I think this is just Aerolib changing simba's client. (GetNativeWindow returns a different window (Though I'm not sure what, and it never changes), but the layer doesn't recognise it as being valid, but it is the same as OS_smart.target())
    As for 2, that's because SMART has it's own target thingy, this is not aerolib or any others includes doing. Could be worked around with special case, but meh.. Not really needed to have it work perfectly with smart, since smart has it's own drawing mechanisms. So as soon as smart is initalized the target in simba gets changed to smart's "special" target.

    As for the first I also noted this issue when I tested this thingy. Had to target the whole window for it to work, rather than the child frame.. Weird that it would end up like that, hehe.
    Last edited by slacky; 04-17-2016 at 11:38 AM.
    !No priv. messages please

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

    Default

    Quote Originally Posted by Wolfskull View Post
    ...
    Try setting up the layer before you setup areolib. example:
    Simba Code:
    begin
      Layer.Init(GetNativeWindow)  // etc....

      Areolib_setup;
    end.
    e: Also dug into my old hdd and uploaded the source on github.
    Last edited by Olly; 04-17-2016 at 04:14 PM.

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

    Default

    I've been re-writing this, it's now in a single DLL and it is possible to create a basic GUI, see this (note how clicks don't pass through).

  7. #82
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    I've been re-writing this, it's now in a single DLL and it is possible to create a basic GUI, see this (note how clicks don't pass through).
    Looks like very promising progress, simplification and GUIs for possible real time script interaction.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  8. #83
    Join Date
    Jan 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    I've been re-writing this, it's now in a single DLL and it is possible to create a basic GUI, see this (note how clicks don't pass through).
    That actually looks really cool man, nice progress. The possibilities with that would be awesome.

  9. #84
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    How are you coming along on this, Olly?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  10. #85
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    I've been re-writing this, it's now in a single DLL and it is possible to create a basic GUI, see this (note how clicks don't pass through).
    Cool man, have always been a fan of tmufasalayer

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

    Default

    Quote Originally Posted by Flight View Post
    How are you coming along on this, Olly?
    Got bored with it, will check tomorrow to see how much is left to complete.

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

    Default

    @Flight You can mess around with this if you want, it's a include now so just extract to Simba/Includes. Run test.simba to see the usage.
    Attached Files Attached Files

  13. #88
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

  14. #89
    Join Date
    Jan 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Really cool stuff, been messing with it and the possibilities with it are gonna be awesome. Can't seem to get the PaintInterval to work though.

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

    Default

    Quote Originally Posted by deejaay View Post
    Really cool stuff, been messing with it and the possibilities with it are gonna be awesome. Can't seem to get the PaintInterval to work though.
    PaintInterval seems to work for me with this:
    Simba Code:
    {$i Layer/Layer.simba}

    begin
      Layer.Init(); // Setup the layer - will target what has been picked with simba's crosshairs
      Layer.PaintInterval(100); // Automaticly update the layer every 100ms

      // The layer will close when the script terminates, for this test let's keep it running for 5 seconds
      while (GetTimeRunning() < 5000) do
      begin
        LayerBitmap.Rectangle(IntToBox(100, 100, 200, 200), Random($FFFFFF));
        Wait(500);
      end;
    end;

  16. #91
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    @Flight You can mess around with this if you want, it's a include now so just extract to Simba/Includes. Run test.simba to see the usage.
    Looks great, thanks for the work Olly. I noticed a few things however. While to offset has changed from what I sent you before in the PM, it still exists. The X value is correct now however the Y is off by -30 pixels; roughly the size of the window title, as if the layer is still targeting the whole window as opposed to the window targeted by Simba's crosshairs. Also the the layer won't be visible if you're active window is the target window before the layer paints. For example, I click > Run on the script (with the RS window already targeted by Simba) and click inside the RS window before the Layer is initiated: the Layer will never become visible. It only works if you click > Run and wait until for the Layer to be initialized and begin painting before you click within the active window, RS in this instance.

    Other than that I think it works just fine. For now, until the offset issue is resolved I'll make a work-around to apply a static offset on anything painted on the Layer.

    Edit:
    Before I forget, it doesn't compile with the newest version of Simba; RC6. Not really a major issue but it's something to be aware of.
    Last edited by Flight; 02-06-2017 at 10:58 PM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  17. #92
    Join Date
    Jan 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    PaintInterval seems to work for me with this:
    Simba Code:
    {$i Layer/Layer.simba}

    begin
      Layer.Init(); // Setup the layer - will target what has been picked with simba's crosshairs
      Layer.PaintInterval(100); // Automaticly update the layer every 100ms

      // The layer will close when the script terminates, for this test let's keep it running for 5 seconds
      while (GetTimeRunning() < 5000) do
      begin
        LayerBitmap.Rectangle(IntToBox(100, 100, 200, 200), Random($FFFFFF));
        Wait(500);
      end;
    end;
    Huh yeah it is working, idk what I was doing yesterday. Thanks. I also noticed if I put something like GetTimeRunning on there it would crash the entire thing, not a big deal since i'm just messing around with it but just what I noticed.

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

    Default

    Quote Originally Posted by Flight View Post
    ...
    What window are you targeting to get all these issues?

  19. #94
    Join Date
    Jan 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    What window are you targeting to get all these issues?
    I was getting the same issues as him when targeting Alora's client. http://alora.io

  20. #95
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    What window are you targeting to get all these issues?
    Official Oldschool client. I've also tried on the OS-Scape client for what it's worth, same issue.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


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

    Default

    Quote Originally Posted by Flight View Post
    Official Oldschool client. I've also tried on the OS-Scape client for what it's worth, same issue.
    Ok, I've fixed the offset bug. It was a issue when the window had a native window border and as i've been testing with OSBuddy I didn't see that issue. For now just download (as zip) from git and copy libLayer.dll from the release directory into Simba/Includes/Layer, I will take a look at the other issues tomorrow.

    @Flight
    I can't seem to reproduce the other issue, i'm running the following and the rectangle always appears.
    Simba Code:
    {$i Layer/Layer.simba}

    begin
      Layer.Init();
      Wait(3000); // Giving RS focus in this time...

      LayerBitmap.Rectangle(IntToBox(0, 0, 200, 200), Random($FFFFFF));
      Layer.Paint();

      while (GetTimeRunning() < 6000) do
        Wait(50);
    end;
    Last edited by Olly; 02-07-2017 at 07:56 PM.

  22. #97
    Join Date
    Jan 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Ok, I've fixed the offset bug. It was a issue when the window had a native window border and as i've been testing with OSBuddy I didn't see that issue. For now just download (as zip) from git and copy libLayer.dll from the release directory into Simba/Includes/Layer, I will take a look at the other issues tomorrow.

    @Flight
    I can't seem to reproduce the other issue, i'm running the following and the rectangle always appears.
    Simba Code:
    {$i Layer/Layer.simba}

    begin
      Layer.Init();
      Wait(3000); // Giving RS focus in this time...

      LayerBitmap.Rectangle(IntToBox(0, 0, 200, 200), Random($FFFFFF));
      Layer.Paint();

      while (GetTimeRunning() < 6000) do
        Wait(50);
    end;
    If you are talking about the issue where you click on the client before the script fully starts up and the layer wont appear, I am having the same issue with the script you posted. I can show you a video of it if you want.

    To reproduce:
    1. Have simba and the client side by side
    2. Target the client obv...
    3. Press play on simba
    4. Quickly left click on the client before the script fully starts
    5. Wait and youll see the layer never appears

    Also with that new dll the Y offset is off by -30 for me on Aloras client.

  23. #98
    Join Date
    Jan 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Any news on this since your last post? It was just getting interesting. :^)

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

    Default

    Quote Originally Posted by deejaay View Post
    Any news on this since your last post? It was just getting interesting. :^)
    I took a quick look into start up issue and couldn't figure out so it's will most likely take a night of head bashing to figure that out. It's on the list, just doing more exciting things for now.
    Attached Files Attached Files
    Last edited by Olly; 03-04-2017 at 07:39 PM.

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

    Default

    I've updated this again and hopefully have fixed all the issues, also added support for new & old Simba versions.

    Download repository from https://github.com/Olly-/libLayer and extract then move the release/Layer folder into Simba/Includes/, run the test script to see how it works.
    Last edited by Olly; 03-25-2017 at 06:21 AM.

Page 4 of 5 FirstFirst ... 2345 LastLast

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
  •