Update to support multiple windows
This commit is contained in:
@@ -63,11 +63,17 @@ class NativeApplication {
|
||||
|
||||
if (config != null) {
|
||||
|
||||
setFrameRate (config.fps);
|
||||
var window = new Window (config);
|
||||
var renderer = new Renderer (window);
|
||||
parent.addWindow (window);
|
||||
parent.addRenderer (renderer);
|
||||
setFrameRate (config.windows[0].fps);
|
||||
|
||||
for (data in config.windows) {
|
||||
|
||||
var window = new Window (data);
|
||||
var renderer = new Renderer (window);
|
||||
parent.addWindow (window);
|
||||
parent.addRenderer (renderer);
|
||||
|
||||
}
|
||||
|
||||
parent.init (parent);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +1,20 @@
|
||||
package lime.app;
|
||||
|
||||
|
||||
import lime.project.MetaData;
|
||||
import lime.project.WindowData;
|
||||
|
||||
|
||||
typedef Config = {
|
||||
|
||||
@:optional var antialiasing:Int;
|
||||
#if (js && html5)
|
||||
@:optional var assetsPrefix:String;
|
||||
#end
|
||||
@:optional var background:Null<Int>;
|
||||
@:optional var borderless:Bool;
|
||||
@:optional var company:String;
|
||||
@:optional var depthBuffer:Bool;
|
||||
@:optional var meta:MetaData;
|
||||
@:optional var windows:Array<WindowData>;
|
||||
#if (js && html5)
|
||||
@:optional var element:#if (haxe_ver >= "3.2") js.html.Element #else js.html.HtmlElement #end;
|
||||
#end
|
||||
@:optional var file:String;
|
||||
@:optional var fps:Int;
|
||||
@:optional var fullscreen:Bool;
|
||||
@:optional var hardware:Bool;
|
||||
@:optional var height:Int;
|
||||
@:optional var orientation:String;
|
||||
@:optional var packageName:String;
|
||||
@:optional var resizable:Bool;
|
||||
@:optional var stencilBuffer:Bool;
|
||||
@:optional var title:String;
|
||||
@:optional var version:String;
|
||||
@:optional var vsync:Bool;
|
||||
@:optional var width:Int;
|
||||
|
||||
}
|
||||
@@ -829,6 +829,8 @@ class HXProject {
|
||||
|
||||
}
|
||||
|
||||
context.meta = meta;
|
||||
|
||||
for (field in Reflect.fields (meta)) {
|
||||
|
||||
Reflect.setField (context, "APP_" + StringHelper.formatUppercaseVariable (field), Reflect.field (meta, field));
|
||||
@@ -857,6 +859,8 @@ class HXProject {
|
||||
|
||||
}
|
||||
|
||||
context.windows = windows;
|
||||
|
||||
for (i in 0...windows.length) {
|
||||
|
||||
for (field in Reflect.fields (windows[i])) {
|
||||
@@ -875,6 +879,8 @@ class HXProject {
|
||||
|
||||
}
|
||||
|
||||
windows[i].title = meta.title;
|
||||
|
||||
}
|
||||
|
||||
for (haxeflag in haxeflags) {
|
||||
|
||||
@@ -22,5 +22,6 @@ typedef WindowData = {
|
||||
@:optional var requireShaders:Bool;
|
||||
@:optional var depthBuffer:Bool;
|
||||
@:optional var stencilBuffer:Bool;
|
||||
@:optional var title:String;
|
||||
|
||||
}
|
||||
@@ -551,9 +551,9 @@ class System {
|
||||
#if !macro
|
||||
if (Application.current != null && Application.current.config != null) {
|
||||
|
||||
if (Application.current.config.company != null) {
|
||||
if (Application.current.config.meta.company != null) {
|
||||
|
||||
company = Application.current.config.company;
|
||||
company = Application.current.config.meta.company;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import lime.app.Config;
|
||||
import lime.app.Event;
|
||||
import lime.graphics.Image;
|
||||
import lime.graphics.Renderer;
|
||||
import lime.project.WindowData;
|
||||
import lime.system.Display;
|
||||
|
||||
|
||||
@@ -14,7 +15,7 @@ class Window {
|
||||
|
||||
public var application (default, null):Application;
|
||||
public var currentRenderer:Renderer;
|
||||
public var config:Config;
|
||||
public var config:WindowData;
|
||||
public var display (get, null):Display;
|
||||
public var enableTextEvents (get, set):Bool;
|
||||
public var fullscreen (get, set):Bool;
|
||||
@@ -57,7 +58,7 @@ class Window {
|
||||
@:noCompletion private var __y:Int;
|
||||
|
||||
|
||||
public function new (config:Config = null) {
|
||||
public function new (config:WindowData = null) {
|
||||
|
||||
this.config = config;
|
||||
|
||||
|
||||
@@ -66,26 +66,46 @@ class ApplicationMain {
|
||||
|
||||
config = {
|
||||
|
||||
antialiasing: Std.int (::WIN_ANTIALIASING::),
|
||||
background: Std.int (::WIN_BACKGROUND::),
|
||||
borderless: ::WIN_BORDERLESS::,
|
||||
company: "::META_COMPANY::",
|
||||
depthBuffer: ::WIN_DEPTH_BUFFER::,
|
||||
file: "::APP_FILE::",
|
||||
fps: Std.int (::WIN_FPS::),
|
||||
fullscreen: ::WIN_FULLSCREEN::,
|
||||
hardware: ::WIN_HARDWARE::,
|
||||
height: Std.int (::WIN_HEIGHT::),
|
||||
orientation: "::WIN_ORIENTATION::",
|
||||
packageName: "::META_PACKAGE_NAME::",
|
||||
resizable: ::WIN_RESIZABLE::,
|
||||
stencilBuffer: ::WIN_STENCIL_BUFFER::,
|
||||
title: "::APP_TITLE::",
|
||||
version: "::META_VERSION::",
|
||||
vsync: ::WIN_VSYNC::,
|
||||
width: Std.int (::WIN_WIDTH::),
|
||||
meta: {
|
||||
|
||||
buildNumber: "::meta.buildNumber::",
|
||||
company: "::meta.company::",
|
||||
packageName: "::meta.packageName::",
|
||||
title: "::meta.title::",
|
||||
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::,
|
||||
depthBuffer: ::depthBuffer::,
|
||||
stencilBuffer: ::stencilBuffer::,
|
||||
title: "::title::"
|
||||
|
||||
},
|
||||
::end::
|
||||
],
|
||||
|
||||
file: "::APP_FILE::"
|
||||
|
||||
};
|
||||
|
||||
#if (!html5 || munit)
|
||||
create ();
|
||||
|
||||
Reference in New Issue
Block a user