9 ms·
Egui – An immediate mode GUI written in Rust
- classified 2y agoSafari on iOS only shows an empty page. Is this one of those Chrome-only sites?
- eminence32 2y agoDemo pages like this are fun, and technically impressive when compiled to a browser environment. But I suffer from a lack of imagination so these widget demos don't really help me envision what an egui-powered app can do or might look like. Does anyone have any examples of fun things that use egui?
- forrestthewoods 2y agohttps://rerun.io/ https://rerun.io/
- Animats 2y agoI 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.
- nottorp 2y ago> 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.
- fsloth 2y agoIf 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?
- unclad5968 2y agoWell I guess your book needs a new edition. The type of gui you're referencing is typically referred to as a retained mode gui.
- nottorp 2y agoThe 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.
- do_not_redeem 2y agoJust 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.
- nottorp 2y agoThe poster above me explained to me that it's not like that?
- kelvinjps10 2y agohttps://rerun.io https://rerun.io the one that sponsors them and the author's app is one example
- whytevuhuni 2y agoIt's really good for scrappy prototypes, e.g. here's a water simulation demo I was using to learn Rust [1]. See the "view" menu for more windows. The code for that is all contained in a single file [2], and IMO it's pretty small for what it does. It was really easy to add/change things while developing, a new button is just a single new line. [1] https://andreivasiliu.github.io/cybersub/ https://andreivasiliu.github.io/cybersub/ [2] https://github.com/andreivasiliu/cybersub/blob/master/src/ui.rs https://github.com/andreivasiliu/cybersub/blob/master/src/ui...
- konart 2y agoPhoto editors, CADs etc. I mean... pretty much anything you have on desktop but in your browser.
- AgentK20 2y agoThe Bevy Engine in Rust has an integration (https://docs.rs/bevy_egui/latest/bevy_egui/ https://docs.rs/bevy_egui/latest/bevy_egui/) that supports egui, for use in making UIs in games written against the Bevy Engine. Here's a webapp example of a 2d drawing showcase that uses egui as a UI provider: https://vladbat00.github.io/bevy_egui_web_showcase/index.html https://vladbat00.github.io/bevy_egui_web_showcase/index.htm...
- liambigelow 2y ago[https://truncate.town/](https://truncate.town/) https://truncate.town/](https://truncate.town/) is all egui (after the main menu)
- mdaniel 2y agoWords fail me how much I love that game Words similarly fail me how much I loathe and detest its GUI (at least on mobile browsers, where I often play the game). As an example, one has to actually _close_ the dictionary popup if you fat finger a letter because the fucking backspace doesn't work, or rather seems to require an incomprehensible number of presses to start deleting letters
- Broussebar 2y agoI find it really practical to create a quick ui. For example i used to do glitch art with a friend that didn’t know how to use a cli, so i created a gui for him to use [0]. Egui is perfect for this use case, you create quickly lightweights softwares, than can be compiled to many different OS. [0] https://glitchedfactory.com https://glitchedfactory.com
- selfmodruntime 2y agoI use egui to draw the overlay UI for game hacks I write. It's easy to use.
- the__alchemist 2y agoHere's my plasmid editor, using EGUI: https://github.com/David-OConnor/plascad https://github.com/David-OConnor/plascad I also use it for the GUI for 3D rendering computational chemistry and gravity sims. I also use it for configuring embedded devices on PC, and/or viewing their telemetry. (e.g. for drones, drone parts etc)
- Tycho87 2y agohttps://rerun.io/viewer https://rerun.io/viewer
- ivanjermakov 2y agoDrag values are amazing to use on mobile! Great demo, combines feature showcase and a great starter template.
- auc 2y agoInsanely snappy on mobile, very cool
- imcritic 2y agoOn mobile I get > An error occurred during loading: > ReferenceError: WebAssembly is not defined > Make sure you use a modern browser with WebGL and WASM enabled.
- flohofwoe 2y agoWebAssembly isn't even a modern feature anymore, even iOS Safari (which traditionally drags its feet when it comes to web standard support) has WASM support since around 2017.
- andsoitis 2y agoLimited internationalization support. For example, trying to paste in مرحبًا (Arabic for "hello") just gives me tofu squares.
- avx56 2y agoIt's being worked on. Merry Christmas! https://github.com/emilk/egui/issues/3378 https://github.com/emilk/egui/issues/3378
- andsoitis 2y agoText shaping is anything but easy. Harfbuzz is probably the state of the art open source solution - https://github.com/harfbuzz/harfbuzz https://github.com/harfbuzz/harfbuzz Used in in Android, Chrome, ChromeOS, Firefox, GNOME, GTK+, KDE, Qt, LibreOffice, OpenJDK, XeTeX, PlayStation, Microsoft Edge, Adobe Photoshop, Illustrator, InDesign, Godot Engine, Unreal Engine, ...
- xobs 2y agoI thought Photoshop, Illustrator, and InDesign were very good at producing https://notarabic.com/ https://notarabic.com/ (at least the author calls out Adobe products in the description)
- 0points 2y agoFor egui, it will be rustybuzz, which is used directly by cosmic-text https://github.com/harfbuzz/rustybuzz https://github.com/harfbuzz/rustybuzz https://github.com/pop-os/cosmic-text https://github.com/pop-os/cosmic-text
- andsoitis 2y agoRecent discussion: https://news.ycombinator.com/item?id=39837045 https://news.ycombinator.com/item?id=39837045 Further back in time: https://news.ycombinator.com/item?id=28166663 https://news.ycombinator.com/item?id=28166663
- coolgoose 2y agoAm I the only one that has a problem with all non dom/html renderers that I can't copy the text on mobile? The same with flutter etc, it's such a regression in my eyes but nobody prioritizes it.
- watermelon0 2y agoThere are websites that disable copying, so I assume some would consider this a feature. :/
- IshKebab 2y agoYou generally can't copy text in native UIs unless the app author goes to extra effort to allow it. It's really the web that is the odd one out here because it was originally intended for documents.
- gf000 2y agoIt also means worse accessibility, less introspection, automation, worse/impossible adblocking, etc.
- vbezhenar 2y ago> worse/impossible adblocking Obviously that's not a downside from a software developer perspective.
- robin_reala 2y agoI’m a software developer, and it seems like a positive to me? Why wouldn’t you want the ability to post-facto manipulate with script the interfaces you are presented with?
- ncruces 2y agoAs long as someone else is paying the bills.
- therein 2y agoI have things I use every day that I wrote in egui. It has its quirks but has been great for years. Thanks emilk.
- delifue 2y agoA common problem of immediate mode GUI is how to make the parent component's size dynamically determined by child component's content (2-phase dynamic layout). Does Egui solve this issue?
- jgoertler 2y agoYou can instruct egui to discard a frame. That way you can perform this two phase layout across two frames without showing an unfinished UI. This mechanism can get you there most of the time.
- chrismorgan 2y agoTake the Code Example demo initially opened: drag age up to 120, then press the Increment button, and watch the label “Arthur is 120” briefly blip to “Arthur is 121” (while the DragValue still shows 120!) before being dragged back down to 120 presumably by rerendering and egui::DragValue::new(age).range(0..=120) clamping it. That’s… eww. It probably doesn’t often cause real problems—though it surely could, as it’s allowing temporary rendering with out-of-bounds values that a developer might have expected to be clamped—but it’s still very eww, the idea that mutating data leads to parts of a frame being rendered with different data.
- jgoertler 2y agoI’m currently on mobile, where I couldn’t reproduce this. I agree, that shouldn’t happen and it might be a bug, because the input is handled after drawing the initial frame and should be clamped before starting to draw the next frame. Drag events are tricky though, because they come with a frame delay by default (you have to recognize the drag). Does this reproduce reliably on desktop? If so then I can create an issue for this.
- Thorrez 2y agoThere seem to be some problems with resizing windows. In the "Highlighting" example, half the time when I click the grab area in the bottom right corner, my diagonal arrow mouse immediately switches to a vertical arrow mouse, so I can only resize vertically (which fails, see next point). In the "Highlighting" example, it acts like it can resize vertically (vertical arrow mouse appears), but it won't actually let me resize it vertically. In the other default examples, there's a grab area in the bottom right corner that makes me think I should be able to resize it both vertically and horizontally at the same time. But none of them let me resize them vertically.
- arcmechanica 2y agoIs it common for rust to use serbian domains?
- imcritic 2y agoYes.
- arcmechanica 2y agoSeems like a recipe for supply chain attacks
- 0points 2y agoWith Serbia being run by the mafia and all, or?
- deleted 2y ago[deleted]
- butz 2y agoLooks impressive, especially considering how fast is loads. One nitpick of my is the blurry font rendering. I suppose getting sharp and clear fonts is quite complicated task.
- swiftcoder 2y agoThe font rendering looks about right on Safari. Is it blurry, or is it just doing Mac-style antialiasing?
- epcoa 2y agoIt probably looks ok on HiDPI, unfortunately a lot of these hipster tools not supporting legacy but well trodden text rendering implementations are LoDPI unfriendly. https://github.com/zed-industries/zed/issues/7992 https://github.com/zed-industries/zed/issues/7992
- gf000 2y agoI have just used it yesterday to better understand a math problem and found that the edit-compile-run cycle of rust with this framework was prohibitively long. I only had a single file calling into this lib - maybe I could have improved on it with splitting the project up to some modules? Could anyone comment on their experience? Because usually I have found rust compile times okay, but this really made it hard to iterate.
- ramon156 2y agoModules wouldn't fix this afaik. I feel like hot-reloading would be the fix here, but I'm unsure what the state on that is.
- vacuity 2y agoIn Rust, crates and not modules are the unit of compilation. Hot reloading is a whole other problem for the Rust ecosystem. You'd probably have to build it yourself or buy into a whole engine.
- generalenvelope 2y agoWhat linker are you using? I've gotten really significant speedup over the default linker by using lld or mold.
- deleted 2y ago[deleted]
- bmacho 2y agoI was unable to find a global font-size option, isn't there any? I can modify the fonts individually, but that's not what I want. I also wish for a global contrast option (preferably where the day/night toggle is). The default night theme is too low contrast for me right now, coming from a brightness that is perfect for HN.
- sndwnm 2y agohttps://docs.rs/egui/latest/egui/struct.Context.html#method.set_pixels_per_point https://docs.rs/egui/latest/egui/struct.Context.html#method.... Maybe you want to scale all the UI elements? This has the same zooming effect as pressing Ctrl-+. Otherwise why not loop and set all the font sizes you want? https://docs.rs/egui/latest/egui/style/struct.Visuals.html https://docs.rs/egui/latest/egui/style/struct.Visuals.html I don't recall there being a high contrast option or slider, so your best bet might be trying to modify the values in this struct, or if that's not enough, then the values in the `widgets` field of it. You can customize every color in the UI.
- NoZZz 2y agoLooks awesome !
- feverzsj 2y agoFor serious use, they need a WYSIWYG designer. Otherwise, the iteration will be slow and painful.
- Afoot9003 2y agoHungry ghost gui
- mhitza 2y ago> panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glow-0.16.0/src/web_sys.rs:282:78: called `Option::unwrap()` on a `None` value Someone's been naughty for Christmas, forcing option unwrapping instead of pattern matching. On the mobile version of Brave.
- wyager 2y agoAt the very least, one should use `expect` over `unwrap` so the error is useful.
- josephcsible 2y agoI just opened https://github.com/grovesNL/glow/pull/331 https://github.com/grovesNL/glow/pull/331 to do exactly that.
- Aissen 2y agoI'm afraid that until browsers provide APIs to help render fonts with sub-pixel rendering (note: that would add fingerprinting bits), canvas-based UI rendering libraries will always have a big disadvantage (vs DOM-based) on all but the high pixel density devices. (This is well known by the egui authors, which is a great library!)
- IshKebab 2y agoI'm not sure. Phones and Macs are already all high density enough. Apparently it's been removed on Mac. Probably not too long before even cheap windows laptops and Chromebooks have hidpi screens. Plus modern displays can have all sorts of weird subpixel layouts so it's not as simple as it used to be.
- feverzsj 2y agoEven if you are using Retina 5k 27", the subpixel rendering is still necessary to get sharper fonts.
- MindSpunk 2y agoApple dropped support for sub pixel rendering in MacOS years ago.
- Aissen 2y agoYou tend to use the web platform for maximum portability, even for people not having high-end devices. If you only need to target people with a higher-density screen, then of course my comment is moot. I posit that it will still be a problem for large enough number of people, for a long time.
- 7jjjjjjj 2y agoHidpi monitors about about twice as expensive, and the only real advantage is that they look nicer. Maybe on a laptop that's a good use of $$$, especially if the screen is very small, but on desktop you'd almost always rather get a bigger monitor or a second monitor. So low DPI will be with us for a long time.
- mpweiher 2y agoHow is this "immediate mode"? I see widgets that are added to a UI using .add() "You should put this widget in a ui with `ui.add(widget);" https://github.com/emilk/egui/blob/master/crates/egui/src/widgets/image.rs https://github.com/emilk/egui/blob/master/crates/egui/src/wi... There appears to be a fluent builder API for these widgets. Is that what makes it "immediate mode"?
- terhechte 2y agoThe logic is called every frame
- fastball 2y agoThey go into a good amount of detail[1] as to what they mean by "immediate mode" (this is linked from one of the windows when you open the page). [1] https://github.com/emilk/egui#why-immediate-mode https://github.com/emilk/egui#why-immediate-mode
- artemonster 2y agoCan you debug it in browser?
- zelphirkalt 2y ago[flagged]
- alpinisme 2y agoThe linked page is a demo, not documentation, fwiw. And the framework is for canvas-rendered apps so they will never work as static sites.
- deleted 2y ago[deleted]
- the__alchemist 2y agoEGUI owns. It's my go-to for writing GUI PC programs.
- deleted 2y ago[deleted]
- imranhou 2y agoHow do you debug these interfaces in a web browser, as can be done in javascript or even c++ web assembly for that matter(https://chromewebstore.google.com/detail/cc++-devtools-support-dwa/pdcpmagijalfljmkmjngeonclgbbannb https://chromewebstore.google.com/detail/cc++-devtools-suppo...)?
- NoboruWataya 2y agoI've been using this a bit lately. It's very easy to throw a basic working prototype together and doesn't require that much boilerplate in order to get widgets on a screen, which is great. On the other hand layout management is a bit of a pain and there is apparently no easy way to say, for example, "these three widgets should take up 60%, 25% and 15% of the available horizontal space, respectively". I think that is just a consequence of being immediate mode.
- joz1-k 2y agoThis looks really cool. Unfortunately, a sample demo UI page is using 2 cores of my CPU at 100% all the time just by doing nothing. I suppose there are many optimization tricks that can be applied to bring this down significantly.
- sillyboi 2y agoCool, but the input response is super slow. Like, when I’m typing fast on my phone (yeah, I’m that crazy Gen-Z who types a thousand words per minute on mobile), it just can’t keep up. Instead of ‘This is a test,’ I got ‘his i aes.’ It’s probably an architectural bottleneck that’s hard to fix. Also, I noticed you can’t select and copy text, which is a major headache for custom GUI implementation. Happy holidays and good vibes to everyone!
- drawfloat 2y agoEgui is great for quickly getting prototypes or GUIs that don't need to be visually impressive up and running. As soon as you start hoping to get pixel perfect/complex designs in place, though, it hits a wall.