From f2a4b425c157f91b681dcb51b10a0a26b29ab738 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Wed, 26 Apr 2017 14:30:45 -0700 Subject: [PATCH] Fix Neko initialization loop --- lime/_backend/native/NativeApplication.hx | 9 +++++++++ lime/app/Application.hx | 7 +++++++ lime/system/CFFI.hx | 1 - templates/haxe/ApplicationMain.hx | 7 ++++--- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lime/_backend/native/NativeApplication.hx b/lime/_backend/native/NativeApplication.hx index 102d60848..85b5b5cce 100644 --- a/lime/_backend/native/NativeApplication.hx +++ b/lime/_backend/native/NativeApplication.hx @@ -68,6 +68,15 @@ class NativeApplication { private var toggleFullscreen:Bool; + private static function __init__ () { + + #if (lime_cffi && !macro) + var init = NativeCFFI; + #end + + } + + public function new (parent:Application):Void { this.parent = parent; diff --git a/lime/app/Application.hx b/lime/app/Application.hx index ce94e2f91..25af8b651 100644 --- a/lime/app/Application.hx +++ b/lime/app/Application.hx @@ -50,6 +50,13 @@ class Application extends Module { @:noCompletion private var windowByID:Map; + private static function __init__ () { + + var init = ApplicationBackend; + + } + + public function new () { super (); diff --git a/lime/system/CFFI.hx b/lime/system/CFFI.hx index 6845a8f69..66d9b5899 100644 --- a/lime/system/CFFI.hx +++ b/lime/system/CFFI.hx @@ -31,7 +31,6 @@ class CFFI { private static function __init__ ():Void { #if lime_cffi - var init = lime._backend.native.NativeCFFI; available = true; enabled = #if disable_cffi false; #else true; #end #else diff --git a/templates/haxe/ApplicationMain.hx b/templates/haxe/ApplicationMain.hx index 6f26b22e0..bd078bd62 100644 --- a/templates/haxe/ApplicationMain.hx +++ b/templates/haxe/ApplicationMain.hx @@ -87,7 +87,9 @@ package; preloader.load (); + #if !munit start (app); + #end } @@ -113,9 +115,7 @@ package; @:noCompletion @:dox(hide) public static function __init__ () { - #if lime_cffi - var init = lime.system.CFFI; - #end + var init = lime.app.Application; #if neko // Copy from https://github.com/HaxeFoundation/haxe/blob/development/std/neko/_std/Sys.hx#L164 @@ -142,6 +142,7 @@ package; loader.addPath (haxe.io.Path.directory (#if (haxe_ver >= 3.3) sys_program_path #else Sys.executablePath () #end)); loader.addPath ("./"); loader.addPath ("@executable_path/"); + #end }