From ada06bda05af61a98495991065d8ee2768003083 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 13 Jan 2023 16:36:52 +0700 Subject: [PATCH] Rename skingrid to atlas/sprite grids --- .../otm/client/render/{SkinGrid.kt => GridAtlas.kt} | 10 +++++----- .../client/render/{SubSkinGrid.kt => GridSprite.kt} | 12 ++++++------ .../dbotthepony/mc/otm/client/render/MatteryAtlas.kt | 4 ++-- .../mc/otm/client/render/ResearchIcons.kt | 2 +- .../ru/dbotthepony/mc/otm/client/render/Widgets18.kt | 4 ++-- .../ru/dbotthepony/mc/otm/client/render/Widgets8.kt | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/client/render/{SkinGrid.kt => GridAtlas.kt} (86%) rename src/main/kotlin/ru/dbotthepony/mc/otm/client/render/{SubSkinGrid.kt => GridSprite.kt} (80%) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SkinGrid.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridAtlas.kt similarity index 86% rename from src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SkinGrid.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridAtlas.kt index f83cb71df..942fdc287 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SkinGrid.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridAtlas.kt @@ -3,7 +3,7 @@ package ru.dbotthepony.mc.otm.client.render import net.minecraft.resources.ResourceLocation @Suppress("unused") -data class SkinGrid( +data class GridAtlas( val texture: ResourceLocation, val width: Float, val height: Float, @@ -19,7 +19,7 @@ data class SkinGrid( val currentX: Float get() = column * width val currentY: Float get() = row * height - fun skip(): SkinGrid { + fun skip(): GridAtlas { column++ if (column >= columns) { @@ -29,7 +29,7 @@ data class SkinGrid( return this } - fun jump(): SkinGrid { + fun jump(): GridAtlas { row++ column = 0 return this @@ -41,13 +41,13 @@ data class SkinGrid( return element } - fun reset(): SkinGrid { + fun reset(): GridAtlas { row = 0 column = 0 return this } - fun seek(row: Int, column: Int): SkinGrid { + fun seek(row: Int, column: Int): GridAtlas { this.row = row this.column = column return this diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SubSkinGrid.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridSprite.kt similarity index 80% rename from src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SubSkinGrid.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridSprite.kt index ea740df7d..d4640546a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SubSkinGrid.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/GridSprite.kt @@ -1,7 +1,7 @@ package ru.dbotthepony.mc.otm.client.render @Suppress("unused") -data class SubSkinGrid( +data class GridSprite( val parent: AbstractMatterySprite, val width: Float, val height: Float, @@ -14,7 +14,7 @@ data class SubSkinGrid( val currentX: Float get() = column * width val currentY: Float get() = row * height - fun skip(): SubSkinGrid { + fun skip(): GridSprite { column++ if (column >= columns) { @@ -24,7 +24,7 @@ data class SubSkinGrid( return this } - fun jump(): SubSkinGrid { + fun jump(): GridSprite { row++ column = 0 return this @@ -36,13 +36,13 @@ data class SubSkinGrid( return element } - fun reset(): SubSkinGrid { + fun reset(): GridSprite { row = 0 column = 0 return this } - fun seek(row: Int, column: Int): SubSkinGrid { + fun seek(row: Int, column: Int): GridSprite { this.row = row this.column = column return this @@ -57,4 +57,4 @@ fun AbstractMatterySprite.subGrid( height: Float, columns: Int = 16, rows: Int = 16, -) = SubSkinGrid(this, width, height, columns, rows) +) = GridSprite(this, width, height, columns, rows) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatteryAtlas.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatteryAtlas.kt index 4a9304fa8..601ba15bb 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatteryAtlas.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/MatteryAtlas.kt @@ -17,8 +17,8 @@ data class MatteryAtlas( ) = MatterySprite(texture, x = x, y = y, width = width, height = height, atlasHeight = this.height, atlasWidth = this.width, winding = winding) @Deprecated("Construct grid directly instead") - fun subGrid(rows: Int, columns: Int) = SkinGrid(texture, this.width / rows, this.height / columns, rows = rows, columns = columns) + fun subGrid(rows: Int, columns: Int) = GridAtlas(texture, this.width / rows, this.height / columns, rows = rows, columns = columns) @Deprecated("Construct grid directly instead") - fun subGrid(width: Float, height: Float, rows: Int, columns: Int) = SkinGrid(texture, width, height, rows, columns) + fun subGrid(width: Float, height: Float, rows: Int, columns: Int) = GridAtlas(texture, width, height, rows, columns) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/ResearchIcons.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/ResearchIcons.kt index 8587d4197..f71d40de4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/ResearchIcons.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/ResearchIcons.kt @@ -34,7 +34,7 @@ object ResearchIcons { val KOT = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/block/ph_kitty.png").element(0f, 0f, 32f, 32f, 32f, 32f) init { - val grid = SkinGrid(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/android_upgrades.png"), 18f, 18f, 7, 7) + val grid = GridAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/android_upgrades.png"), 18f, 18f, 7, 7) ICON_TRANSFER = grid.next() ICON_ATTACK_BOOST = grid.next() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets18.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets18.kt index d49145350..741279d5d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets18.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets18.kt @@ -1,6 +1,6 @@ package ru.dbotthepony.mc.otm.client.render -private fun makeButton(grid: SkinGrid): StretchingRectangleElement { +private fun makeButton(grid: GridAtlas): StretchingRectangleElement { val x = grid.currentX val y = grid.currentY @@ -18,7 +18,7 @@ private fun makeButton(grid: SkinGrid): StretchingRectangleElement { } object Widgets18 { - val GRID = SkinGrid(WidgetLocation.WIDGETS_18, 18f, 18f) + val GRID = GridAtlas(WidgetLocation.WIDGETS_18, 18f, 18f) val BUTTON_IDLE_STRETCHABLE = makeButton(GRID) val BUTTON_IDLE = GRID.next() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets8.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets8.kt index bd18562ab..035e66671 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets8.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets8.kt @@ -4,7 +4,7 @@ import net.minecraft.resources.ResourceLocation import ru.dbotthepony.mc.otm.OverdriveThatMatters object Widgets8 { - val GRID = SkinGrid(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets_8.png"), 8f, 8f, 64 / 8, 32 / 8) + val GRID = GridAtlas(ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets_8.png"), 8f, 8f, 64 / 8, 32 / 8) val BUTTON_IDLE = GRID[0, 0] val BUTTON_HOVERED = GRID[0, 1]