From d7be30ffea93da5b8c612a1ea47f11c9db5b3b81 Mon Sep 17 00:00:00 2001 From: Hugh Sanderson Date: Thu, 8 Aug 2024 19:15:29 +0800 Subject: [PATCH] Add mainCommandLine as bootType --- templates/haxe/ApplicationMain.hx | 8 ++++++-- tools/nme/src/project/BootType.hx | 1 + tools/nme/src/project/NMMLParser.hx | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/templates/haxe/ApplicationMain.hx b/templates/haxe/ApplicationMain.hx index f4df35a0a..ee689a476 100644 --- a/templates/haxe/ApplicationMain.hx +++ b/templates/haxe/ApplicationMain.hx @@ -60,7 +60,7 @@ class ApplicationMain new ::APP_MAIN::(); ::elseif (APP_BOOT_TYPE=="BootTypeAddStage"):: new ApplicationDocument(); - ::else:: + ::elseif (APP_BOOT_TYPE!="BootTypeMainCommandLine"):: ApplicationBoot.createInstance(); ::end:: } @@ -117,8 +117,10 @@ class ApplicationMain #end #end - + ::if (APP_BOOT_TYPE=="BootTypeMainCommandLine"):: + ::APP_MAIN::.main(); + ::else:: #if flash // Flash @@ -266,6 +268,8 @@ class ApplicationMain // Unknown framework createInstance(); #end + + ::end:: } @:keep function keepMe() return Reflect.callMethod; diff --git a/tools/nme/src/project/BootType.hx b/tools/nme/src/project/BootType.hx index 5d2908b24..8c135612f 100644 --- a/tools/nme/src/project/BootType.hx +++ b/tools/nme/src/project/BootType.hx @@ -4,4 +4,5 @@ enum BootType BootTypeMain; BootTypeNew; BootTypeAddStage; + BootTypeMainCommandLine; } diff --git a/tools/nme/src/project/NMMLParser.hx b/tools/nme/src/project/NMMLParser.hx index 29744f563..666541e31 100644 --- a/tools/nme/src/project/NMMLParser.hx +++ b/tools/nme/src/project/NMMLParser.hx @@ -230,7 +230,7 @@ class NMMLParser project.app.preloader = substitute(element.att.preloader); case "bootType": - var types = ["auto", "main", "new", "addStage" ]; + var types = ["auto", "main", "new", "addStage", "mainCommandLine" ]; var type = substitute(element.att.bootType); var typeId = types.indexOf(type); if (typeId<0)