Rename skingrid to atlas/sprite grids

This commit is contained in:
DBotThePony 2023-01-13 16:36:52 +07:00
parent 5693ca266e
commit ada06bda05
Signed by: DBot
GPG Key ID: DCC23B5715498507
6 changed files with 17 additions and 17 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)
}

View File

@ -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()

View File

@ -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()

View File

@ -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]