Browse Source

added resize()

ncannasse 12 years ago
parent
commit
ad2424d5e4
1 changed files with 10 additions and 0 deletions
  1. 10 0
      hxd/FloatBuffer.hx

+ 10 - 0
hxd/FloatBuffer.hx

@@ -46,6 +46,16 @@ abstract FloatBuffer(InnerData) {
 		while( this.length < v ) this.push(0.);
 		#end
 	}
+
+	public inline function resize( v : Int ) {
+		#if flash
+		this.length = v;
+		#else
+		while( this.length < v ) this.push(0.);
+		if( this.length > v ) this.splice(v, this.length - v);
+		#end
+	}
+	
 	
 	@:arrayAccess inline function arrayRead(key:Int) : Float {
 		return this[key];