Ver Fonte

changed grid to gridFlatten, added grid with 2 dimensional array

ncannasse há 8 anos atrás
pai
commit
7e29045f34
1 ficheiros alterados com 3 adições e 3 exclusões
  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.
 		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)];
 		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.
 		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)]];
 		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)]];
 	}
 	}