Skip to content

Commit

Permalink
Migrate to new PolyUI version
Browse files Browse the repository at this point in the history
  • Loading branch information
Deftu committed Oct 13, 2024
1 parent c4571bc commit bd30384
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions src/main/kotlin/org/polyfrost/crashpatch/gui/CrashGuiRewrite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ import net.minecraft.crash.CrashReport
import org.polyfrost.crashpatch.crashes.CrashHelper
import org.polyfrost.crashpatch.crashes.CrashScan
import org.polyfrost.crashpatch.hooks.CrashReportHook
import org.polyfrost.oneconfig.api.ui.v1.PolyUIBuilder
import org.polyfrost.oneconfig.api.ui.v1.OCPolyUIBuilder
import org.polyfrost.oneconfig.api.ui.v1.UIManager
import org.polyfrost.polyui.PolyUI
import org.polyfrost.polyui.component.impl.Block
import org.polyfrost.polyui.color.rgba
import org.polyfrost.polyui.component.extensions.named
import org.polyfrost.polyui.component.extensions.padded
import org.polyfrost.polyui.component.extensions.setPalette
import org.polyfrost.polyui.component.impl.Group
import org.polyfrost.polyui.component.impl.Image
import org.polyfrost.polyui.component.impl.Text
import org.polyfrost.polyui.component.named
import org.polyfrost.polyui.component.padded
import org.polyfrost.polyui.component.setPalette
import org.polyfrost.polyui.unit.Align
import org.polyfrost.polyui.unit.Vec2
import org.polyfrost.polyui.utils.image
import org.polyfrost.polyui.utils.rgba
import java.io.File
import java.util.function.Consumer

Expand Down Expand Up @@ -58,13 +57,17 @@ class CrashGuiRewrite @JvmOverloads constructor(
}

fun create(): GuiScreen {
val builder = PolyUIBuilder.builder().blurs().backgroundColor(rgba(21, 21, 21)).atResolution(1920f, 1080f).size(650f, 600f)
val builder = OCPolyUIBuilder.create()
.atResolution(1920f, 1080f)
.blurs()
.backgroundColor(rgba(21, 21, 21))
.size(650f, 600f)

val onClose: Consumer<PolyUI> = Consumer { _: PolyUI ->
leaveWorldCrash = false
}

builder.onClose(onClose)
// builder.onClose(onClose)

val polyUI = builder.make(
Group(
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/org/polyfrost/crashpatch/gui/constants.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.polyfrost.crashpatch.gui

import org.polyfrost.polyui.utils.rgba
import org.polyfrost.polyui.color.rgba

internal val GRAY_800 = rgba(21, 22, 23, 1f) // general background
internal val GRAY_700 = rgba(34, 35, 38, 1f) // log background
Expand Down

0 comments on commit bd30384

Please sign in to comment.