diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridSprite.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridInSprite.kt similarity index 65% rename from src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridSprite.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridInSprite.kt index d4640546a..ea03082e3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridSprite.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridInSprite.kt @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.render @Suppress("unused") -data class GridSprite( +data class GridInSprite( val parent: AbstractMatterySprite, val width: Float, val height: Float, @@ -14,7 +14,7 @@ data class GridSprite( val currentX: Float get() = column * width val currentY: Float get() = row * height - fun skip(): GridSprite { + fun skip(): GridInSprite { column++ if (column >= columns) { @@ -24,37 +24,37 @@ data class GridSprite( return this } - fun jump(): GridSprite { + fun jump(): GridInSprite { row++ column = 0 return this } fun next(): AbstractMatterySprite { - val element = parent.subElement(currentX, currentY, width, height) + val element = parent.sprite(currentX, currentY, width, height) skip() return element } - fun reset(): GridSprite { + fun reset(): GridInSprite { row = 0 column = 0 return this } - fun seek(row: Int, column: Int): GridSprite { + fun seek(row: Int, column: Int): GridInSprite { this.row = row this.column = column return this } operator fun get(column: Int, row: Int) = - parent.subElement(column * width, row * height, width, height) + parent.sprite(column * width, row * height, width, height) } -fun AbstractMatterySprite.subGrid( +fun AbstractMatterySprite.grid( width: Float, height: Float, columns: Int = 16, rows: Int = 16, -) = GridSprite(this, width, height, columns, rows) +) = GridInSprite(this, width, height, columns, rows)