net.peanuuutz.fork.ui.scene.screen.ComposeScreens.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fork-ui Show documentation
Show all versions of fork-ui Show documentation
Comprehensive API designed for Minecraft modders
The newest version!
package net.peanuuutz.fork.ui.scene.screen
import androidx.compose.runtime.Composable
import net.minecraft.text.Text
import net.peanuuutz.fork.ui.ui.draw.canvas.Canvas
import net.peanuuutz.fork.util.minecraft.client
inline fun openScreen(
title: Text = Text.empty(),
canvas: Canvas = ScreenCanvas(),
crossinline content: @Composable () -> Unit
) {
val screen = object : ComposeScreen(
parent = client.currentScreen,
title = title,
canvas = canvas
) {
@Composable
override fun Content() {
content()
}
}
client.setScreen(screen)
}