From af76191d7d05a558ecd0cffc9f01cc49c5a8d731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=9EHoovy=E2=9C=9E?= <124418090+MemeHovy@users.noreply.github.com> Date: Fri, 3 Nov 2023 14:08:27 -0400 Subject: [PATCH 1/2] fix for lime 8.1.0 (#212) --- .../_internal/backend/native/NativeWindow.hx | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/source/lime/_internal/backend/native/NativeWindow.hx b/source/lime/_internal/backend/native/NativeWindow.hx index a56c808d..76fab152 100644 --- a/source/lime/_internal/backend/native/NativeWindow.hx +++ b/source/lime/_internal/backend/native/NativeWindow.hx @@ -453,6 +453,28 @@ class NativeWindow } } + #if (lime >= "8.1.0") + public function setMinSize(width:Int, height:Int):Void + { + if (handle != null) + { + #if (!macro && lime_cffi) + NativeCFFI.lime_window_set_minimum_size(handle, width, height); + #end + } + } + + public function setMaxSize(width:Int, height:Int):Void + { + if (handle != null) + { + #if (!macro && lime_cffi) + NativeCFFI.lime_window_set_maximum_size(handle, width, height); + #end + } + } + #end + public function setBorderless(value:Bool):Bool { if (handle != null) @@ -661,6 +683,42 @@ class NativeWindow return value; } + #if (lime >= "8.1.0") + public function setVisible(value:Bool):Bool + { + if (handle != null) + { + #if (!macro && lime_cffi) + NativeCFFI.lime_window_set_visible(handle, value); + #end + } + + return value; + } + + public function getOpacity():Float + { + if (handle != null) + { + #if (!macro && lime_cffi) + return NativeCFFI.lime_window_get_opacity(handle); + #end + } + + return 1.0; + } + + public function setOpacity(value:Float):Void + { + if (handle != null) + { + #if (!macro && lime_cffi) + NativeCFFI.lime_window_set_opacity(handle, value); + #end + } + } + #end + public function warpMouse(x:Int, y:Int):Void { #if (!macro && lime_cffi) From 41b5044a5515ad789adebf8ec376c7c06c95ffca Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Fri, 3 Nov 2023 19:29:43 +0100 Subject: [PATCH 2/2] Fixed crash when closing the game --- source/lime/system/System.hx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/lime/system/System.hx b/source/lime/system/System.hx index 9a54fbc3..c269456f 100644 --- a/source/lime/system/System.hx +++ b/source/lime/system/System.hx @@ -141,12 +141,13 @@ class System #if (!lime_doc_gen || sys) public static function exit(code:Int):Void { - #if ((sys || air) && !macro) - if (Application.current != null) + var currentApp = Application.current; + #if ((sys || (js && html5) || air) && !macro) + if (currentApp != null) { - Application.current.onExit.dispatch(code); + currentApp.onExit.dispatch(code); - if (Application.current.onExit.canceled) + if (currentApp.onExit.canceled) { return; } @@ -155,6 +156,11 @@ class System #if sys Sys.exit(code); + #elseif (js && html5) + if (currentApp != null && currentApp.window != null) + { + currentApp.window.close(); + } #elseif air NativeApplication.nativeApplication.exit(code); #end @@ -527,12 +533,11 @@ class System @:noCompletion private static function __registerEntryPoint(projectName:String, entryPoint:Function):Void { // executes first!! - #if sys funkin.backend.utils.NativeAPI.registerAsDPICompatible(); funkin.backend.system.CommandLineHandler.parseCommandLine(Sys.args()); #end - + if (__applicationEntryPoint == null) { __applicationEntryPoint = new Map();