Rename fields of skin element to appropriate name

This commit is contained in:
DBotThePony 2022-06-21 22:57:00 +07:00
parent 63c8f3fcb9
commit 7d5faad7df
Signed by: DBot
GPG Key ID: DCC23B5715498507
4 changed files with 76 additions and 78 deletions

View File

@ -48,20 +48,20 @@ fun ResourceLocation.element(
class SkinElement @JvmOverloads constructor( class SkinElement @JvmOverloads constructor(
val texture: ResourceLocation, val texture: ResourceLocation,
val image_x: Float, val x: Float,
val image_y: Float, val y: Float,
val rect_w: Float, val w: Float,
val rect_h: Float, val h: Float,
val defined_width: Float = 256f, val imageWidth: Float = 256f,
val defined_height: Float = 256f val imageHeight: Float = 256f
) { ) {
@JvmOverloads @JvmOverloads
fun render( fun render(
stack: PoseStack, stack: PoseStack,
x: Float = 0f, x: Float = 0f,
y: Float = 0f, y: Float = 0f,
width: Float = rect_w, width: Float = w,
height: Float = rect_h, height: Float = h,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1 winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) { ) {
RenderSystem.setShaderTexture(0, texture) RenderSystem.setShaderTexture(0, texture)
@ -76,8 +76,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Double, x: Double,
y: Double = 0.0, y: Double = 0.0,
width: Double = rect_w.toDouble(), width: Double = w.toDouble(),
height: Double = rect_h.toDouble(), height: Double = h.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1 winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) = render(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding) ) = render(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
@ -86,8 +86,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Float = 0f, x: Float = 0f,
y: Float = 0f, y: Float = 0f,
width: Float = rect_w, width: Float = w,
height: Float = rect_h, height: Float = h,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1 winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) { ) {
RenderSystem.setShaderTexture(0, texture) RenderSystem.setShaderTexture(0, texture)
@ -102,8 +102,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Double, x: Double,
y: Double = 0.0, y: Double = 0.0,
width: Double = rect_w.toDouble(), width: Double = w.toDouble(),
height: Double = rect_h.toDouble(), height: Double = h.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1 winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) = renderPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding) ) = renderPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
@ -112,7 +112,7 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Float = 0f, x: Float = 0f,
y: Float = 0f, y: Float = 0f,
width: Float = rect_w, width: Float = w,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1, winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1,
) { ) {
render(stack, x, y, width = width, winding = winding) render(stack, x, y, width = width, winding = winding)
@ -123,7 +123,7 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Double, x: Double,
y: Double = 0.0, y: Double = 0.0,
width: Double = rect_w.toDouble(), width: Double = w.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1, winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1,
) = renderW(stack, x.toFloat(), y.toFloat(), width.toFloat(), winding) ) = renderW(stack, x.toFloat(), y.toFloat(), width.toFloat(), winding)
@ -132,7 +132,7 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Float = 0f, x: Float = 0f,
y: Float = 0f, y: Float = 0f,
height: Float = rect_h, height: Float = h,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1, winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1,
) { ) {
render(stack, x, y, height = height, winding = winding) render(stack, x, y, height = height, winding = winding)
@ -143,24 +143,24 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Double, x: Double,
y: Double = 0.0, y: Double = 0.0,
height: Double = rect_h.toDouble(), height: Double = h.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1, winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1,
) = renderH(stack, x.toFloat(), y.toFloat(), height.toFloat(), winding) ) = renderH(stack, x.toFloat(), y.toFloat(), height.toFloat(), winding)
private val u0 = this.x / imageWidth
private val v0 = this.y / imageHeight
private val u1 = (this.x + w) / imageWidth
private val v1 = (this.y + h) / imageHeight
@JvmOverloads @JvmOverloads
fun renderRaw( fun renderRaw(
stack: PoseStack, stack: PoseStack,
x: Float = 0f, x: Float = 0f,
y: Float = 0f, y: Float = 0f,
width: Float = rect_w, width: Float = w,
height: Float = rect_h, height: Float = h,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1 winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) { ) {
val u0 = image_x / defined_width
val v0 = image_y / defined_height
val u1 = (image_x + rect_w) / defined_width
val v1 = (image_y + rect_h) / defined_height
val winded = winding.translate(u0, v0, u1, v1) val winded = winding.translate(u0, v0, u1, v1)
RenderHelper.drawTexturedRectUV( RenderHelper.drawTexturedRectUV(
@ -181,8 +181,8 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Double, x: Double,
y: Double = 0.0, y: Double = 0.0,
width: Double = rect_w.toDouble(), width: Double = w.toDouble(),
height: Double = rect_h.toDouble(), height: Double = h.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1 winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) = renderRaw(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding) ) = renderRaw(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
@ -191,14 +191,12 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Float = 0f, x: Float = 0f,
y: Float = 0f, y: Float = 0f,
width: Float = rect_w, width: Float = w,
height: Float = rect_h, height: Float = h,
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1 winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) { ) {
val u0 = image_x / defined_width val u1 = (this.x + width) / imageWidth
val v0 = image_y / defined_height val v1 = (this.y + height) / imageHeight
val u1 = (image_x + width) / defined_width
val v1 = (image_y + height) / defined_height
val winded = winding.translate(u0, v0, u1, v1) val winded = winding.translate(u0, v0, u1, v1)
@ -220,27 +218,27 @@ class SkinElement @JvmOverloads constructor(
stack: PoseStack, stack: PoseStack,
x: Double, x: Double,
y: Double = 0.0, y: Double = 0.0,
width: Double = rect_w.toDouble(), width: Double = w.toDouble(),
height: Double = rect_h.toDouble(), height: Double = h.toDouble(),
winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1 winding: UVWindingOrder = UVWindingOrder.U0_V0_U1_V1
) = renderRawPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding) ) = renderRawPartial(stack, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), winding)
} }
val top_left_window_corner = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 0f, rect_w = 6f, rect_h = 6f) val top_left_window_corner = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 0f, w = 6f, h = 6f)
val top_right_window_corner = SkinElement(RenderHelper.WIDGETS, image_x = 24f, image_y = 0f, rect_w = 6f, rect_h = 6f) val top_right_window_corner = SkinElement(RenderHelper.WIDGETS, x = 24f, y = 0f, w = 6f, h = 6f)
val left_window_border = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 4f, rect_w = 3f, rect_h = 5f) val left_window_border = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 4f, w = 3f, h = 5f)
val right_window_border = SkinElement(RenderHelper.WIDGETS, image_x = 27f, image_y = 3f, rect_w = 3f, rect_h = 5f) val right_window_border = SkinElement(RenderHelper.WIDGETS, x = 27f, y = 3f, w = 3f, h = 5f)
val top_window_border = SkinElement(RenderHelper.WIDGETS, image_x = 22f, image_y = 0f, rect_w = 5f, rect_h = 3f) val top_window_border = SkinElement(RenderHelper.WIDGETS, x = 22f, y = 0f, w = 5f, h = 3f)
val window_background = SkinElement(RenderHelper.WIDGETS, image_x = 30f, image_y = 12f, rect_w = 6f, rect_h = 6f) val window_background = SkinElement(RenderHelper.WIDGETS, x = 30f, y = 12f, w = 6f, h = 6f)
val scroll_bar_top = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 57f, rect_w = 14f, rect_h = 2f) val scroll_bar_top = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 57f, w = 14f, h = 2f)
val scroll_bar_bottom = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 63f, rect_w = 14f, rect_h = 2f) val scroll_bar_bottom = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 63f, w = 14f, h = 2f)
val scroll_bar_body = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 58f, rect_w = 14f, rect_h = 6f) val scroll_bar_body = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 58f, w = 14f, h = 6f)
val scroll_bar_button = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 12f, rect_w = 12f, rect_h = 15f) val scroll_bar_button = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 12f, w = 12f, h = 15f)
val scroll_bar_button_hover = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 27f, rect_w = 12f, rect_h = 15f) val scroll_bar_button_hover = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 27f, w = 12f, h = 15f)
val scroll_bar_button_press = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 42f, rect_w = 12f, rect_h = 15f) val scroll_bar_button_press = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 42f, w = 12f, h = 15f)
val tab_right_connection = SkinElement(RenderHelper.WIDGETS, image_x = 30f, image_y = 0f, rect_w = 3f, rect_h = 5f) val tab_right_connection = SkinElement(RenderHelper.WIDGETS, x = 30f, y = 0f, w = 3f, h = 5f)
val tab_left_connection = SkinElement(RenderHelper.WIDGETS, image_x = 33f, image_y = 0f, rect_w = 3f, rect_h = 5f) val tab_left_connection = SkinElement(RenderHelper.WIDGETS, x = 33f, y = 0f, w = 3f, h = 5f)
val tab_background = SkinElement(RenderHelper.WIDGETS, image_x = 30f, image_y = 6f, rect_w = 6f, rect_h = 6f) val tab_background = SkinElement(RenderHelper.WIDGETS, x = 30f, y = 6f, w = 6f, h = 6f)
val bottom_left_window_corner = SkinElement(RenderHelper.WIDGETS, image_x = 18f, image_y = 6f, rect_w = 6f, rect_h = 6f) val bottom_left_window_corner = SkinElement(RenderHelper.WIDGETS, x = 18f, y = 6f, w = 6f, h = 6f)
val bottom_right_window_corner = SkinElement(RenderHelper.WIDGETS, image_x = 24f, image_y = 6f, rect_w = 6f, rect_h = 6f) val bottom_right_window_corner = SkinElement(RenderHelper.WIDGETS, x = 24f, y = 6f, w = 6f, h = 6f)
val bottom_window_border = SkinElement(RenderHelper.WIDGETS, image_x = 21f, image_y = 9f, rect_w = 5f, rect_h = 3f) val bottom_window_border = SkinElement(RenderHelper.WIDGETS, x = 21f, y = 9f, w = 5f, h = 3f)

