瀏覽代碼

display time/parts

ncannasse 8 年之前
父節點
當前提交
59d7eb7526
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      hide/view/Particles3D.hx

+ 10 - 0
hide/view/Particles3D.hx

@@ -23,6 +23,7 @@ class Particles3D extends FileView {
 	var properties : hide.comp.PropsEditor;
 	var bounds : h3d.scene.Box;
 	var model : h3d.scene.Object;
+	var tf : h2d.Text;
 
 	override function getDefaultContent() {
 		var p = new h3d.parts.GpuParticles();
@@ -41,6 +42,7 @@ class Particles3D extends FileView {
 		properties.saveDisplayKey = "particles3D";
 		scene = new hide.comp.Scene(root.find(".scene"));
 		scene.onReady = init;
+		scene.onUpdate = update;
 	}
 
 	override function save() {
@@ -182,6 +184,14 @@ class Particles3D extends FileView {
 		scene.resetCamera(2);
 		new h3d.scene.CameraController(scene.s3d).loadFromCamera();
 		scene.init(props);
+
+		tf = new h2d.Text(hxd.res.DefaultFont.get(), scene.s2d);
+		tf.alpha = 0.2;
+		tf.x = tf.y = 5;
+	}
+
+	function update(dt:Float) {
+		tf.text = Math.floor(parts.currentTime)+"."+(Math.floor(Math.abs(parts.currentTime)*10)%10) + "s " + parts.count + " parts";
 	}
 
 	function initProperties() {