I think this paragraph was my real BING moment! "...
# compose-desktop
k
I think this paragraph was my real BING moment! "In Compose's declarative approach, widgets are relatively stateless and do not expose setter or getter functions. In fact, widgets are not exposed as objects. You update the UI by calling the same composable function with different arguments. This makes it easy to provide state to architectural patterns such as a 
ViewModel
, as described in the Guide to app architecture. Then, your composables are responsible for transforming the current application state into a UI every time the observable data updates." And again here further down: "Recomposition: In an imperative UI model, to change a widget, you call a setter on the widget to change its internal state. In Compose, you call the composable function again with new data. Doing so causes the function to be recomposed--the widgets emitted by the function are redrawn, if necessary, with new data. The Compose framework can intelligently recompose only the components that changed." I'm only an amateur, but I'm loving this a lot! 🤓
🦘 2
💡 2
👏 3
🥳 3
K 2
🚂 2
@darkmoon_uk Aussies & trains and Bing Moments FTW!
🎉 2
d
Always good to read when someone's having fun! Yeah those descriptions get to the nub of it... mutate the
State
concept offered by Compose and it'll take care of recomposing the parts of your UI needed.
👍
k
I'm chasing up info on Canvas to see if that will be the best root for my layout drawing interactive display on the screen.
d
Aallright, it's getting interesting now...
k
I need some sort of graphics area to pop the components as I create them.
d
I've had limited exposure to Canvas, but yes it's a good option for drawing custom graphics.
My only reservation would be how much detail do you want to draw and what's the resulting performance going to be like?
k
Yes! I've got my app templates sorted now, and branches in GitHub for dev-ing, so just got to get some nuts and bolts on the table.
d
It might be great, but I'm not sure how optimised that area of Compose it.
I've used it to draw a graph before.
In a real commercial App.
k
OK. 2D polylines to start with, and hoping to be able to move to displaying it in a 3D environment. Or start with that if easy enough!
OK.
d
And the experience was good; it just wasn't the centrepiece of the whole App with a load of detail.
I would certainly give it a go and see how far it gets you.
If it starts to fall short you could consider wrapping a Kotlin game engine in your main viewport.
k
I expect I'll be adding track components as nodes in a Scene Graph, seems to be the best start.
Oh OK!!
That sounds cool......
d
Or, if the experience you're thinking of lends itself well to tiles, then you could consider SVG tiles.
👍🏻 1
👍 2
k
Actually, that was sort of the thought I had with the WebGL bizzo. Yes, had considered SVG as an item to display, and building it with the components.
👍 1
https://show.korge.org/#SimpleBox2dScene Yeah..... thanks for that..... I have to sleep sometime soon.... Well, I was going to... 🤩
😁 1