View File

@ -42,18 +42,18 @@ open class CheckBoxPanel(
val CHECKBOX_UNCHECKED = SkinElement( val CHECKBOX_UNCHECKED = SkinElement(
RenderHelper.WIDGETS, RenderHelper.WIDGETS,
image_x = 18f, x = 18f,
image_y = 65f, y = 65f,
rect_w = REGULAR_DIMENSIONS, w = REGULAR_DIMENSIONS,
rect_h = REGULAR_DIMENSIONS, h = REGULAR_DIMENSIONS,
) )
val CHECKBOX_CHECKED = SkinElement( val CHECKBOX_CHECKED = SkinElement(
RenderHelper.WIDGETS, RenderHelper.WIDGETS,
image_x = 18f, x = 18f,
image_y = 80f, y = 80f,
rect_w = REGULAR_DIMENSIONS, w = REGULAR_DIMENSIONS,
rect_h = REGULAR_DIMENSIONS, h = REGULAR_DIMENSIONS,
) )
} }
} }

View File

@ -87,20 +87,20 @@ open class FramePanel(
top_window_border.renderW(stack, 3f, 0f, width - 6) top_window_border.renderW(stack, 3f, 0f, width - 6)
left_window_border.renderH(stack, 0f, 3f, (height - if (isActive) if (initial) 2 else 4 else 3)) left_window_border.renderH(stack, 0f, 3f, (height - if (isActive) if (initial) 2 else 4 else 3))
right_window_border.renderH(stack, width - right_window_border.rect_w, 3f, (height - if (isActive) 4 else 3)) right_window_border.renderH(stack, width - right_window_border.w, 3f, (height - if (isActive) 4 else 3))
top_left_window_corner.render(stack, 0f, 0f) top_left_window_corner.render(stack, 0f, 0f)
top_right_window_corner.render(stack, width - top_right_window_corner.rect_w, 0f) top_right_window_corner.render(stack, width - top_right_window_corner.w, 0f)
if (isActive) { if (isActive) {
if (!initial) { if (!initial) {
tab_left_connection.render(stack, 0f, height - tab_left_connection.rect_h - 1) tab_left_connection.render(stack, 0f, height - tab_left_connection.h - 1)
} }
tab_right_connection.render( tab_right_connection.render(
stack, stack,
width - tab_right_connection.rect_w, width - tab_right_connection.w,
height - tab_left_connection.rect_h - 1 height - tab_left_connection.h - 1
) )
} }
} }

