diff --git a/source/funkin/backend/utils/WindowUtils.hx b/source/funkin/backend/utils/WindowUtils.hx index 609e3977..571f781a 100644 --- a/source/funkin/backend/utils/WindowUtils.hx +++ b/source/funkin/backend/utils/WindowUtils.hx @@ -4,22 +4,22 @@ import openfl.Lib; class WindowUtils { public static var winTitle(default, set):String; - public static function set_winTitle(newWinTitle:String):String { - winTitle = newWinTitle; + private static function set_winTitle(value:String):String { + winTitle = value; updateTitle(); - return newWinTitle; + return value; } public static var prefix(default, set):String = ""; - public static function set_prefix(newPrefix:String):String { - prefix = newPrefix; + private static function set_prefix(value:String):String { + prefix = value; updateTitle(); - return newPrefix; + return value; } - public static var endfix(default, set):String = ""; - public static function set_endfix(endPrefix:String):String { - endfix = endPrefix; + public static var suffix(default, set):String = ""; + private static function set_suffix(value:String):String { + suffix = value; updateTitle(); - return endPrefix; + return value; } public static var preventClosing:Bool = true; @@ -43,10 +43,23 @@ class WindowUtils { public static inline function resetTitle() { winTitle = Lib.application.meta["name"]; - prefix = endfix = ""; + resetAffixes(); + } + + public static inline function resetAffixes() { + prefix = suffix = ""; updateTitle(); } public static inline function updateTitle() - Lib.application.window.title = '$prefix$winTitle$endfix'; + Lib.application.window.title = '$prefix$winTitle$suffix'; + + // backwards compat + @:noCompletion public static var endfix(get, set):String; + @:noCompletion private static function set_endfix(value:String):String { + return suffix = value; + } + @:noCompletion private static function get_endfix():String { + return suffix; + } } \ No newline at end of file diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index 359ef24d..10fa4efa 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -49,7 +49,7 @@ class CharacterEditor extends UIState { public override function create() { super.create(); - WindowUtils.endfix = " (Character Editor)"; + WindowUtils.suffix = " (Character Editor)"; SaveWarning.selectionClass = CharacterSelection; SaveWarning.saveFunc = () -> {_file_save(null);}; diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 1ed3da16..1071763a 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -109,7 +109,7 @@ class Charter extends UIState { public override function create() { super.create(); - WindowUtils.endfix = " (Chart Editor)"; + WindowUtils.suffix = " (Chart Editor)"; SaveWarning.selectionClass = CharterSelection; SaveWarning.saveFunc = () -> {_file_save(null);}; diff --git a/source/funkin/editors/ui/UIState.hx b/source/funkin/editors/ui/UIState.hx index 3e33004e..077750f3 100644 --- a/source/funkin/editors/ui/UIState.hx +++ b/source/funkin/editors/ui/UIState.hx @@ -129,7 +129,7 @@ class UIState extends MusicBeatState { super.destroy(); __mousePos.put(); - WindowUtils.resetTitle(); + WindowUtils.resetAffixes(); SaveWarning.reset(); FlxG.stage.window.onKeyDown.remove(onKeyDown); diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 2ae26370..b2c49abb 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -751,8 +751,8 @@ class PlayState extends MusicBeatState FlxG.sound.load(Paths.sound(s)); if (chartingMode) { - WindowUtils.endfix = " (Chart Playtesting)"; WindowUtils.prefix = Charter.undos.unsaved ? "* " : ""; + WindowUtils.suffix = " (Chart Playtesting)"; SaveWarning.showWarning = Charter.undos.unsaved; SaveWarning.selectionClass = CharterSelection; @@ -950,7 +950,7 @@ class PlayState extends MusicBeatState FlxG.sound.destroySound(vocals); } - WindowUtils.resetTitle(); + WindowUtils.resetAffixes(); SaveWarning.reset(); instance = null;