Warning shit added

This commit is contained in:
lunarcleint
2023-09-17 17:34:05 -07:00
parent 0d4152a592
commit 3556d96f6b
13 changed files with 103 additions and 27 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
package funkin.backend.system;
import funkin.editors.SaveWarning;
import funkin.backend.assets.AssetsLibraryList;
import funkin.backend.system.framerate.SystemInfo;
import openfl.utils.AssetLibrary;
@@ -107,7 +108,8 @@ class Main extends Sprite
}
public static function loadGameSettings() {
WindowTitle.init();
WindowUtils.init();
SaveWarning.init();
MemoryUtil.init();
@:privateAccess
FlxG.game.getTimer = getTimer;
@@ -2,7 +2,7 @@ package funkin.backend.utils;
import openfl.Lib;
class WindowTitle {
class WindowUtils {
public static var winTitle(default, set):String;
public static function set_winTitle(newWinTitle:String):String {
winTitle = newWinTitle;
@@ -22,9 +22,25 @@ class WindowTitle {
return endPrefix;
}
public static inline function init()
public static var preventClosing:Bool = true;
public static var onClosing:Void->Void;
static var __triedClosing:Bool = false;
public static inline function resetClosing() __triedClosing = false;
public static inline function init() {
reset();
Lib.application.window.onClose.add(function () {
if (preventClosing && !__triedClosing) {
Lib.application.window.onClose.cancel();
__triedClosing = true;
}
if (onClosing != null) onClosing();
});
}
public static inline function reset() {
winTitle = Lib.application.meta["name"];
prefix = endfix = "";