Remove JPEG (#1065)
Co-authored-by: Lasercar <64717068+Lasercar@users.noreply.github.com>
This commit is contained in:
@@ -371,44 +371,6 @@ class Preferences
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The game will save any screenshots taken to this format.
|
||||
* @default `PNG`
|
||||
*/
|
||||
public static var saveFormat(get, set):Any;
|
||||
|
||||
static function get_saveFormat():Any
|
||||
{
|
||||
return Save?.instance?.options?.screenshot?.saveFormat ?? 'PNG';
|
||||
}
|
||||
|
||||
static function set_saveFormat(value):Any
|
||||
{
|
||||
var save:Save = Save.instance;
|
||||
save.options.screenshot.saveFormat = value;
|
||||
save.flush();
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The game will save JPEG screenshots with this quality percentage.
|
||||
* @default `80`
|
||||
*/
|
||||
public static var jpegQuality(get, set):Int;
|
||||
|
||||
static function get_jpegQuality():Int
|
||||
{
|
||||
return Save?.instance?.options?.screenshot?.jpegQuality ?? 80;
|
||||
}
|
||||
|
||||
static function set_jpegQuality(value:Int):Int
|
||||
{
|
||||
var save:Save = Save.instance;
|
||||
save.options.screenshot.jpegQuality = value;
|
||||
save.flush();
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the user's preferences from the save data and apply them.
|
||||
*/
|
||||
|
||||
@@ -135,8 +135,6 @@ class Save
|
||||
shouldHideMouse: true,
|
||||
fancyPreview: true,
|
||||
previewOnSave: true,
|
||||
saveFormat: 'PNG',
|
||||
jpegQuality: 80,
|
||||
},
|
||||
|
||||
controls:
|
||||
@@ -1490,16 +1488,12 @@ typedef SaveDataOptions =
|
||||
* @param shouldHideMouse Should the mouse be hidden when taking a screenshot? Default: `true`
|
||||
* @param fancyPreview Show a fancy preview? Default: `true`
|
||||
* @param previewOnSave Only show the fancy preview after a screenshot is saved? 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:
|
||||
{
|
||||
var shouldHideMouse:Bool;
|
||||
var fancyPreview:Bool;
|
||||
var previewOnSave:Bool;
|
||||
var saveFormat:String;
|
||||
var jpegQuality:Int;
|
||||
};
|
||||
|
||||
var controls:
|
||||
|
||||
@@ -173,27 +173,6 @@ class PreferencesMenu extends Page<OptionsState.OptionsMenuPageName>
|
||||
createPrefItemCheckbox('Preview on save', 'If enabled, the preview will be shown only after a screenshot is saved.', function(value:Bool):Void {
|
||||
Preferences.previewOnSave = value;
|
||||
}, Preferences.previewOnSave);
|
||||
// TODO: having oValue is weird, probably change this later? was done to accomodate VSync changes.
|
||||
createPrefItemEnum('Save Format', 'Save screenshots to this format.', ['PNG' => 'PNG', 'JPEG' => 'JPEG'], function(value:String, oValue:String):Void {
|
||||
Preferences.saveFormat = value;
|
||||
}, Preferences.saveFormat);
|
||||
createPrefItemNumber('JPEG Quality', 'The quality of JPEG screenshots.', function(value:Float) {
|
||||
Preferences.jpegQuality = Std.int(value);
|
||||
}, null, Preferences.jpegQuality, 0, 100, 5, 0);
|
||||
#end
|
||||
|
||||
#if FEATURE_HAPTICS
|
||||
createPrefItemCheckbox('Vibration', 'If enabled, Haptic Feedback vibration effects will be active.', function(value:Bool):Void {
|
||||
Preferences.vibration = value;
|
||||
}, Preferences.vibration);
|
||||
#end
|
||||
|
||||
#if mobile
|
||||
createPrefItemCheckbox('Allow Screen Timeout',
|
||||
'If enabled, The phone screen will timeout (sleep) after few seconds of inactivity.\nDoesn\'t apply when playing a song.', function(value:Bool):Void {
|
||||
Preferences.screenTimeout = value;
|
||||
}, Preferences.screenTimeout);
|
||||
#end
|
||||
}
|
||||
|
||||
override function update(elapsed:Float):Void
|
||||
|
||||
@@ -469,7 +469,7 @@ class ScreenshotPlugin extends FlxBasic
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Bitmap to a PNG or JPEG ByteArray to save to a file.
|
||||
* Convert a Bitmap to a PNG ByteArray to save to a file.
|
||||
*/
|
||||
function encode(bitmap:Bitmap):ByteArray
|
||||
{
|
||||
@@ -494,7 +494,7 @@ class ScreenshotPlugin extends FlxBasic
|
||||
if (previousScreenshotName != targetPath && previousScreenshotName != (targetPath + ' (${previousScreenshotCopyNum})'))
|
||||
{
|
||||
previousScreenshotName = targetPath;
|
||||
targetPath = getScreenshotPath() + targetPath + '.' + Std.string(Preferences.saveFormat).toLowerCase();
|
||||
targetPath = getScreenshotPath() + targetPath + '.png';
|
||||
previousScreenshotCopyNum = 2;
|
||||
}
|
||||
else
|
||||
@@ -506,7 +506,7 @@ class ScreenshotPlugin extends FlxBasic
|
||||
newTargetPath = targetPath + ' (${previousScreenshotCopyNum})';
|
||||
}
|
||||
previousScreenshotName = newTargetPath;
|
||||
targetPath = getScreenshotPath() + newTargetPath + '.' + Std.string(Preferences.saveFormat).toLowerCase();
|
||||
targetPath = getScreenshotPath() + newTargetPath + '.png';
|
||||
}
|
||||
|
||||
// TODO: Make screenshot saving work on browser.
|
||||
@@ -520,7 +520,7 @@ class ScreenshotPlugin extends FlxBasic
|
||||
|
||||
if (pngData == null)
|
||||
{
|
||||
trace('[WARN] Failed to encode ${Preferences.saveFormat} data');
|
||||
trace('[WARN] Failed to encode PNG data');
|
||||
previousScreenshotName = null;
|
||||
// Just in case
|
||||
unsavedScreenshotBuffer.shift();
|
||||
@@ -544,7 +544,7 @@ class ScreenshotPlugin extends FlxBasic
|
||||
|
||||
if (pngData == null)
|
||||
{
|
||||
trace('[WARN] Failed to encode ${Preferences.saveFormat} data');
|
||||
trace('[WARN] Failed to encode PNG data');
|
||||
previousScreenshotName = null;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user