Add app.meta.version to default template
This commit is contained in:
@@ -8,23 +8,23 @@ import ::APP_MAIN::;
|
|||||||
|
|
||||||
|
|
||||||
@:dox(hide) class ApplicationMain {
|
@:dox(hide) class ApplicationMain {
|
||||||
|
|
||||||
|
|
||||||
public static function main () {
|
public static function main () {
|
||||||
|
|
||||||
lime.system.System.__registerEntryPoint ("::APP_FILE::", create);
|
lime.system.System.__registerEntryPoint ("::APP_FILE::", create);
|
||||||
|
|
||||||
#if (!html5 || munit)
|
#if (!html5 || munit)
|
||||||
create (null);
|
create (null);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function create (config:Dynamic):Void {
|
public static function create (config:Dynamic):Void {
|
||||||
|
|
||||||
ManifestResources.init (config);
|
ManifestResources.init (config);
|
||||||
|
|
||||||
#if !munit
|
#if !munit
|
||||||
var app = new ::APP_MAIN:: ();
|
var app = new ::APP_MAIN:: ();
|
||||||
app.meta.set ("build", "::meta.buildNumber::");
|
app.meta.set ("build", "::meta.buildNumber::");
|
||||||
@@ -32,11 +32,12 @@ import ::APP_MAIN::;
|
|||||||
app.meta.set ("file", "::APP_FILE::");
|
app.meta.set ("file", "::APP_FILE::");
|
||||||
app.meta.set ("name", "::meta.title::");
|
app.meta.set ("name", "::meta.title::");
|
||||||
app.meta.set ("packageName", "::meta.packageName::");
|
app.meta.set ("packageName", "::meta.packageName::");
|
||||||
|
app.meta.set ("version", "::meta.version::");
|
||||||
|
|
||||||
#if !flash
|
#if !flash
|
||||||
::foreach windows::
|
::foreach windows::
|
||||||
var attributes:lime.ui.WindowAttributes = {
|
var attributes:lime.ui.WindowAttributes = {
|
||||||
|
|
||||||
allowHighDPI: ::allowHighDPI::,
|
allowHighDPI: ::allowHighDPI::,
|
||||||
alwaysOnTop: ::alwaysOnTop::,
|
alwaysOnTop: ::alwaysOnTop::,
|
||||||
borderless: ::borderless::,
|
borderless: ::borderless::,
|
||||||
@@ -54,11 +55,11 @@ import ::APP_MAIN::;
|
|||||||
width: ::width::,
|
width: ::width::,
|
||||||
x: ::x::,
|
x: ::x::,
|
||||||
y: ::y::,
|
y: ::y::,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
attributes.context = {
|
attributes.context = {
|
||||||
|
|
||||||
antialiasing: ::antialiasing::,
|
antialiasing: ::antialiasing::,
|
||||||
background: ::background::,
|
background: ::background::,
|
||||||
colorDepth: ::colorDepth::,
|
colorDepth: ::colorDepth::,
|
||||||
@@ -67,91 +68,91 @@ import ::APP_MAIN::;
|
|||||||
stencil: ::stencilBuffer::,
|
stencil: ::stencilBuffer::,
|
||||||
type: null,
|
type: null,
|
||||||
vsync: ::vsync::
|
vsync: ::vsync::
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (app.window == null) {
|
if (app.window == null) {
|
||||||
|
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
|
|
||||||
for (field in Reflect.fields (config)) {
|
for (field in Reflect.fields (config)) {
|
||||||
|
|
||||||
if (Reflect.hasField (attributes, field)) {
|
if (Reflect.hasField (attributes, field)) {
|
||||||
|
|
||||||
Reflect.setField (attributes, field, Reflect.field (config, field));
|
Reflect.setField (attributes, field, Reflect.field (config, field));
|
||||||
|
|
||||||
} else if (Reflect.hasField (attributes.context, field)) {
|
} else if (Reflect.hasField (attributes.context, field)) {
|
||||||
|
|
||||||
Reflect.setField (attributes.context, field, Reflect.field (config, field));
|
Reflect.setField (attributes.context, field, Reflect.field (config, field));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if sys
|
#if sys
|
||||||
lime.system.System.__parseArguments (attributes);
|
lime.system.System.__parseArguments (attributes);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.createWindow (attributes);
|
app.createWindow (attributes);
|
||||||
::end::
|
::end::
|
||||||
#elseif !air
|
#elseif !air
|
||||||
|
|
||||||
app.window.context.attributes.background = ::WIN_BACKGROUND::;
|
app.window.context.attributes.background = ::WIN_BACKGROUND::;
|
||||||
app.window.frameRate = ::WIN_FPS::;
|
app.window.frameRate = ::WIN_FPS::;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
// preloader.create ();
|
// preloader.create ();
|
||||||
|
|
||||||
for (library in ManifestResources.preloadLibraries) {
|
for (library in ManifestResources.preloadLibraries) {
|
||||||
|
|
||||||
app.preloader.addLibrary (library);
|
app.preloader.addLibrary (library);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (name in ManifestResources.preloadLibraryNames) {
|
for (name in ManifestResources.preloadLibraryNames) {
|
||||||
|
|
||||||
app.preloader.addLibraryName (name);
|
app.preloader.addLibraryName (name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.preloader.load ();
|
app.preloader.load ();
|
||||||
|
|
||||||
#if !munit
|
#if !munit
|
||||||
start (app);
|
start (app);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function start (app:lime.app.Application = null):Void {
|
public static function start (app:lime.app.Application = null):Void {
|
||||||
|
|
||||||
#if !munit
|
#if !munit
|
||||||
|
|
||||||
var result = app.exec ();
|
var result = app.exec ();
|
||||||
|
|
||||||
#if (sys && !ios && !nodejs && !emscripten)
|
#if (sys && !ios && !nodejs && !emscripten)
|
||||||
lime.system.System.exit (result);
|
lime.system.System.exit (result);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
new ::APP_MAIN:: ();
|
new ::APP_MAIN:: ();
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@:noCompletion @:dox(hide) public static function __init__ () {
|
@:noCompletion @:dox(hide) public static function __init__ () {
|
||||||
|
|
||||||
var init = lime.app.Application;
|
var init = lime.app.Application;
|
||||||
|
|
||||||
#if neko
|
#if neko
|
||||||
// Copy from https://github.com/HaxeFoundation/haxe/blob/development/std/neko/_std/Sys.hx#L164
|
// Copy from https://github.com/HaxeFoundation/haxe/blob/development/std/neko/_std/Sys.hx#L164
|
||||||
// since Sys.programPath () isn't available in __init__
|
// since Sys.programPath () isn't available in __init__
|
||||||
@@ -172,14 +173,14 @@ import ::APP_MAIN::;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var loader = new neko.vm.Loader (untyped $loader);
|
var loader = new neko.vm.Loader (untyped $loader);
|
||||||
loader.addPath (haxe.io.Path.directory (#if (haxe_ver >= 3.3) sys_program_path #else Sys.executablePath () #end));
|
loader.addPath (haxe.io.Path.directory (#if (haxe_ver >= 3.3) sys_program_path #else Sys.executablePath () #end));
|
||||||
loader.addPath ("./");
|
loader.addPath ("./");
|
||||||
loader.addPath ("@executable_path/");
|
loader.addPath ("@executable_path/");
|
||||||
#end
|
#end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user