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
@@ -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 = "";