Constructor Tileset
Tileset(string, Texture2D, int, int)
Initializes a new instance of the Tileset class.
public Tileset(string name, Texture2D texture, int tileWidth, int tileHeight)
Parameters
name
stringThe name to assign the Tileset.
texture
Texture2DThe source texture used by this Tileset.
tileWidth
intThe width, in pixels, of each tile in this Tileset.
tileHeight
intThe height, in pixels, of each tile in this Tileset.
Remarks
The TextureRegion elements for each tile in this Tileset are auto-generated
based on the tileWidth
and tileHeight
specified. Both of these values
must be greater than zero and the width of the texture
must divide evenly by
the tileWidth
and the height of the texture
must divide evenly by the
tileHeight
Exceptions
- ArgumentOutOfRangeException
Thrown if the
tileWidth
ortileHeight
values are less than one.- ArgumentException
Thrown if the width of the
texture
does not divide evenly by thetileWidth
specified or if the height of thetexture
does not divide evenly by thetileHeight
specified.