Skip to content

Commit

Permalink
Merge pull request #124 from srcimon/jbs-daily
Browse files Browse the repository at this point in the history
blur background
  • Loading branch information
srcimon committed Nov 28, 2023
2 parents 6c31ee3 + f1ba292 commit 217e952
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package io.github.srcimon.screwbox.examples.platformer.systems;

import io.github.srcimon.screwbox.core.Engine;
import io.github.srcimon.screwbox.core.Time;
import io.github.srcimon.screwbox.core.entities.Archetype;
import io.github.srcimon.screwbox.core.entities.Entity;
import io.github.srcimon.screwbox.core.entities.EntitySystem;
import io.github.srcimon.screwbox.core.graphics.Sprite;
import io.github.srcimon.screwbox.core.graphics.internal.BlurImageFilter;
import io.github.srcimon.screwbox.core.graphics.internal.ImageUtil;
import io.github.srcimon.screwbox.core.keyboard.Key;
import io.github.srcimon.screwbox.examples.platformer.components.ScreenshotComponent;
import io.github.srcimon.screwbox.examples.platformer.scenes.PauseScene;
Expand All @@ -19,7 +23,8 @@ public void update(Engine engine) {
|| !engine.window().hasFocus()) {

Entity screenshotEntity = engine.entities().forcedFetch(SCREENSHOT);
screenshotEntity.get(ScreenshotComponent.class).screenshot = engine.graphics().screen().takeScreenshot();
var newImage = new BlurImageFilter(8).apply(ImageUtil.toBufferedImage(engine.graphics().screen().takeScreenshot().image(Time.now())));
screenshotEntity.get(ScreenshotComponent.class).screenshot = Sprite.fromImage(newImage);
engine.audio().stopAllSounds();
engine.scenes().switchTo(PauseScene.class);
}
Expand Down

0 comments on commit 217e952

Please sign in to comment.