diff --git a/lime/app/Application.hx b/lime/app/Application.hx index 25d6f7a5b..590b27e88 100644 --- a/lime/app/Application.hx +++ b/lime/app/Application.hx @@ -170,18 +170,26 @@ class Application extends Module { if (config != null) { - frameRate = config.windows[0].fps; + if (Reflect.hasField (config, "fps")) { + + frameRate = config.fps; + + } - for (data in config.windows) { + if (Reflect.hasField (config, "windows")) { - var window = new Window (data); - var renderer = new Renderer (window); - addWindow (window); - addRenderer (renderer); - - #if (flash || html5) - break; - #end + for (windowConfig in config.windows) { + + var window = new Window (windowConfig); + var renderer = new Renderer (window); + addWindow (window); + addRenderer (renderer); + + #if (flash || html5) + break; + #end + + } } diff --git a/lime/app/Config.hx b/lime/app/Config.hx index 6eec01502..cb7d4003e 100644 --- a/lime/app/Config.hx +++ b/lime/app/Config.hx @@ -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; + @: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; + +} + + +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; } \ No newline at end of file diff --git a/lime/system/System.hx b/lime/system/System.hx index bf7b8668b..87802ca61 100644 --- a/lime/system/System.hx +++ b/lime/system/System.hx @@ -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; } diff --git a/lime/ui/Window.hx b/lime/ui/Window.hx index 67d253d2d..ba72c65fb 100644 --- a/lime/ui/Window.hx +++ b/lime/ui/Window.hx @@ -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; diff --git a/templates/haxe/ApplicationMain.hx b/templates/haxe/ApplicationMain.hx index 38c6a3ff6..c4e6228c4 100644 --- a/templates/haxe/ApplicationMain.hx +++ b/templates/haxe/ApplicationMain.hx @@ -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:: + ] };