This function can be used to add all the values of all the cells found within the source area of a grid to the values within the destination grid, as illustrated below:
NOTE: You can also use this function on the same grid to add values from one region of the grid to those stored in another (see code example below).
ds_grid_add_grid_region(index, source, x1, y1, x2, y2, xpos, ypos);
参数 | 描述 |
---|---|
index | 靶栅格的索引 |
source | 源栅格的索引 |
x1 | 从源栅格复制的单元格区域的左端位置 |
y1 | 从源栅格复制的单元格区域的顶端位置 |
x2 | 从源栅格复制的单元格区域的右端位置 |
y2 | 从源栅格复制的单元格区域的底端位置 |
xpos | 待叠加给的靶栅格上的x位置 |
ypos | 待叠加给的靶栅格上的y位置< |
N/A(无返回值)
ds_grid_add_grid_region(grid, grid, 0, 0, 1, 5, 2,
0)
The above code would copy the region of cells from (0,0) to (1,5) of the ds-grid indexed in the variable "grid" and add them to the cells from position (2,0) of the same ds_grid.