diff --git a/source/funkin/Preferences.hx b/source/funkin/Preferences.hx index f3041be..c858dff 100644 --- a/source/funkin/Preferences.hx +++ b/source/funkin/Preferences.hx @@ -330,6 +330,27 @@ class Preferences return value; } + /** + * If enabled, the game will automatically launch in fullscreen on startup. + * + * This does not apply on mobile devices. + * @default `false` + */ + public static var autoFullscreen(get, set):Bool; + + static function get_autoFullscreen():Bool + { + return Save?.instance?.options?.autoFullscreen ?? false; + } + + static function set_autoFullscreen(value:Bool):Bool + { + var save:Save = Save.instance; + save.options.autoFullscreen = value; + save.flush(); + return value; + } + public static var unlockedFramerate(get, set):Bool; static function get_unlockedFramerate():Bool @@ -458,7 +479,7 @@ class Preferences */ public static function init():Void { - // Apply the autoPause setting (enables automatic pausing on focus lost). + // Apply the autoPause setting (enables automatic pausing when losing focus). FlxG.autoPause = Preferences.autoPause; flixel.FlxSprite.defaultAntialiasing = Preferences.antialiasing; // Apply the debugDisplay setting (enables the FPS and RAM display). @@ -466,6 +487,8 @@ class Preferences #if web toggleFramerateCap(Preferences.unlockedFramerate); #end + // Apply the autoFullscreen setting (launches the game in fullscreen automatically) + FlxG.fullscreen = Preferences.autoFullscreen; #if mobile // Apply the allowScreenTimeout setting (enables screen timeout). lime.system.System.allowScreenTimeout = Preferences.screenTimeout; diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index d73f770..91479fe 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -111,6 +111,7 @@ class Save showTimings: true, debugDisplay: true, autoPause: true, + autoFullscreen: false, laneAlpha: 0, strumAlpha: 100, badsShitsCauseMiss: false, @@ -1396,6 +1397,14 @@ typedef SaveDataOptions = */ var autoPause:Bool; + /** + * If enabled, the game will automatically launch in fullscreen on startup. + * + * This does not apply to mobile devices, obviously, hence why it only shows up on `desktop` and `web` platforms. + * @default `false` + */ + var autoFullscreen:Bool; + /** * How transparent should the black underlay be under the lanes? * diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index ca1fe44..536a231 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -241,6 +241,11 @@ class PreferencesMenu extends Page Preferences.judgeCounter = value; yeahBf(value); }, Preferences.judgeCounter); + #if (desktop || web) + createPrefItemCheckbox('Launch in Fullscreen', 'Enable to automatically launch the game in fullscreen on startup', function(value:Bool):Void { + Preferences.autoFullscreen = value; + }, Preferences.autoFullscreen); + #end #if web createPrefItemCheckbox('Unlocked Framerate', 'Enable to unlock the framerate', function(value:Bool):Void { Preferences.unlockedFramerate = value; @@ -253,7 +258,7 @@ class PreferencesMenu extends Page else FlxG.game.focusLostFramerate = Preferences.framerate; yeahBf(false); - }, null, Preferences.framerate, #if mobile 60 #else 24 #end, 960, 1, 0); + }, null, Preferences.framerate, #if mobile 60 #else 24 #end, 360, 1, 0); #end createPrefHeader('Miscellaneous'); createPrefItemCheckbox('Naughtiness', 'Enable so your mom won\'t scream at ya, right now it doesn\'t do much', function(value:Bool):Void {