Improve lime.app.Config
This commit is contained in:
@@ -170,18 +170,26 @@ class Application extends Module {
|
||||
|
||||
if (config != null) {
|
||||
|
||||
frameRate = config.windows[0].fps;
|
||||
if (Reflect.hasField (config, "fps")) {
|
||||
|
||||
for (data in config.windows) {
|
||||
frameRate = config.fps;
|
||||
|
||||
var window = new Window (data);
|
||||
var renderer = new Renderer (window);
|
||||
addWindow (window);
|
||||
addRenderer (renderer);
|
||||
}
|
||||
|
||||
#if (flash || html5)
|
||||
break;
|
||||
#end
|
||||
if (Reflect.hasField (config, "windows")) {
|
||||
|
||||
for (windowConfig in config.windows) {
|
||||
|
||||
var window = new Window (windowConfig);
|
||||
var renderer = new Renderer (window);
|
||||
addWindow (window);
|
||||
addRenderer (renderer);
|
||||
|
||||
#if (flash || html5)
|
||||
break;
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,44 @@
|
||||
package lime.app;
|
||||
|
||||
|
||||
import lime.project.MetaData;
|
||||
import lime.project.WindowData;
|
||||
|
||||
|
||||
typedef Config = {
|
||||
|
||||
#if (js && html5)
|
||||
@:optional var assetsPrefix:String;
|
||||
#end
|
||||
@:optional var meta:MetaData;
|
||||
@:optional var windows:Array<WindowData>;
|
||||
@:optional var build:String;
|
||||
@:optional var company:String;
|
||||
@:optional var file:String;
|
||||
@:optional var fps:Int;
|
||||
@:optional var name:String;
|
||||
@:optional var orientation:String;
|
||||
@:optional var packageName:String;
|
||||
@:optional var version:String;
|
||||
@:optional var windows:Array<WindowConfig>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
typedef WindowConfig = {
|
||||
|
||||
@:optional var antialiasing:Int;
|
||||
@:optional var background:Int;
|
||||
@:optional var borderless:Bool;
|
||||
@:optional var depthBuffer:Bool;
|
||||
@:optional var display:Int;
|
||||
#if (js && html5)
|
||||
@:optional var element:#if (haxe_ver >= "3.2") js.html.Element #else js.html.HtmlElement #end;
|
||||
#end
|
||||
@:optional var fullscreen:Bool;
|
||||
@:optional var hardware:Bool;
|
||||
@:optional var height:Int;
|
||||
@:optional var parameters:String;
|
||||
@:optional var resizable:Bool;
|
||||
@:optional var stencilBuffer:Bool;
|
||||
@:optional var title:String;
|
||||
@:optional var vsync:Bool;
|
||||
@:optional var width:Int;
|
||||
@:optional var x:Int;
|
||||
@:optional var y:Int;
|
||||
|
||||
}
|
||||
@@ -551,9 +551,9 @@ class System {
|
||||
#if !macro
|
||||
if (Application.current != null && Application.current.config != null) {
|
||||
|
||||
if (Application.current.config.meta.company != null) {
|
||||
if (Application.current.config.company != null) {
|
||||
|
||||
company = Application.current.config.meta.company;
|
||||
company = Application.current.config.company;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import lime.app.Config;
|
||||
import lime.app.Event;
|
||||
import lime.graphics.Image;
|
||||
import lime.graphics.Renderer;
|
||||
import lime.project.WindowData;
|
||||
import lime.system.Display;
|
||||
|
||||
#if openfl
|
||||
@@ -21,7 +20,7 @@ class Window {
|
||||
|
||||
public var application (default, null):Application;
|
||||
public var currentRenderer:Renderer;
|
||||
public var config:WindowData;
|
||||
public var config:WindowConfig;
|
||||
public var display (get, null):Display;
|
||||
public var enableTextEvents (get, set):Bool;
|
||||
public var fullscreen (get, set):Bool;
|
||||
@@ -65,7 +64,7 @@ class Window {
|
||||
@:noCompletion private var __y:Int;
|
||||
|
||||
|
||||
public function new (config:WindowData = null) {
|
||||
public function new (config:WindowConfig = null) {
|
||||
|
||||
this.config = config;
|
||||
|
||||
@@ -79,10 +78,10 @@ class Window {
|
||||
|
||||
if (config != null) {
|
||||
|
||||
// TODO: Switch to the tool's Config type?
|
||||
|
||||
if (Reflect.hasField (config, "width")) __width = config.width;
|
||||
if (Reflect.hasField (config, "height")) __height = config.height;
|
||||
if (Reflect.hasField (config, "x")) __x = config.x;
|
||||
if (Reflect.hasField (config, "y")) __y = config.y;
|
||||
if (Reflect.hasField (config, "fullscreen")) __fullscreen = config.fullscreen;
|
||||
if (Reflect.hasField (config, "title")) __title = config.title;
|
||||
|
||||
|
||||
@@ -66,44 +66,35 @@ class ApplicationMain {
|
||||
|
||||
config = {
|
||||
|
||||
meta: {
|
||||
|
||||
buildNumber: "::meta.buildNumber::",
|
||||
company: "::meta.company::",
|
||||
packageName: "::meta.packageName::",
|
||||
title: "::meta.title::",
|
||||
version: "::meta.version::"
|
||||
|
||||
},
|
||||
|
||||
build: "::meta.buildNumber::",
|
||||
company: "::meta.company::",
|
||||
file: "::APP_FILE::",
|
||||
fps: ::WIN_FPS::,
|
||||
name: "::meta.title::",
|
||||
orientation: "::WIN_ORIENTATION::",
|
||||
packageName: "::meta.packageName::",
|
||||
version: "::meta.version::",
|
||||
windows: [
|
||||
::foreach windows::
|
||||
{
|
||||
|
||||
width: ::width::,
|
||||
height: ::height::,
|
||||
x: ::x::,
|
||||
y: ::y::,
|
||||
background: ::background::,
|
||||
parameters: "::parameters::",
|
||||
fps: ::fps::,
|
||||
hardware: ::hardware::,
|
||||
display: ::display::,
|
||||
resizable: ::resizable::,
|
||||
borderless: ::borderless::,
|
||||
vsync: ::vsync::,
|
||||
fullscreen: ::fullscreen::,
|
||||
antialiasing: ::antialiasing::,
|
||||
orientation: ::orientation::,
|
||||
background: ::background::,
|
||||
borderless: ::borderless::,
|
||||
depthBuffer: ::depthBuffer::,
|
||||
display: ::display::,
|
||||
fullscreen: ::fullscreen::,
|
||||
hardware: ::hardware::,
|
||||
height: ::height::,
|
||||
parameters: "::parameters::",
|
||||
resizable: ::resizable::,
|
||||
stencilBuffer: ::stencilBuffer::,
|
||||
title: "::title::"
|
||||
|
||||
},
|
||||
::end::
|
||||
],
|
||||
|
||||
file: "::APP_FILE::"
|
||||
title: "::title::",
|
||||
vsync: ::vsync::,
|
||||
width: ::width::,
|
||||
x: ::x::,
|
||||
y: ::y::
|
||||
},::end::
|
||||
]
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user