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
namestringThe name to assign the Tileset.
textureTexture2DThe source texture used by this Tileset.
tileWidthintThe width, in pixels, of each tile in this Tileset.
tileHeightintThe 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
tileWidthortileHeightvalues are less than one.- ArgumentException
Thrown if the width of the
texturedoes not divide evenly by thetileWidthspecified or if the height of thetexturedoes not divide evenly by thetileHeightspecified.