bstouls 8 年之前
父节点
当前提交
a0ed6379c8
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      h2d/SpriteBatch.hx

+ 6 - 1
h2d/SpriteBatch.hx

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