1.0.0 • Published 8 years ago
gri2d v1.0.0
Gri2D
This is a small library to work with 2d arrays.
Usage
//Initialize a 12x8 grid filled with 1
var grid = new Gri2D(12,8,1);
//Get the cell value at 5,3 coordinates
grid.set(5,3);
//Set each cell to its index
grid.each(function(el,i,array){
return i;
});
Methods
setArray(array,flat,width)
getArray()
set(x,y,value)
get(x,y)
getSize()
getWidth()
getHeight()
find(value)
swap(x1,y1,x2,y2)
isOnEdge(x,y)
isInside(x,y)
isClose(x1,y1,x2,y2,radius)
each(function(element,index,array){})
print()
1.0.0
8 years ago