Hacker News new | ask | show | jobs
by Animats 547 days ago
I use it in Sharpview. It's really for GUI programs, not web pages. It redraws everything on every frame, so it's most useful for 2D overlays on 3D game-type programs. For that, it's pretty good.

It's one pass. As a result, layouts which are ordered left to right and top to bottom work well, but ones which displace or resize items above or to the left don't work well. Egui tries to fix things up on the next frame, thereby getting the effect of a multipass layout system, but sometimes that results in mis-positioning and jitter on alternate frames. As long as you respect that limitation, good results can be obtained.

It needs some kind of dialog builder tool so that you don't have to write code for each dialog box. Someone was working on that about two years ago. Should find that project again. Meanwhile, lots of repetitive code to write.

Note that winit, wgpu, egui, and their friends all have to advance in version lockstep. All those projects routinely make breaking API changes, and when this happens, it takes a month or two before all the others catch up. Again, as long as you know this, it's not too bad. It would be nice to see some of those packages reach version 1.0.

1 comments

> It redraws everything on every frame, so it's most useful for 2D overlays on 3D game-type programs.

So it's not a GUI. In my book a GUI only redraws when something changes, to save the user's power.

If it’s used as a game ui, games typically render everything at 60fps - so the energy cost from ui layer would be neglible.

Afaik nobody is forcing to rerender the ui layer if nothing changes, though. Just render it to a texture and compose … no need to put everything to the same render target?

Well I guess your book needs a new edition. The type of gui you're referencing is typically referred to as a retained mode gui.
The point is, I don't want people to see "GUI library" and think it's okay to use this for your random phase-of-the moon application that has no good reason to redraw at 2400 fps or whatever the enthusiasts want these days.
Just click on the link and you can easily see it only redraws when something on the screen changes. It's amazing how quickly people will dismiss something these days based on their own made up reasons.
The poster above me explained to me that it's not like that?
Click the link, open the backend tab, and look where it says "Only running UI code when there are animations or input."

Then you won't have to waste cycles deciding which random internet comment from a stranger to believe

It has this claim:

"egui is not a framework. egui is a library you call into, not an environment you program for."

So I suspect it gives you control on when to redraw and you might eg call it only when user input happens in your app or there's a some other state change that changes what is shown.