4 ms·
I investigated egui early this year. It's a very good library! For me, getting used to immediate mode UI was a change from being used to DOM / React-style UI. i
by paulshen 5y ago
I investigated egui early this year. It's a very good library! For me, getting used to immediate mode UI was a change from being used to DOM / React-style UI. imgui works well for a lot but it struggles with complex layouts, eg flexbox. This is acknowledged in egui's README
Couple things I built with egui:
https://artifacts.bypaulshen.com/rust-gui/code-render/ https://artifacts.bypaulshen.com/rust-gui/code-render/
https://artifacts.bypaulshen.com/rust-gui/tictactoe/ https://artifacts.bypaulshen.com/rust-gui/tictactoe/
- capableweb 5y agoCould you possible share the source to your two examples? I'd love to see how much is accidental complexity vs actual complexity, compared to how web UIs (and other similar paradigms) can be built almost in an almost fully declarative way.
- paulshen 5y agoHere's the main file of the tictactoe implementation. https://gist.github.com/paulshen/b04db68c754f73e693cd29a481c9ebea https://gist.github.com/paulshen/b04db68c754f73e693cd29a481c... `update` is similar to React's render function except here it's being called on every interaction (eg mousemove tick) and redrawing the entire screen from scratch! The code runs so fast that this is fine from a perf standpoint. Note that egui has a reactive or continuous mode. You can rerender everything from scratch 60fps (continuous mode) and it'd be fine in most cases.
- brundolf 5y agoPart of what makes the DOM slower by comparison is the fact that it supports such advanced, declarative, adaptive layouts. There's a tradeoff for having that vs not having that
- fluidcruft 5y agoTic-tac-toe is frustrating me because I can't seem to force it into a draw.
- volta83 5y agoI tried to make it win every time and I'm wondering whether given a Tic-tac-toe opponent that does random moves, it is always possible to play such that your opponent always wins.
- darepublic 5y agoNo such strategy could exist because if it did, if your opponent randomly implemented the same strategy then it would force itself to lose
- volta83 5y agoGood point! I guess the difference is whether it exists for the player that does the second move.
- deleted 5y ago[deleted]
- soheil 5y agoThe tic tac toe is easily defeated
- tasty_freeze 5y agoDid you read the text at the bottom of the page? Don't try too hard. The "AI" makes random moves.