I'm building a solitaire game for fun in compose. ...
# compose
e
I'm building a solitaire game for fun in compose. Is it worth pursuing writing it using basic elements such as column etc. or is it better to have a custom layout for the entire game? The main challenge I see is dragging and dropping between columns, is that even possible?
🤘 1
b
https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-drag-drop.html#creating-a-drop-target i think it works from any composable to any other composable, regardless of hierarchy. i'd go for constraint-layout as the root composable, if you want to also have exigent control over game area resizes. and maybe LazyVerticalStaggeredGrid for the decks.
❤️ 1
cool idea 😄
e
Thanks for sharing! I think I used something similar for drag and drop. But I used the android specific version: https://developer.android.com/develop/ui/compose/touch-input/user-interactions/drag-and-drop I think with the api you did I could actually offset the composable. The Android API creates a canvas to draw into as the view being moved. Which works but is not exactly what I'd want. Yeah, it's a tricky idea as well since the data model is so dynamic. Right now I'm cheating and calling redraw when a move has been detected as opposed to letting the data do it, which is the proper way. One thing at a time 🙂
🙌 1