View File

@ -20,7 +20,7 @@ open class PowerGaugePanel @JvmOverloads constructor(
val widget: LevelGaugeWidget, val widget: LevelGaugeWidget,
x: Float = 0f, x: Float = 0f,
y: Float = 0f y: Float = 0f
): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.rect_w, height = GAUGE_BACKGROUND.rect_h) { ): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
init { init {
scissor = true scissor = true
} }
@ -48,8 +48,8 @@ open class PowerGaugePanel @JvmOverloads constructor(
} }
companion object { companion object {
val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 0f, image_y = 48f, rect_w = 9f, rect_h = 48f) val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, x = 0f, y = 48f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 9f, image_y = 48f, rect_w = 9f, rect_h = 48f) val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, x = 9f, y = 48f, w = 9f, h = 48f)
} }
} }
@ -59,7 +59,7 @@ open class MatterGaugePanel @JvmOverloads constructor(
val widget: LevelGaugeWidget, val widget: LevelGaugeWidget,
x: Float = 0f, x: Float = 0f,
y: Float = 0f y: Float = 0f
): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.rect_w, height = GAUGE_BACKGROUND.rect_h) { ): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
init { init {
scissor = true scissor = true
} }
@ -87,8 +87,8 @@ open class MatterGaugePanel @JvmOverloads constructor(
} }
companion object { companion object {
val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 0f, image_y = 0f, rect_w = 9f, rect_h = 48f) val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, x = 0f, y = 0f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 9f, image_y = 0f, rect_w = 9f, rect_h = 48f) val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, x = 9f, y = 0f, w = 9f, h = 48f)
} }
} }
@ -98,7 +98,7 @@ open class PatternGaugePanel @JvmOverloads constructor(
val widget: LevelGaugeWidget, val widget: LevelGaugeWidget,
x: Float = 0f, x: Float = 0f,
y: Float = 0f y: Float = 0f
): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.rect_w, height = GAUGE_BACKGROUND.rect_h) { ): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
init { init {
scissor = true scissor = true
} }
@ -126,8 +126,8 @@ open class PatternGaugePanel @JvmOverloads constructor(
} }
companion object { companion object {
val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 0f, image_y = 148f, rect_w = 9f, rect_h = 48f) val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, x = 0f, y = 148f, w = 9f, h = 48f)
val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 9f, image_y = 148f, rect_w = 9f, rect_h = 48f) val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, x = 9f, y = 148f, w = 9f, h = 48f)
} }
} }
@ -137,7 +137,7 @@ open class ProgressGaugePanel @JvmOverloads constructor(
val widget: ProgressGaugeWidget, val widget: ProgressGaugeWidget,
x: Float = 0f, x: Float = 0f,
y: Float = 0f y: Float = 0f
): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.rect_w, height = GAUGE_BACKGROUND.rect_h) { ): EditablePanel(screen, parent, x, y, width = GAUGE_BACKGROUND.w, height = GAUGE_BACKGROUND.h) {
init { init {
scissor = true scissor = true
} }
@ -197,7 +197,7 @@ open class ProgressGaugePanel @JvmOverloads constructor(
} }
companion object { companion object {
val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 0f, image_y = 132f, rect_w = 22f, rect_h = 16f) val GAUGE_BACKGROUND = SkinElement(RenderHelper.WIDGETS, x = 0f, y = 132f, w = 22f, h = 16f)
val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, image_x = 22f, image_y = 132f, rect_w = 22f, rect_h = 16f) val GAUGE_FOREGROUND = SkinElement(RenderHelper.WIDGETS, x = 22f, y = 132f, w = 22f, h = 16f)
} }
} }