Sfoglia il codice sorgente

Do not present before engine ready (#370)

Pascal Peridont 7 anni fa
parent
commit
10b27577c9
2 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 2 0
      h3d/Engine.hx
  2. 1 1
      hxd/System.hl.hx

+ 2 - 0
h3d/Engine.hx

@@ -50,6 +50,7 @@ class Engine {
 	var needFlushTarget : Bool;
 	var nullTexture : h3d.mat.Texture;
 	var textureColorCache = new Map<Int,h3d.mat.Texture>();
+	public var ready(default,null) = false;
 	@:allow(hxd.res) var resCache = new Map<{},Dynamic>();
 
 	@:access(hxd.Stage)
@@ -224,6 +225,7 @@ class Engine {
 			onContextLost();
 		else
 			onReady();
+		ready = true;
 	}
 
 	public dynamic function onContextLost() {

+ 1 - 1
hxd/System.hl.hx

@@ -70,7 +70,7 @@ class System {
 
 		// present
 		var cur = h3d.Engine.getCurrent();
-		if( cur != null ) cur.driver.present();
+		if( cur != null && cur.ready ) cur.driver.present();
 		return true;
 	}