瀏覽代碼

move init vars from Engine to static, only allow hxd.App to create engine (requires some specific handling). close #567

Nicolas Cannasse 6 年之前
父節點
當前提交
e8649cae99
共有 2 個文件被更改,包括 7 次插入4 次删除
  1. 6 3
      h3d/Engine.hx
  2. 1 1
      hxd/App.hx

+ 6 - 3
h3d/Engine.hx

@@ -51,11 +51,14 @@ class Engine {
 	var textureColorCache = new Map<Int,h3d.mat.Texture>();
 	var textureColorCache = new Map<Int,h3d.mat.Texture>();
 	public var ready(default,null) = false;
 	public var ready(default,null) = false;
 	@:allow(hxd.res) var resCache = new Map<{},Dynamic>();
 	@:allow(hxd.res) var resCache = new Map<{},Dynamic>();
+	
+	public static var SOFTWARE_DRIVER = false;
+	public static var ANTIALIASING = 0;
 
 
 	@:access(hxd.Window)
 	@:access(hxd.Window)
-	public function new( hardware = true, aa = 0 ) {
-		this.hardware = hardware;
-		this.antiAlias = aa;
+	function new() {
+		this.hardware = !SOFTWARE_DRIVER;
+		this.antiAlias = ANTIALIASING;
 		this.autoResize = true;
 		this.autoResize = true;
 		fullScreen = !hxd.System.getValue(IsWindowed);
 		fullScreen = !hxd.System.getValue(IsWindowed);
 		window = hxd.Window.getInstance();
 		window = hxd.Window.getInstance();

+ 1 - 1
hxd/App.hx

@@ -43,7 +43,7 @@ class App implements h3d.IDrawable {
 			haxe.Timer.delay(setup, 0);
 			haxe.Timer.delay(setup, 0);
 		} else {
 		} else {
 			hxd.System.start(function() {
 			hxd.System.start(function() {
-				this.engine = engine = new h3d.Engine();
+				this.engine = engine = @:privateAccess new h3d.Engine();
 				engine.onReady = setup;
 				engine.onReady = setup;
 				engine.init();
 				engine.init();
 			});
 			});