Grid
Description:
A class used to render a texture as a grid of sprites, where each sprite can be positioned, colored, and have its UV coordinates manipulated.
Class Object: Grid Class.
Inherits from: Node.
gridX
Type: Readonly Field.
Description:
The number of columns in the grid. And there are gridX + 1
vertices horizontally for rendering.
Signature:
const gridX: integer
gridY
Type: Readonly Field.
Description:
The number of rows in the grid. And there are gridY + 1
vertices vertically for rendering.
Signature:
const gridY: integer
depthWrite
Type: Field.
Description:
Whether depth writes are enabled (default is false).
Signature:
depthWrite: boolean
texture
Type: Field.
Description:
The texture used for the grid.
Signature:
texture: Texture2D
textureRect
Type: Field.
Description:
The rectangle within the texture that is used for the grid.
Signature:
textureRect: Rect
blendFunc
Type: Field.
Description:
The blending function used for the grid.
Signature:
blendFunc: BlendFunc
effect
Type: Field.
Description:
The sprite effect applied to the grid.
Default is SpriteEffect("builtin:vs_sprite", "builtin:fs_sprite")
.
Signature:
effect: SpriteEffect
setPos
Type: Function.
Description:
Sets the position of a vertex in the grid.
Signature:
setPos: function(self: Grid, x: integer, y: integer, pos: Vec2, z?: number)
Parameters:
Parameter | Type | Description |
---|---|---|
x | integer | The x-coordinate of the vertex in the grid. |
y | integer | The y-coordinate of the vertex in the grid. |
pos | Vec2 | The new position of the vertex. |
z | number | [optional] The z-coordinate of the vertex. Default is 0. |
getPos
Type: Function.
Description:
Gets the position of a vertex in the grid.
Signature:
getPos: function(self: Grid, x: integer, y: integer): Vec2
Parameters:
Parameter | Type | Description |
---|---|---|
x | integer | The x-coordinate of the vertex in the grid. |
y | integer | The y-coordinate of the vertex in the grid. |
Returns:
Return Type | Description |
---|---|
Vec2 | The current position of the vertex. |
getColor
Type: Function.
Description:
Gets the color of a vertex in the grid.
Signature:
getColor: function(self: Grid, x: integer, y: integer): Color
Parameters:
Parameter | Type | Description |
---|---|---|
x | integer | The x-coordinate of the vertex in the grid. |
y | integer | The y-coordinate of the vertex in the grid. |
Returns:
Return Type | Description |
---|---|
Color | The current color of the vertex. |
setColor
Type: Function.
Description:
Sets the color of a vertex in the grid.
Signature:
setColor: function(self: Grid, x: integer, y: integer, color: Color)
Parameters:
Parameter | Type | Description |
---|---|---|
x | integer | The x-coordinate of the vertex in the grid. |
y | integer | The y-coordinate of the vertex in the grid. |
color | Color | The new color of the vertex. |
moveUV
Type: Function.
Description:
Moves the UV coordinates of a vertex in the grid.
Signature:
moveUV: function(self: Grid, x: integer, y: integer, offset: Vec2)
Parameters:
Parameter | Type | Description |
---|---|---|
x | integer | The x-coordinate of the vertex in the grid. |
y | integer | The y-coordinate of the vertex in the grid. |
offset | Vec2 | The offset by which to move the UV coordinates. |