by smoldesu · 5y ago · 0 comments
With that being said, I have written a few GTK+ applets in Rust, and I gotta say that it's not as bad as it sounds or looks. The current GTK crate supports Glade, meaning that you don't have to actually write your frontend in Rust, rather building it in a different program, exporting it as glorified XML and binding the intractables to different buttons and fields. A hello world-styled GTK demo is only a few lines, and of course you get a wickedly performant binary out of the process too (mine used 4mb of memory, which could have been further optimized).
I wouldn't be surprised if you could/had to do something similar to this sprite handling example[1], where instead of updating the sprite's location you update widgets' attributes. This would be a "manual" process, but it should work (if repainting widgets is fast enough).
[1]: https://github.com/steshaw/gtk-examples/blob/master/ch13.spr...
For everything else, you'd probably need to use some bespoke activators to achieve the effect you want. Not terribly hard to spin up, but it's definitely less simple than languages designed for frontend development.
I... don't understand what this means.
Let's say in GTK/Glade I want a Button that when you click on it, it moves from the bottom-left corner to the top-right corner. How do I archive this in that GUI builder or even with the XML spec?
C# is much higher level and ergonomic to use for this, the tooling alone is lightyears ahead for the job - compile times/debugging for GUI iteration alone.
I can understand using rust for front-end to slap some simple gui on top of some complex lib and allows a lot of reuse (although I would still prefer GUI using rust through an interface from higher level like FFI/IPC).