1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

added index-based getter to texture atlas

This commit is contained in:
Ellpeck 2020-01-03 15:51:31 +01:00
parent 57fcc66054
commit c9d1fc4b47

View file

@ -11,6 +11,7 @@ namespace MLEM.Textures {
public readonly int RegionAmountY;
public readonly int RegionWidth;
public readonly int RegionHeight;
public TextureRegion this[int index] => this[index % this.RegionAmountX, index / this.RegionAmountX];
public TextureRegion this[Point point] => this[new Rectangle(point, new Point(1, 1))];
public TextureRegion this[int x, int y] => this[new Point(x, y)];
public TextureRegion this[Rectangle rect] => this.GetOrAddRegion(rect);