Hello! Can I use WindowState to set initial size o...
# compose-desktop
k
Hello! Can I use WindowState to set initial size of application window, or should I be using a different code now? Thanks.
👀 1
d
Hey @Kebbin, here's my Desktop App start code which features
Dp
Window sizing:
Copy code
fun main() = application {
    MainWindow(onCloseRequest = ::exitApplication)
}

@Composable
fun MainWindow(
    onCloseRequest: () -> Unit
) = Window(
    onCloseRequest = onCloseRequest,
    title = "<redacted>",
    state = WindowState(
        placement = WindowPlacement.Floating,
        size = DpSize(800.dp, 600.dp)
    ),
    resizable = true
) {
    MainView(viewModel = ViewModelModule.mainViewModel)
}
Possibly
DpSize
function is your only missing piece
k
Thank you so much mate! That's a great help. I'll try that tomo.... umm... later today! Cheers!
Also, have you used WebGL for anything?
d
No never touched it; sounds fun though 🙂
k
Yeah I thought so. There's an overlay twgl that simplifies it.
Your tip on Filament got me looking down that line.
d
I see this - have you found any examples built with it?
k
Oh! That looks interesting! Might be able to combine the two!
d
Not sure you'd need to this is already an official Kotlin wrapper for WebGL... if I were you I'd start with that and roll your own conveniences.
Eh, IDK, depends what's available in TWGL.
Well there are two interesting routes to explore anyway; maybe you could use both!
The rotating cubes background in the TWGL site is a positive sign 😆
k
Yeah, I meant Kotlin and WebGL! TWGL looked an easy way to use WebGL, but if it's already in Kotlin....
Yes, I think it was well done. Certainly deverbosificated it!
👍 1
I found an element array code sample that clicked with defining my layouts too...
Just can't see it now looking from my phone. It was an example function that defined an array and push(), peek(), and pop() sub functions. It showed how I can add items to a list that I can display on screen and serialise to a file. Just got to flesh it out from there I think.
<https://play.kotlinlang.org/byExample/01_introduction/06_Generics>
This was the code I got the brainwave from.