Skip to content

Commit

Permalink
Fix a bug where screenshots would say on screen forever
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteMasterEric committed Jun 8, 2024
1 parent 5bd9ff8 commit 5e40be0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion source/funkin/util/plugins/ScreenshotPlugin.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ class ScreenshotPlugin extends FlxBasic

onPreScreenshot = new FlxTypedSignal<Void->Void>();
onPostScreenshot = new FlxTypedSignal<Bitmap->Void>();

FlxG.signals.postStateSwitch.add(onStateSwitchComplete);
}

public function onStateSwitchComplete():Void
{
trace('Stage switch complete! Removing screenshot preview sprite if it exists.');
FlxG.stage.removeChild(previewSprite);
previewSprite = null;
}

public override function update(elapsed:Float):Void
Expand Down Expand Up @@ -162,6 +171,8 @@ class ScreenshotPlugin extends FlxBasic

final CAMERA_FLASH_DURATION = 0.25;

var previewSprite:Null<Sprite> = null;

/**
* Visual and audio feedback when a screenshot is taken.
*/
Expand Down Expand Up @@ -215,7 +226,7 @@ class ScreenshotPlugin extends FlxBasic
preview.draw(bitmap.bitmapData, matrix);

// used for movement + button stuff
var previewSprite = new Sprite();
previewSprite = new Sprite();

previewSprite.buttonMode = true;
previewSprite.addEventListener(MouseEvent.MOUSE_DOWN, openScreenshotsFolder);
Expand Down Expand Up @@ -257,6 +268,7 @@ class ScreenshotPlugin extends FlxBasic
previewSprite.removeEventListener(MouseEvent.MOUSE_OUT, onHoverOut);

FlxG.stage.removeChild(previewSprite);
previewSprite = null;
}
});
});
Expand Down

0 comments on commit 5e40be0

Please sign in to comment.