Refactor widgets atlas

This commit is contained in:
DBotThePony 2022-09-02 15:59:01 +07:00
parent 17e1f58a13
commit 37234e6503
Signed by: DBot
GPG Key ID: DCC23B5715498507
5 changed files with 21 additions and 23 deletions

View File

@ -23,9 +23,8 @@ abstract class AbstractSlotPanel @JvmOverloads constructor(
) : EditablePanel(
screen, parent, x, y, width, height
) {
protected open fun renderSlotBackground(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
RenderSystem.setShaderTexture(0, WidgetLocation.WIDGETS)
drawTexturedRectAuto(stack, 0f, 0f, 18f, 18f, 0f, 96f, 256f, 256f)
protected open fun renderSlotBackground(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
SLOT_BACKGROUND.render(stack, width = width, height = height)
}
protected open fun renderRegular(stack: PoseStack, itemstack: ItemStack, count_override: String? = null) {
@ -119,10 +118,9 @@ abstract class AbstractSlotPanel @JvmOverloads constructor(
}
companion object {
@JvmField
val SLOT_HIGHLIGHT = RGBAColor(255, 255, 255, 100)
@JvmField
val SLOT_HIGHLIGHT_DRAG = RGBAColor(200, 200, 200, 150)
const val SIZE = 18f
val SLOT_BACKGROUND = WidgetLocation.WIDGETS.element(0f, 0f, SIZE, SIZE)
}
}

View File

@ -42,16 +42,16 @@ open class CheckBoxPanel(
val CHECKBOX_UNCHECKED = SkinElement(
WidgetLocation.WIDGETS,
x = 18f,
y = 65f,
x = 59f,
y = 241f,
w = REGULAR_DIMENSIONS,
h = REGULAR_DIMENSIONS,
)
val CHECKBOX_CHECKED = SkinElement(
WidgetLocation.WIDGETS,
x = 18f,
y = 80f,
x = 44f,
y = 241f,
w = REGULAR_DIMENSIONS,
h = REGULAR_DIMENSIONS,
)

View File

@ -13,7 +13,7 @@ import ru.dbotthepony.mc.otm.core.formatPowerLevel
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
open class PowerGaugePanel @JvmOverloads constructor(
open class PowerGaugePanel(
screen: MatteryScreen<*>,
parent: EditablePanel? = null,
val widget: LevelGaugeWidget,
@ -65,8 +65,8 @@ open class PowerGaugePanel @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 0f, y = 48f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 9f, y = 48f, w = 9f, h = 48f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 202f, y = 0f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 211f, y = 0f, w = 9f, h = 48f)
val GAUGE_BACKGROUND_WIDE = WidgetLocation.WIDGETS.element(x = 238f, y = 0f, w = 18f, h = 48f)
val GAUGE_FOREGROUND_WIDE = WidgetLocation.WIDGETS.element(x = 220f, y = 0f, w = 18f, h = 48f)
@ -86,7 +86,7 @@ fun WidePowerGaugePanel(
height: Float = 48f
) = PowerGaugePanel(screen, parent, widget, x, y, width, height)
open class MatterGaugePanel @JvmOverloads constructor(
open class MatterGaugePanel(
screen: MatteryScreen<*>,
parent: EditablePanel? = null,
val widget: LevelGaugeWidget,
@ -120,12 +120,12 @@ open class MatterGaugePanel @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 0f, y = 0f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 9f, y = 0f, w = 9f, h = 48f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 184f, y = 0f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 193f, y = 0f, w = 9f, h = 48f)
}
}
open class PatternGaugePanel @JvmOverloads constructor(
open class PatternGaugePanel(
screen: MatteryScreen<*>,
parent: EditablePanel? = null,
val widget: LevelGaugeWidget,
@ -159,8 +159,8 @@ open class PatternGaugePanel @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 0f, y = 148f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 9f, y = 148f, w = 9f, h = 48f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 166f, y = 0f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 175f, y = 0f, w = 9f, h = 48f)
}
}
@ -230,7 +230,7 @@ open class ProgressGaugePanel @JvmOverloads constructor(
}
companion object {
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 0f, y = 132f, w = 22f, h = 16f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 22f, y = 132f, w = 22f, h = 16f)
val GAUGE_BACKGROUND = WidgetLocation.WIDGETS.element(x = 0f, y = 240f, w = 22f, h = 16f)
val GAUGE_FOREGROUND = WidgetLocation.WIDGETS.element(x = 22f, y = 240f, w = 22f, h = 16f)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB