浏览代码

changed grid to gridFlatten, added grid with 2 dimensional array

ncannasse 8 年之前
父节点
当前提交
7e29045f34
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      h2d/Tile.hx

+ 3 - 3
h2d/Tile.hx

@@ -148,16 +148,16 @@ class Tile {
 
 	/**
 		Split the tile into a list of tiles of Size x Size pixels.
+		Unlike grid which is X/Y ordered, gridFlatten returns a single dimensional array ordered in Y/X.
 	**/
-	public function grid( size : Int, dx = 0, dy = 0 ) {
+	public function gridFlatten( size : Int, dx = 0, dy = 0 ) {
 		return [for( y in 0...Std.int(height / size) ) for( x in 0...Std.int(width / size) ) sub(x * size, y * size, size, size, dx, dy)];
 	}
 
 	/**
 		Split the tile into a list of tiles of Size x Size pixels.
-		Unly grid which is Y/X ordered, grid2D returns an X/Y two-dimensional array.
 	**/
-	public function grid2D( size : Int, dx = 0, dy = 0 ) {
+	public function grid( size : Int, dx = 0, dy = 0 ) {
 		return [for( x in 0...Std.int(width / size) ) [for( y in 0...Std.int(height / size) ) sub(x * size, y * size, size, size, dx, dy)]];
 	}