Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: Dualnames on Wed 12/06/2019 18:53:06

Title: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
Post by: Dualnames on Wed 12/06/2019 18:53:06
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.

(https://i.imgur.com/bpJ6cF6.png)

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


Code (AGS) Select


function TakeScreenShot()

  int getGraphic=FakeScreenUpdate();
  DynamicSprite*screenshot=DynamicSprite.CreateFromExistingSprite(getGraphic,false);
  int setSlot=5;
  screenshot.SaveToFile(String.Format("$SAVEGAMEDIR$/%d.bmp",setSlot));
}
//this will draw a replica of the screen and save it



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 (AGS) Select

Overlay*screenlay;

function repeatedly_execute_always()

  int getgraph = FakeScreenUpdate();
  DrawBoxBlur(getgraph, 3); 
  screenlay=Overlay.CreateGraphical(0, 0, getgraph, true);
}
//this will box blur with 3 iterations your entire screen every frame.





3. Download links

AGSFAKESCREEN.dll (https://github.com/Dualnames1/agsfakescreen/releases/download/1.0/AGSFAKESCREEN.dll)
AGSFakeScreen.scm (https://github.com/Dualnames1/agsfakescreen/releases/download/1.0/AGSFakeScreen.scm)

*ZIP file containing both* (http://primordia-game.com/Files0/AGSFakeScreen.zip)

4. Source

The source files can be found on GITHUB  (https://github.com/Dualnames1/agsfakescreen)



Box Blur 3 iterations
(https://i.imgur.com/PI0EYKD.png)
Title: Re: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
Post by: selmiak on Wed 12/06/2019 21:46:52
nice. And very quick <3

does this work on other operating systems than windows as it requires a dll?
Title: Re: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
Post by: henrikes on Sun 14/07/2019 21:53:29
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
Title: Re: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
Post by: Dualnames on Mon 15/07/2019 04:07:06

bool BlurEnabled=false;
function repeatedly_execute_always()

  int getgraph = FakeScreenUpdate();
  if (BlurEnabled) DrawBoxBlur(getgraph, 3); 
  screenlay=Overlay.CreateGraphical(0, 0, getgraph, true);
}

[code]

Something like that would work.
Title: Re: [PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0
Post by: henrikes on Mon 15/07/2019 21:49:44
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 :)