From 20a705ad40bf4e676ccebc926da0b39a6d34758c Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 18 Jan 2022 17:52:57 +0700 Subject: [PATCH] Fix frame and scrollbar rendering --- .../mc/otm/client/screen/panels/FramePanel.kt | 23 ++++++++++--------- .../client/screen/panels/ScrollBarPanel.kt | 6 ++--- 2 files changed, 15 insertions(+), 14 deletions(-) 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 2dbd826d2..67af68bcb 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 @@ -10,6 +10,7 @@ import net.minecraft.client.resources.sounds.SimpleSoundInstance import net.minecraft.network.chat.Component import net.minecraft.sounds.SoundEvents import org.lwjgl.opengl.GL11 +import org.lwjgl.opengl.GL30 import ru.dbotthepony.mc.otm.client.render.* import ru.dbotthepony.mc.otm.client.screen.MatteryScreen @@ -242,27 +243,27 @@ open class FramePanel( // background if (bgWidth > 0 && bgHeight > 0) { - window_background.render(stack, x + 3, y + 3, bgWidth, bgHeight) + window_background.render(stack, 3f, 3f, bgWidth, bgHeight) } // borders - left_window_border.render(stack, x, y + 4, 3f, height - 8) - right_window_border.renderRaw(stack, x + width - 3, y + 4, 3f, height - 6) - top_window_border.renderRaw(stack, x + 4, y, width - 8, 3f) - bottom_window_border.renderRaw(stack, x + 4, y + height - 3, width - 8, 3f) + left_window_border.render(stack, 0f, 4f, 3f, height - 8) + right_window_border.renderRaw(stack, width - 3, 4f, 3f, height - 6) + top_window_border.renderRaw(stack, 4f, 0f, width - 8, 3f) + bottom_window_border.renderRaw(stack, 4f, height - 3, width - 8, 3f) // corners - top_left_window_corner.renderRaw(stack, x, y, 6f, 6f) - top_right_window_corner.renderRaw(stack, x + width - 6, y, 6f, 6f) - bottom_left_window_corner.renderRaw(stack, x, y + height - 6, 6f, 6f) - bottom_right_window_corner.renderRaw(stack, x + width - 6, y + height - 6, 6f, 6f) + top_left_window_corner.renderRaw(stack, 0f, 0f, 6f, 6f) + top_right_window_corner.renderRaw(stack, width - 6, 0f, 6f, 6f) + bottom_left_window_corner.renderRaw(stack, 0f, height - 6, 6f, 6f) + bottom_right_window_corner.renderRaw(stack, width - 6, height - 6, 6f, 6f) // RenderSystem.enableDepthTest(); // title - RenderSystem.depthFunc(GL11.GL_ALWAYS) + RenderSystem.depthFunc(GL30.GL_ALWAYS) screen.font.draw(stack, title, 8f, 5f, 4210752) - RenderSystem.depthFunc(GL11.GL_ALWAYS) + RenderSystem.depthFunc(GL30.GL_ALWAYS) } override fun narrationPriority(): NarrationPriority { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ScrollBarPanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ScrollBarPanel.kt index 551cd7847..2a6298a66 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ScrollBarPanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/ScrollBarPanel.kt @@ -132,9 +132,9 @@ open class ScrollBarPanel(screen: MatteryScreen<*>, parent: EditablePanel?, x: F } override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) { - scroll_bar_body.render(stack, x, y + 2, 14f, height - 4) - scroll_bar_top.render(stack, x, y) - scroll_bar_bottom.render(stack, x, y + height - 2) + scroll_bar_body.render(stack, y = 2f, height = height - 4) + scroll_bar_top.render(stack) + scroll_bar_bottom.render(stack, y = height - 2) } companion object {