bstouls %!s(int64=8) %!d(string=hai) anos
pai
achega
a0ed6379c8
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      h2d/SpriteBatch.hx

+ 6 - 1
h2d/SpriteBatch.hx

@@ -101,11 +101,16 @@ class SpriteBatch extends Drawable {
 		tile = t;
 	}
 
-	public function add(e:BatchElement) {
+	public function add(e:BatchElement,before=false) {
 		e.batch = this;
 		if( first == null ) {
 			first = last = e;
 			e.prev = e.next = null;
+		} else if( before ) {
+			e.prev = null;
+			e.next = first;
+			first.prev = e;
+			first = e;
 		} else {
 			last.next = e;
 			e.prev = last;