Hacker News new | ask | show | jobs
by emilk 814 days ago
egui author here! Fell free to shoot me any questions. You can try egui in your browser at https://www.egui.rs/

My company Rerun.io is entirely built on egui so that we get the same high-performance UI on the web as on native. Give it a spin at https://app.rerun.io/

4 comments

I have an app where some tasks can take a long time (like a minute in some cases), so I want the gui to continue responding, and also run my long task in a background thread, then update the GUI when it is finished.

Is there any good examples for this, the examples (not unreasonably), mostly seem to do fairly trivial work.

The http example at egui.rs uses the `poll_promise` crate to wait for a HTTP request: https://github.com/emilk/egui/blob/master/crates/egui_demo_a...
Thanks!
That’s the key; the thread showing the UI mustn’t do any real work. Instead do the work on another thread and then communicate the status back to the UI thread. Exactly how you do that is up to you; there are plenty of different ways to do it that depend on other choices you’ve made, such as whether you’re using async or not, what async runtime you use, etc, etc.

The very simplest way to do it might be for the UI thread to send the work thread an Arc<AtomicBool>. The work thread can set the bool to true when the work is finished. The UI thread can branch on the value of the bool each frame to decide what to draw. Job done.

I see that your app.rerun.io site don’t really do well on mobile devices, while the demos vary.

If I wanted to build a back office/admin site for an hobby project in egui, would it by default be hard to use on a phone?

It would mostly consist of tables and buttons for managing features, data fetched by websockets.

egui works well on mobile except for one thing: text editing.

For app.rerun.io we mostly need to work on making the app friendly for small screens.

Do you have a plan for improving the font rendering to have sub-pixel aliasing on the web? I saw some thoughts on that in some github issues, but I was wondering if there was a general plan.
I don't have a plan for that right now. I'm not even sure a web page can know what the RGB pattern of the display is so it can do proper sub-pixel anti-aliasing.

I'm sort of hoping high-dpi screens will make this a moot point very soon :)

It's not what I wanted to read, but thanks for the honest answer! I realize creating a new toolkit is a huge endeavor, and I hope you'll some point reconsider :-)
After a quick display the rerun page above just breaks Chrome for me - error code 11
Oh no! Any clues in the dev console?
Its working now but I changed places ... odd!