diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AbstractSkinElement.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AbstractSkinElement.kt index e6c95855b..cd7251996 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AbstractSkinElement.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AbstractSkinElement.kt @@ -39,6 +39,14 @@ sealed class AbstractSkinElement { abstract val u1: Float abstract val v1: Float + fun partialU(offset: Float): Float { + return u0 + (offset / width) * (u1 - u0) + } + + fun partialV(offset: Float): Float { + return v0 + (offset / height) * (v1 - v0) + } + abstract val type: SkinElementType open val winding: UVWindingOrder get() = UVWindingOrder.NORMAL diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AtlasSkinElement.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AtlasSkinElement.kt index 9db8193a9..ad0a1c839 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AtlasSkinElement.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/AtlasSkinElement.kt @@ -20,6 +20,7 @@ class AtlasSkinElement( override val height: Float, val spriteWidth: Float = Mth.smallestEncompassingPowerOfTwo(width.toInt()).toFloat(), val spriteHeight: Float = Mth.smallestEncompassingPowerOfTwo(height.toInt()).toFloat(), + override val winding: UVWindingOrder = UVWindingOrder.NORMAL, ) : AbstractSkinElement() { init { synchronized(keys) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SubSkinElement.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SubSkinElement.kt index 9087419dc..02304f554 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SubSkinElement.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/SubSkinElement.kt @@ -8,6 +8,7 @@ class SubSkinElement( val yOffset: Float = 0f, val subWidth: Float = parent.width, val subHeight: Float = parent.height, + private val overrideWinding: UVWindingOrder? = null ) : AbstractSkinElement() { override val width: Float get() = subWidth @@ -29,6 +30,17 @@ class SubSkinElement( override val type: SkinElementType get() = SkinElementType.SUBELEMENT + + override val winding: UVWindingOrder + get() = overrideWinding ?: parent.winding + + fun copy( + xOffset: Float = this.xOffset, + yOffset: Float = this.yOffset, + subWidth: Float = this.subWidth, + subHeight: Float = this.subHeight, + overrideWinding: UVWindingOrder? = this.overrideWinding + ) = SubSkinElement(parent, xOffset, yOffset, subWidth, subHeight, overrideWinding) } fun AbstractSkinElement.subElement( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/WidgetLocation.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/WidgetLocation.kt index d75511b3f..abd4f14e0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/WidgetLocation.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/WidgetLocation.kt @@ -4,8 +4,14 @@ import net.minecraft.resources.ResourceLocation import ru.dbotthepony.mc.otm.OverdriveThatMatters object WidgetLocation { - val WIDGETS = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets.png") val WIDGETS_18 = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets_18.png") val WIDGETS_8 = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/widgets_8.png") - val SCROLL = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/gui/scroll.png") -} \ No newline at end of file + + val MISC = AtlasSkinElement(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/misc"), 64f, 64f) + val PATTERN_PANEL_TABS = AtlasSkinElement(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/pattern_panel_tabs"), 64f, 32f) + + val CHECKBOX = AtlasSkinElement(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/checkbox"), 32f, 16f) + val PROGRESS_ARROWS = AtlasSkinElement(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/progress_arrows"), 32f, 32f) + val HORIZONTAL_GAUGES = AtlasSkinElement(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/horizontal_gauges"), 128f, 64f) + val VERTICAL_GAUGES = AtlasSkinElement(ResourceLocation(OverdriveThatMatters.MOD_ID, "widgets/vertical_gauges"), 128f, 48f) +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets.kt index ab9cbb6be..0921111a3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/Widgets.kt @@ -1,15 +1,15 @@ package ru.dbotthepony.mc.otm.client.render object Widgets { - val SLOT = WidgetLocation.WIDGETS.element(0f, 0f, 18f, 18f) + val SLOT = WidgetLocation.MISC.subElement(0f, 0f, 18f, 18f) - val ARROW_UP_BUTTON_IDLE = WidgetLocation.WIDGETS.element(0f, 18f, 18f, 6f) - val ARROW_UP_BUTTON_HOVERED = WidgetLocation.WIDGETS.element(0f, 18f + 6f, 18f, 6f) - val ARROW_UP_BUTTON_PRESSED = WidgetLocation.WIDGETS.element(0f, 18f + 6f * 2f, 18f, 6f) - val ARROW_UP_BUTTON_DISABLED = WidgetLocation.WIDGETS.element(0f, 18f + 6f * 3f, 18f, 6f) + val ARROW_UP_BUTTON_IDLE = WidgetLocation.MISC.subElement(0f, 18f, 18f, 6f) + val ARROW_UP_BUTTON_HOVERED = WidgetLocation.MISC.subElement(0f, 18f + 6f, 18f, 6f) + val ARROW_UP_BUTTON_PRESSED = WidgetLocation.MISC.subElement(0f, 18f + 6f * 2f, 18f, 6f) + val ARROW_UP_BUTTON_DISABLED = WidgetLocation.MISC.subElement(0f, 18f + 6f * 3f, 18f, 6f) - val ARROW_DOWN_BUTTON_IDLE = ARROW_UP_BUTTON_IDLE.copy(winding = UVWindingOrder.FLIP) - val ARROW_DOWN_BUTTON_HOVERED = ARROW_UP_BUTTON_HOVERED.copy(winding = UVWindingOrder.FLIP) - val ARROW_DOWN_BUTTON_PRESSED = ARROW_UP_BUTTON_PRESSED.copy(winding = UVWindingOrder.FLIP) - val ARROW_DOWN_BUTTON_DISABLED = ARROW_UP_BUTTON_DISABLED.copy(winding = UVWindingOrder.FLIP) + val ARROW_DOWN_BUTTON_IDLE = ARROW_UP_BUTTON_IDLE.copy(overrideWinding = UVWindingOrder.FLIP) + val ARROW_DOWN_BUTTON_HOVERED = ARROW_UP_BUTTON_HOVERED.copy(overrideWinding = UVWindingOrder.FLIP) + val ARROW_DOWN_BUTTON_PRESSED = ARROW_UP_BUTTON_PRESSED.copy(overrideWinding = UVWindingOrder.FLIP) + val ARROW_DOWN_BUTTON_DISABLED = ARROW_UP_BUTTON_DISABLED.copy(overrideWinding = UVWindingOrder.FLIP) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BankRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BankRenderer.kt index 9b05e19dc..bc7961c43 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BankRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BankRenderer.kt @@ -12,6 +12,7 @@ import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.entity.BatteryBankBlockEntity import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.block.entity.matter.MatterCapacitorBankBlockEntity +import ru.dbotthepony.mc.otm.client.render.AbstractSkinElement import ru.dbotthepony.mc.otm.client.render.SkinElement import ru.dbotthepony.mc.otm.client.render.is3DContext import ru.dbotthepony.mc.otm.client.screen.widget.MatterGaugePanel @@ -21,7 +22,7 @@ import kotlin.math.PI abstract class BankRenderer(private val context: BlockEntityRendererProvider.Context) : BlockEntityRenderer { protected abstract fun gaugeLevel(entity: T): Float - protected abstract val texture: SkinElement + protected abstract val texture: AbstractSkinElement override fun render( blockEntity: T, @@ -81,7 +82,7 @@ class BatteryBankRenderer(context: BlockEntityRendererProvider.Context) : BankRe return entity.gaugeLevel } - override val texture: SkinElement + override val texture: AbstractSkinElement get() = PowerGaugePanel.GAUGE_FOREGROUND } @@ -90,7 +91,7 @@ class MatterBatteryBankRenderer(context: BlockEntityRendererProvider.Context) : return entity.gaugeLevel } - override val texture: SkinElement + override val texture: AbstractSkinElement get() = MatterGaugePanel.GAUGE_FOREGROUND } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatterPanelScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatterPanelScreen.kt index be34dde9d..71b5d1e11 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatterPanelScreen.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/MatterPanelScreen.kt @@ -9,6 +9,7 @@ import ru.dbotthepony.mc.otm.capability.matter.IPatternState import ru.dbotthepony.mc.otm.capability.matter.IReplicationTask import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.element +import ru.dbotthepony.mc.otm.client.render.subElement import ru.dbotthepony.mc.otm.client.screen.panels.* import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.maxScrollDivision @@ -303,9 +304,9 @@ class MatterPanelScreen( const val GRID_HEIGHT = 8 const val GRID_WIDTH = 9 - val PATTERN_LIST_ACTIVE = WidgetLocation.WIDGETS.element(36f, 0f, 14f, 23f) - val TASK_LIST_ACTIVE = WidgetLocation.WIDGETS.element(64f, 0f, 16f, 16f) - val PATTERN_LIST_INACTIVE = WidgetLocation.WIDGETS.element(50f, 0f, 14f, 23f) - val TASK_LIST_INACTIVE = WidgetLocation.WIDGETS.element(80f, 0f, 16f, 16f) + val PATTERN_LIST_ACTIVE = WidgetLocation.PATTERN_PANEL_TABS.subElement(0f, 0f, 14f, 23f) + val TASK_LIST_ACTIVE = WidgetLocation.PATTERN_PANEL_TABS.subElement(28f, 0f, 16f, 16f) + val PATTERN_LIST_INACTIVE = WidgetLocation.PATTERN_PANEL_TABS.subElement(14f, 0f, 14f, 23f) + val TASK_LIST_INACTIVE = WidgetLocation.PATTERN_PANEL_TABS.subElement(44f, 0f, 16f, 16f) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/AbstractSlotPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/AbstractSlotPanel.kt index 29281604b..d7bcb2480 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/AbstractSlotPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/AbstractSlotPanel.kt @@ -112,6 +112,6 @@ abstract class AbstractSlotPanel> @JvmOverloads constru val SLOT_HIGHLIGHT = RGBAColor(255, 255, 255, 100) val SLOT_HIGHLIGHT_DRAG = RGBAColor(200, 200, 200, 150) const val SIZE = 18f - val SLOT_BACKGROUND = WidgetLocation.WIDGETS.element(0f, 0f, SIZE, SIZE) + val SLOT_BACKGROUND = WidgetLocation.MISC.subElement(0f, 0f, SIZE, SIZE) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/BackgroundPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/BackgroundPanel.kt index b48c3606a..34cbe3a26 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/BackgroundPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/BackgroundPanel.kt @@ -6,6 +6,7 @@ import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen import ru.dbotthepony.mc.otm.client.render.StretchingRectangleElement import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.element +import ru.dbotthepony.mc.otm.client.render.subElement import ru.dbotthepony.mc.otm.client.screen.MatteryScreen open class BackgroundPanel( @@ -44,15 +45,15 @@ open class BackgroundPanel( ) = BackgroundPanel(screen, parent, x - 3f, y - 3f, width + 6f, height + 6f) val RECTANGLE = StretchingRectangleElement( - topLeft = WidgetLocation.WIDGETS.element(18f, 24f, 3f, 3f), - topRight = WidgetLocation.WIDGETS.element(27f, 24f, 3f, 3f), - bottomLeft = WidgetLocation.WIDGETS.element(18f, 33f, 3f, 3f), - bottomRight = WidgetLocation.WIDGETS.element(27f, 33f, 3f, 3f), - top = WidgetLocation.WIDGETS.element(21f, 24f, 6f, 2f), - bottom = WidgetLocation.WIDGETS.element(21f, 34f, 6f, 2f), - left = WidgetLocation.WIDGETS.element(18f, 27f, 2f, 6f), - right = WidgetLocation.WIDGETS.element(28f, 27f, 2f, 6f), - middle = WidgetLocation.WIDGETS.element(30f, 12f, 6f, 6f), + topLeft = WidgetLocation.MISC.subElement(18f, 24f, 3f, 3f), + topRight = WidgetLocation.MISC.subElement(27f, 24f, 3f, 3f), + bottomLeft = WidgetLocation.MISC.subElement(18f, 33f, 3f, 3f), + bottomRight = WidgetLocation.MISC.subElement(27f, 33f, 3f, 3f), + top = WidgetLocation.MISC.subElement(21f, 24f, 6f, 2f), + bottom = WidgetLocation.MISC.subElement(21f, 34f, 6f, 2f), + left = WidgetLocation.MISC.subElement(18f, 27f, 2f, 6f), + right = WidgetLocation.MISC.subElement(28f, 27f, 2f, 6f), + middle = WidgetLocation.MISC.subElement(30f, 12f, 6f, 6f), padding = DockProperty(-1f, -1f, -1f, -1f) ) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ButtonPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ButtonPanel.kt index 3ec7bc0db..89c4b7e7c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ButtonPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ButtonPanel.kt @@ -135,10 +135,10 @@ abstract class RectangleButtonPanel( onPress?.invoke(clickButton) } - abstract val PRESSED: SkinElement - abstract val HOVERED: SkinElement - abstract val IDLE: SkinElement - abstract val DISABLED: SkinElement + abstract val PRESSED: AbstractSkinElement + abstract val HOVERED: AbstractSkinElement + abstract val IDLE: AbstractSkinElement + abstract val DISABLED: AbstractSkinElement var isDisabled = false set(value) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/CheckBox.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/CheckBox.kt index 704205919..a50e2f453 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/CheckBox.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/CheckBox.kt @@ -7,6 +7,7 @@ import ru.dbotthepony.mc.otm.client.minecraft import ru.dbotthepony.mc.otm.client.playGuiClickSound import ru.dbotthepony.mc.otm.client.render.SkinElement import ru.dbotthepony.mc.otm.client.render.WidgetLocation +import ru.dbotthepony.mc.otm.client.render.subElement import ru.dbotthepony.mc.otm.client.screen.panels.CheckBoxPanel.Companion.REGULAR_DIMENSIONS import ru.dbotthepony.mc.otm.menu.widget.BooleanPlayerInputWidget @@ -41,21 +42,8 @@ open class CheckBoxPanel @JvmOverloads constructor( companion object { const val REGULAR_DIMENSIONS = 15f - val CHECKBOX_UNCHECKED = SkinElement( - WidgetLocation.WIDGETS, - x = 59f, - y = 241f, - width = REGULAR_DIMENSIONS, - height = REGULAR_DIMENSIONS, - ) - - val CHECKBOX_CHECKED = SkinElement( - WidgetLocation.WIDGETS, - x = 44f, - y = 241f, - width = REGULAR_DIMENSIONS, - height = REGULAR_DIMENSIONS, - ) + val CHECKBOX_UNCHECKED = WidgetLocation.CHECKBOX.subElement(width = REGULAR_DIMENSIONS, height = REGULAR_DIMENSIONS) + val CHECKBOX_CHECKED = WidgetLocation.CHECKBOX.subElement(x = REGULAR_DIMENSIONS, width = REGULAR_DIMENSIONS, height = REGULAR_DIMENSIONS) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt index 6b8581f9b..48ffe2e3e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt @@ -25,8 +25,8 @@ open class FramePanel( open inner class Tab( var onOpen: Runnable? = null, var onClose: Runnable? = null, - var activeIcon: SkinElement? = null, - var inactiveIcon: SkinElement? = null, + var activeIcon: AbstractSkinElement? = null, + var inactiveIcon: AbstractSkinElement? = null, ) : EditablePanel(this@FramePanel.screen, this@FramePanel, 0f, 0f, 28f, 28f) { var isActive = tabs.isEmpty() var initial = false @@ -216,21 +216,21 @@ open class FramePanel( const val PADDING_TOP = 14f val RECTANGLE = StretchingRectangleElement( - topLeft = WidgetLocation.WIDGETS.element(x = 18f, y = 0f, width = 6f, height = 6f), - topRight = WidgetLocation.WIDGETS.element(x = 24f, y = 0f, width = 6f, height = 6f), - left = WidgetLocation.WIDGETS.element(x = 18f, y = 4f, width = 3f, height = 5f), - right = WidgetLocation.WIDGETS.element(x = 25f, y = 3f, width = 5f, height = 5f), - top = WidgetLocation.WIDGETS.element(x = 22f, y = 0f, width = 5f, height = 3f), - bottomLeft = WidgetLocation.WIDGETS.element(x = 18f, y = 6f, width = 6f, height = 6f), - bottomRight = WidgetLocation.WIDGETS.element(x = 24f, y = 6f, width = 6f, height = 6f), - bottom = WidgetLocation.WIDGETS.element(x = 21f, y = 9f, width = 5f, height = 3f), - middle = WidgetLocation.WIDGETS.element(x = 30f, y = 12f, width = 6f, height = 6f), + topLeft = WidgetLocation.MISC.subElement(x = 18f, y = 0f, width = 6f, height = 6f), + topRight = WidgetLocation.MISC.subElement(x = 24f, y = 0f, width = 6f, height = 6f), + left = WidgetLocation.MISC.subElement(x = 18f, y = 4f, width = 3f, height = 5f), + right = WidgetLocation.MISC.subElement(x = 25f, y = 3f, width = 5f, height = 5f), + top = WidgetLocation.MISC.subElement(x = 22f, y = 0f, width = 5f, height = 3f), + bottomLeft = WidgetLocation.MISC.subElement(x = 18f, y = 6f, width = 6f, height = 6f), + bottomRight = WidgetLocation.MISC.subElement(x = 24f, y = 6f, width = 6f, height = 6f), + bottom = WidgetLocation.MISC.subElement(x = 21f, y = 9f, width = 5f, height = 3f), + middle = WidgetLocation.MISC.subElement(x = 30f, y = 12f, width = 6f, height = 6f), padding = DockProperty(-3f, -3f, -3f, -3f) ) - val TAB_RIGHT_CONNECTION = WidgetLocation.WIDGETS.element(x = 30f, y = 0f, width = 3f, height = 5f) - val TAB_LEFT_CONNECTION = WidgetLocation.WIDGETS.element(x = 33f, y = 0f, width = 3f, height = 5f) - val TAB_BACKGROUND = WidgetLocation.WIDGETS.element(x = 30f, y = 6f, width = 6f, height = 6f) + val TAB_RIGHT_CONNECTION = WidgetLocation.MISC.subElement(x = 30f, y = 0f, width = 3f, height = 5f) + val TAB_LEFT_CONNECTION = WidgetLocation.MISC.subElement(x = 33f, y = 0f, width = 3f, height = 5f) + val TAB_BACKGROUND = WidgetLocation.MISC.subElement(x = 30f, y = 6f, width = 6f, height = 6f) const val TAB_HEIGHT = 28f const val TAB_WIDTH = 28f diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/HeightControls.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/HeightControls.kt index 23e4c781b..8b9ad55b3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/HeightControls.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/HeightControls.kt @@ -2,6 +2,7 @@ package ru.dbotthepony.mc.otm.client.screen.panels import com.mojang.blaze3d.platform.InputConstants import net.minecraft.client.gui.screens.Screen +import ru.dbotthepony.mc.otm.client.render.AbstractSkinElement import ru.dbotthepony.mc.otm.client.render.SkinElement import ru.dbotthepony.mc.otm.client.render.Widgets @@ -44,10 +45,10 @@ open class HeightControls( } open inner class Control(val isIncrease: Boolean) : RectangleButtonPanel(screen, this@HeightControls, width = BUTTON_WIDTH, height = BUTTON_HEIGHT) { - override val PRESSED: SkinElement = if (isIncrease) Widgets.ARROW_DOWN_BUTTON_PRESSED else Widgets.ARROW_UP_BUTTON_PRESSED - override val HOVERED: SkinElement = if (isIncrease) Widgets.ARROW_DOWN_BUTTON_HOVERED else Widgets.ARROW_UP_BUTTON_HOVERED - override val IDLE: SkinElement = if (isIncrease) Widgets.ARROW_DOWN_BUTTON_IDLE else Widgets.ARROW_UP_BUTTON_IDLE - override val DISABLED: SkinElement = if (isIncrease) Widgets.ARROW_DOWN_BUTTON_DISABLED else Widgets.ARROW_UP_BUTTON_DISABLED + override val PRESSED: AbstractSkinElement = if (isIncrease) Widgets.ARROW_DOWN_BUTTON_PRESSED else Widgets.ARROW_UP_BUTTON_PRESSED + override val HOVERED: AbstractSkinElement = if (isIncrease) Widgets.ARROW_DOWN_BUTTON_HOVERED else Widgets.ARROW_UP_BUTTON_HOVERED + override val IDLE: AbstractSkinElement = if (isIncrease) Widgets.ARROW_DOWN_BUTTON_IDLE else Widgets.ARROW_UP_BUTTON_IDLE + override val DISABLED: AbstractSkinElement = if (isIncrease) Widgets.ARROW_DOWN_BUTTON_DISABLED else Widgets.ARROW_UP_BUTTON_DISABLED init { dock = Dock.TOP diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/HorizontalPowerGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/HorizontalPowerGaugePanel.kt index d904067ef..2d27ff716 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/HorizontalPowerGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/HorizontalPowerGaugePanel.kt @@ -5,6 +5,7 @@ import net.minecraft.client.gui.screens.Screen import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.element +import ru.dbotthepony.mc.otm.client.render.subElement import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget @@ -44,11 +45,11 @@ open class HorizontalPowerGaugePanel( } companion object { - val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 160f, y = 238f, width = 96f, height = 9f) - val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 160f, y = 247f, width = 96f, height = 9f) + val GAUGE_BACKGROUND_TALL = WidgetLocation.HORIZONTAL_GAUGES.subElement(width = 96f, height = 18f) + val GAUGE_FOREGROUND_TALL = WidgetLocation.HORIZONTAL_GAUGES.subElement(y = 18f, width = 96f, height = 18f) - val GAUGE_BACKGROUND_TALL = WidgetLocation.WIDGETS.element(x = 160f, y = 202f, width = 96f, height = 18f) - val GAUGE_FOREGROUND_TALL = WidgetLocation.WIDGETS.element(x = 160f, y = 220f, width = 96f, height = 18f) + val GAUGE_BACKGROUND = WidgetLocation.HORIZONTAL_GAUGES.subElement(y = 36f, width = 96f, height = 9f) + val GAUGE_FOREGROUND = WidgetLocation.HORIZONTAL_GAUGES.subElement(y = 45f, width = 96f, height = 9f) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt index 076705614..51004036c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/MatterGaugePanel.kt @@ -11,6 +11,7 @@ import net.minecraft.network.chat.Component import org.lwjgl.opengl.GL11 import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.element +import ru.dbotthepony.mc.otm.client.render.subElement import ru.dbotthepony.mc.otm.client.render.tesselator import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.core.TranslatableComponent @@ -77,9 +78,9 @@ open class MatterGaugePanel @JvmOverloads constructor( RenderSystem.setShaderColor(1f, 1f, 1f, 1f) - val u0 = GAUGE_FOREGROUND.x / GAUGE_FOREGROUND.imageWidth - val u1 = (GAUGE_FOREGROUND.x + GAUGE_FOREGROUND.width) / GAUGE_FOREGROUND.imageWidth - val v1 = (GAUGE_FOREGROUND.y + GAUGE_FOREGROUND.height) / GAUGE_FOREGROUND.imageHeight + val u0 = GAUGE_FOREGROUND.u0 + val u1 = GAUGE_FOREGROUND.u1 + val v1 = GAUGE_FOREGROUND.v1 val matrix = stack.last().pose() val builder = tesselator.builder @@ -97,8 +98,8 @@ open class MatterGaugePanel @JvmOverloads constructor( val thisY = (height + sin + cos).coerceAtLeast(0f) builder.vertex(matrix, thisX, thisY, 0f).uv( - (GAUGE_FOREGROUND.x + (i / 4f) * GAUGE_FOREGROUND.width) / GAUGE_FOREGROUND.imageWidth, - (GAUGE_FOREGROUND.y + thisY) / GAUGE_FOREGROUND.imageHeight, + GAUGE_FOREGROUND.partialU((i / 4f) * GAUGE_FOREGROUND.width), + GAUGE_FOREGROUND.partialV(thisY), ).endVertex() } @@ -116,7 +117,7 @@ open class MatterGaugePanel @JvmOverloads constructor( } companion object { - val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 184f, y = 0f, width = 9f, height = 48f) - val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 193f, y = 0f, width = 9f, height = 48f) + val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 18f, width = 9f) + val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 27f, width = 9f) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt index 9ababe6aa..3fe2eb7f6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PatternGaugePanel.kt @@ -6,6 +6,7 @@ import net.minecraft.network.chat.Component import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.element +import ru.dbotthepony.mc.otm.client.render.subElement import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget @@ -47,7 +48,7 @@ open class PatternGaugePanel @JvmOverloads constructor( } companion object { - val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 166f, y = 0f, width = 9f, height = 48f) - val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 175f, y = 0f, width = 9f, height = 48f) + val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(width = 9f) + val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 9f, width = 9f) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PowerGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PowerGaugePanel.kt index 01dc48458..ec2bab3ab 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PowerGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/PowerGaugePanel.kt @@ -61,11 +61,11 @@ open class PowerGaugePanel @JvmOverloads constructor( } companion object { - val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 202f, y = 0f, width = 9f, height = 48f) - val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 211f, y = 0f, width = 9f, height = 48f) + val GAUGE_BACKGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 36f, width = 9f) + val GAUGE_FOREGROUND = WidgetLocation.VERTICAL_GAUGES.subElement(x = 45f, width = 9f) - val GAUGE_BACKGROUND_WIDE = WidgetLocation.WIDGETS.element(x = 238f, y = 0f, width = 18f, height = 48f) - val GAUGE_FOREGROUND_WIDE = WidgetLocation.WIDGETS.element(x = 220f, y = 0f, width = 18f, height = 48f) + val GAUGE_BACKGROUND_WIDE = WidgetLocation.VERTICAL_GAUGES.subElement(x = 54f, width = 18f) + val GAUGE_FOREGROUND_WIDE = WidgetLocation.VERTICAL_GAUGES.subElement(x = 72f, width = 18f) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/ProgressGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/ProgressGaugePanel.kt index ffb87bd2c..ab6acc045 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/ProgressGaugePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/ProgressGaugePanel.kt @@ -8,6 +8,7 @@ import net.minecraft.network.chat.Component import ru.dbotthepony.mc.otm.client.render.UVWindingOrder import ru.dbotthepony.mc.otm.client.render.WidgetLocation import ru.dbotthepony.mc.otm.client.render.element +import ru.dbotthepony.mc.otm.client.render.subElement import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget @@ -78,7 +79,7 @@ open class ProgressGaugePanel @JvmOverloads constructor( } companion object { - val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 0f, y = 240f, width = 22f, height = 16f) - val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 22f, y = 240f, width = 22f, height = 16f) + val GAUGE_BACKGROUND = WidgetLocation.PROGRESS_ARROWS.subElement(y = 0f, width = 22f, height = 15f) + val GAUGE_FOREGROUND = WidgetLocation.PROGRESS_ARROWS.subElement(y = 16f, width = 22f, height = 15f) } -} \ No newline at end of file +} diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.png deleted file mode 100644 index 1574d5f01..000000000 Binary files a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.png and /dev/null differ diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.xcf b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.xcf deleted file mode 100644 index 52f836a06..000000000 Binary files a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets.xcf and /dev/null differ diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/checkbox.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/checkbox.png new file mode 100644 index 000000000..e91224c79 Binary files /dev/null and b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/checkbox.png differ diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/horizontal_gauges.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/horizontal_gauges.png new file mode 100644 index 000000000..83caab387 Binary files /dev/null and b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/horizontal_gauges.png differ diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/misc.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/misc.png new file mode 100644 index 000000000..8923a02d7 Binary files /dev/null and b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/misc.png differ diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/pattern_panel_tabs.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/pattern_panel_tabs.png new file mode 100644 index 000000000..6988d0fc4 Binary files /dev/null and b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/pattern_panel_tabs.png differ diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/progress_arrows.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/progress_arrows.png new file mode 100644 index 000000000..97e068022 Binary files /dev/null and b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/progress_arrows.png differ diff --git a/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/vertical_gauges.png b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/vertical_gauges.png new file mode 100644 index 000000000..8f94dd84e Binary files /dev/null and b/src/main/resources/assets/overdrive_that_matters/textures/gui/widgets/vertical_gauges.png differ