Fix frame and scrollbar rendering

This commit is contained in:
DBotThePony 2022-01-18 17:52:57 +07:00
parent f6da17c303
commit 20a705ad40
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 15 additions and 14 deletions

View File

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

View File

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