From c9d1fc4b47afabe0df0fd0e00c882296b5a612e5 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 3 Jan 2020 15:51:31 +0100 Subject: [PATCH] added index-based getter to texture atlas --- MLEM/Textures/UniformTextureAtlas.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/MLEM/Textures/UniformTextureAtlas.cs b/MLEM/Textures/UniformTextureAtlas.cs index 71f56a6..d2e0643 100644 --- a/MLEM/Textures/UniformTextureAtlas.cs +++ b/MLEM/Textures/UniformTextureAtlas.cs @@ -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);