Explorar o código

added resize()

ncannasse %!s(int64=12) %!d(string=hai) anos
pai
achega
ad2424d5e4
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  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];