Author Topic: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0  (Read 514 times)

Dualnames

  • Local Moderator
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
1. Prologue:

So, what this module basically does is it perfectly replicates your screen MINUS the UIS and the mouse and other overlays. This can be used essentially for capturing screenshots. And essentially for BOX BLUR.
And it's faster and better than the module that already exists. I can do a boxblur of 3 iterations with zero framedrop. Most of the code is based on Steve's wonderful idea almost a decade ago with the FakeScreen, so this is essentially an up from that. The code is open sourced, for those that want to improve it and such.



2. Instructions/Going through the functions

1. Import the module in your project (AGS Fake Screen.scm)
2. Import and enable the plugin (AGSFakeScreen.dll)

AGS Fake Screen Functions


  • int FakeScreenUpdate();

    This returns a graphic sprite number where everything is drawn to as a replica of the screen.

Code: Adventure Game Studio
  1.  
  2. function TakeScreenShot()
  3. {  
  4.   int getGraphic=FakeScreenUpdate();
  5.   DynamicSprite*screenshot=DynamicSprite.CreateFromExistingSprite(getGraphic,false);
  6.   int setSlot=5;
  7.   screenshot.SaveToFile(String.Format("$SAVEGAMEDIR$/%d.bmp",setSlot));
  8. }
  9. //this will draw a replica of the screen and save it
  10.  
  11.  

DrawBoxBlur(int sprite, int radius)

This takes a sprite as a parameter, in this example case it will take the sprite that we'll be using to BoxBlur our entire screen, but it can blur any sprite. Radius defines how many times BoxBlur will be applied. Ranges from 1-however many u like/your pc can support

Code: Adventure Game Studio
  1. Overlay*screenlay;
  2.  
  3. function repeatedly_execute_always()
  4. {  
  5.   int getgraph = FakeScreenUpdate();
  6.   DrawBoxBlur(getgraph, 3);  
  7.   screenlay=Overlay.CreateGraphical(0, 0, getgraph, true);
  8. }
  9. //this will box blur with 3 iterations your entire screen every frame.
  10.  
  11.  



3. Download links

AGSFAKESCREEN.dll
AGSFakeScreen.scm

*ZIP file containing both*

4. Source

The source files can be found on GITHUB



Box Blur 3 iterations
« Last Edit: 12 Jun 2019, 19:37 by Dualnames »
No more military army stuff. I'm alive and back.

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on one or more games that won an AGS Award!
    •  
    • selmiak worked on one or more games that was nominated for an AGS Award!
Re: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
« Reply #1 on: 12 Jun 2019, 21:46 »
nice. And very quick <3

does this work on other operating systems than windows as it requires a dll?

Re: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
« Reply #2 on: 14 Jul 2019, 21:53 »
Love it....

Just 2 questions :D

1- How do i revert the blur (im looking for the ability to blur and unblur)
2- Can we do a gradual blur? For instance take 1 second from start to finish?

Thank you

Dualnames

  • Local Moderator
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Re: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
« Reply #3 on: 15 Jul 2019, 04:07 »
Code: Adventure Game Studio
  1. bool BlurEnabled=false;
  2. function repeatedly_execute_always()
  3. {  
  4.   int getgraph = FakeScreenUpdate();
  5.   if (BlurEnabled) DrawBoxBlur(getgraph, 3);  
  6.   screenlay=Overlay.CreateGraphical(0, 0, getgraph, true);
  7. }
  8.  
  9. [code]
  10.  
  11. Something like that would work.
No more military army stuff. I'm alive and back.

Re: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
« Reply #4 on: 15 Jul 2019, 21:49 »
Got the On and Off working.... but im still struggling with the gradual blured effect..

At this moment to get that effect i use two images (1 normal and 1 blurred) and i use the tween module (TweenTransparency with a delay value) to affect the visibility of the normal one. What i would like to do is use your module to achieve the same effect.

Bellow its a video using "AGS Fake Screen" and the techniques im now using "Images" (and would love to replace with AGS Fake Screen)



You can see two things:
1. In the AGS FakeScreen the blur occurs instantaneously (couldnt figure out how to make it gradual)
2. In the AGS FakeScreen when the blur is completed the image shifts a bit


Does anyone has an ideia how to solve this? I would love to use AGS Fake Screen because then i wouldn't need to use to backgound images (One clear and one blurred)

Thanks in advance :)
« Last Edit: 24 Jul 2019, 21:35 by henrikes »