Skip to content

Latest commit

 

History

History
62 lines (51 loc) · 1.74 KB

HelloWorld.md

File metadata and controls

62 lines (51 loc) · 1.74 KB

Window - introduction

Note: Before starting with Aurora window APIs, make yourself comfortable with Desktop Compose window APIs.

At the most basic level, Desktop Compose application skeleton looks like this:

fun main() = application {
    Window(...) {
        // Content
    }
}

Aurora application skeleton looks like this:

fun main() = auroraApplication {
    AuroraWindow(...) {
        // Content
    }
}

Hello World in Aurora

fun main() = auroraApplication {
    val state = rememberWindowState(
        placement = WindowPlacement.Floating,
        position = WindowPosition.Aligned(Alignment.Center),
        size = DpSize(220.dp, 150.dp)
    )

    AuroraWindow(
        skin = marinerSkin(),
        title = "Aurora Demo",
        state = state,
        windowTitlePaneConfiguration = AuroraWindowTitlePaneConfigurations.AuroraPlain(),
        onCloseRequest = ::exitApplication
    ) {
        var text by remember { mutableStateOf("Hello, World!") }

        Row(
            horizontalArrangement = Arrangement.Center,
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier.fillMaxSize().auroraBackground()
        ) {
            CommandButtonProjection(
                contentModel = Command(
                    text = text,
                    action = { text = "Hello, Desktop!" }
                )
            ).project()
        }
    }
}

Continue reading about Aurora application and Aurora window APIs.