From 027b4bcc3d78647fccb7e92caef1707d4117909d Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 13 Jan 2023 16:43:58 +0700 Subject: [PATCH] GridInSprite --- .../render/{GridSprite.kt => GridInSprite.kt} | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/client/render/{GridSprite.kt => GridInSprite.kt} (65%) 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)