From e30e6ee4edb0e92174afbd0b5c66bfdf5e2ddd68 Mon Sep 17 00:00:00 2001 From: Lasercar Date: Fri, 7 Feb 2025 16:19:41 +1000 Subject: [PATCH] comment cleanup --- source/funkin/Preferences.hx | 4 +- source/funkin/save/Save.hx | 12 +- .../funkin/util/plugins/ScreenshotPlugin.hx | 131 ------------------ 3 files changed, 9 insertions(+), 138 deletions(-) diff --git a/source/funkin/Preferences.hx b/source/funkin/Preferences.hx index 066b77516..df75079f0 100644 --- a/source/funkin/Preferences.hx +++ b/source/funkin/Preferences.hx @@ -277,7 +277,7 @@ class Preferences } /** - * If enabled, the game will save any screenshots taken to this format. + * The game will save any screenshots taken to this format. * @default `PNG` */ public static var saveFormat(get, set):Any; @@ -296,7 +296,7 @@ class Preferences } /** - * If enabled, the game will save JEPG screenshots with this quality percentage. + * The game will save JPEG screenshots with this quality percentage. * @default `80` */ public static var jpegQuality(get, set):Int; diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index a65988387..a1953033d 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -1396,16 +1396,18 @@ typedef SaveDataOptions = */ var unlockedFramerate:Bool; - // screenshot options + /** + * Screenshot options + * @param shouldHideMouse Should the mouse be hidden when taking a screenshot? Default: `true` + * @param fancyPreview Show a fancy preview? Default: `true` + * @param saveFormat The save format of the screenshot, PNG or JPEG. Default: `PNG` + * @param jpegQuality The JPEG Quality, if we're saving to the format. Default: `80` + */ var screenshot: { - // Should the mouse be hidden when taking a screenshot? var shouldHideMouse:Bool; - // Show a fancy preview var fancyPreview:Bool; - // The save format of the screenshot, PNG or JPEG var saveFormat:String; - // The JPEG Quality, if we're saving to the format var jpegQuality:Int; }; diff --git a/source/funkin/util/plugins/ScreenshotPlugin.hx b/source/funkin/util/plugins/ScreenshotPlugin.hx index c3d246673..308ac2fde 100644 --- a/source/funkin/util/plugins/ScreenshotPlugin.hx +++ b/source/funkin/util/plugins/ScreenshotPlugin.hx @@ -322,27 +322,6 @@ class ScreenshotPlugin extends FlxBasic FlxTween.tween(flashSprite, {alpha: 0}, 0.15); FunkinSound.playOnce(Paths.sound('screenshot'), 1.0); - // I don't need this - /*var flashBitmap; - flashSprite = new Sprite(); - if (screenshotBeingSpammed == false) - { - flashBitmap = new Bitmap(new BitmapData(Std.int(FlxG.stage.width), Std.int(FlxG.stage.height), false, 0xFFFFFFFF)); - // flashSpr = new Sprite(); - flashSprite.addChild(flashBitmap); - FlxG.stage.addChild(flashSprite); - } - flashTween = FlxTween.tween(flashSprite, {alpha: 0}, 0.15, - { - ease: FlxEase.quadOut, - onComplete: function(_) { - flashTween = null; - FlxG.stage.removeChild(flashSprite); - } - }); - // Play a sound (auto-play is true). - FunkinSound.playOnce(Paths.sound('screenshot'), 1.0); - */ } static final PREVIEW_INITIAL_DELAY = 0.25; // How long before the preview starts fading in. @@ -359,116 +338,6 @@ class ScreenshotPlugin extends FlxBasic previewSprite.alpha = 1; FlxTween.tween(previewSprite, {alpha: 0}, 0.5, {startDelay: .5}); - // I just can't for the life of me get this thing to hide properly, so it's being disabled - // I mean, steam doesn't make their screenshots this advanced anyways - - // ermmm stealing this?? - /* - if (!wasMouseHidden && !FlxG.mouse.visible && screenshotBeingSpammed == false) - { - wasMouseHidden = true; - Cursor.show(); - } - - // so that it doesnt change the alpha when tweening in/out - var changingAlpha:Bool = false; - - // fuck it, cursed locally scoped functions, purely because im lazy - // (and so we can check changingAlpha, which is locally scoped.... because I'm lazy...) - var onHover = function(e:MouseEvent) { - if (!changingAlpha) e.target.alpha = 0.6; - }; - - var onHoverOut = function(e:MouseEvent) { - if (!changingAlpha) e.target.alpha = 1; - } - - var cancelPreview = function():Void { - if (screenshotBeingSpammed == true) - { - previewSprite.removeEventListener(MouseEvent.MOUSE_DOWN, openScreenshotsFolder); - previewSprite.removeEventListener(MouseEvent.MOUSE_OVER, onHover); - previewSprite.removeEventListener(MouseEvent.MOUSE_OUT, onHoverOut); - - FlxG.stage.removeChild(previewSprite); - - if (previewFadeInTween != null) previewFadeInTween.cancel(); - if (previewFadeOutTween != null) previewFadeOutTween.cancel(); - - if (wasMouseHidden) - { - Cursor.hide(); - wasMouseHidden = false; - } - - return; - } - }; - - var scale:Float = 0.25; - var w:Int = Std.int(bitmap.bitmapData.width * scale); - var h:Int = Std.int(bitmap.bitmapData.height * scale); - - var preview:BitmapData = new BitmapData(w, h, true); - var matrix:openfl.geom.Matrix = new openfl.geom.Matrix(); - matrix.scale(scale, scale); - preview.draw(bitmap.bitmapData, matrix); - - // used for movement + button stuff - previewSprite = new Sprite(); - - previewSprite.buttonMode = true; - previewSprite.addEventListener(MouseEvent.MOUSE_DOWN, openScreenshotsFolder); - previewSprite.addEventListener(MouseEvent.MOUSE_OVER, onHover); - previewSprite.addEventListener(MouseEvent.MOUSE_OUT, onHoverOut); - - FlxG.stage.addChild(previewSprite); - - previewSprite.alpha = 0.0; - previewSprite.y -= 10; - - var previewBitmap = new Bitmap(preview); - previewSprite.addChild(previewBitmap); - - cancelPreview(); - - // Wait to fade in. - new FlxTimer().start(PREVIEW_INITIAL_DELAY, function(_) { - cancelPreview(); - // Fade in. - changingAlpha = true; - previewFadeInTween = FlxTween.tween(previewSprite, {alpha: 1.0, y: 0}, PREVIEW_FADE_IN_DURATION, - { - ease: FlxEase.quartOut, - onComplete: function(_) { - changingAlpha = false; - cancelPreview(); - // Wait to fade out. - new FlxTimer().start(PREVIEW_FADE_OUT_DELAY, function(_) { - changingAlpha = true; - // Fade out. - previewFadeOutTween = FlxTween.tween(previewSprite, {alpha: 0.0, y: 10}, PREVIEW_FADE_OUT_DURATION, - { - ease: FlxEase.quartInOut, - onComplete: function(_) { - if (wasMouseHidden) - { - Cursor.hide(); - wasMouseHidden = false; - } - // else if (!wasMouseAlreadyHidden) - previewSprite.removeEventListener(MouseEvent.MOUSE_DOWN, openScreenshotsFolder); - previewSprite.removeEventListener(MouseEvent.MOUSE_OVER, onHover); - previewSprite.removeEventListener(MouseEvent.MOUSE_OUT, onHoverOut); - - FlxG.stage.removeChild(previewSprite); - } - }); - }); - } - }); - }); - */ } function openScreenshotsFolder():Void