Przeglądaj źródła

Adding LoadingScene.

clementlandrin 1 rok temu
rodzic
commit
9fd5d6a303
1 zmienionych plików z 22 dodań i 0 usunięć
  1. 22 0
      h2d/LoadingScene.hx

+ 22 - 0
h2d/LoadingScene.hx

@@ -0,0 +1,22 @@
+package h2d;
+
+class LoadingScene extends h2d.Scene {
+
+	var presentCooldown : Float;
+	public function new(presentCooldown : Float) {
+		super();
+		this.presentCooldown = presentCooldown;
+	}
+
+	override function render( engine : h3d.Engine ) {
+		hxd.Timer.update();
+		var dt = hxd.Timer.dt;
+		ctx.elapsedTime += dt;
+		if ( ctx.elapsedTime < presentCooldown )
+			return;
+		ctx.elapsedTime = 0.0;
+		hxd.System.timeoutTick();
+		super.render(engine);
+		engine.driver.present();
+	}
+}