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