Giter Club home page Giter Club logo

Comments (11)

Woyten avatar Woyten commented on July 19, 2024

@x31eq Do you have an opinion which GUI framework to use? ATM Nannou is used but I could switch to another framework. Being undecided about the framework is the reason why GUI-heavy issues like #9 are blocked.

from tune.

x31eq avatar x31eq commented on July 19, 2024

I got the Druid example from here working the other day (with the code from the website — the repo isn't quite the same):

https://dev.to/davidedelpapa/rust-gui-introduction-a-k-a-the-state-of-rust-gui-libraries-as-of-january-2021-40gl#druid

I like it and they say it works with Wasm. I haven't tried it on Wasm. There are other things that mention it on that page, including the comments. I know no more

from tune.

x31eq avatar x31eq commented on July 19, 2024

Got the egui template working as well, native and Wasm.

https://github.com/emilk/egui

Looks interesting, but it's one of these GUIs that completely ignores native conventions: double-click select is idiosyncratic, copy/paste doesn't work. The native one does at least use the window manager's frame. Both binaries about 4MB (stripped).

from tune.

Woyten avatar Woyten commented on July 19, 2024

@x31eq Thanks for digging into this! My feelings about the different frameworks are the following:

  • egui: Seems to be the new kid on the block. It's difficult to tell whether it's a dayfly or not. I should definitively keep an eye on it since idiomatic GUI concepts are not a goal for me right now.
  • Druid: I have seen a lot of positive feedback about it. A big plus is that its showcase is a font renderer which means that it has primary support for custom graphics, e.g. a virtual keyboard. What troubles me a bit is that a related project is moving away from it to Iced.
  • Iced: Gave it a try. Worked smoothly and seems to be the most promising candidate for a cross-platform GUI app. The drawback for me was that it has no support for physical keyboard events yet.

I chose Nannou arbitrarily because it was presented at RustFest. Do you think there is a compelling reason to switch to one of the other frameworks?

from tune.

x31eq avatar x31eq commented on July 19, 2024

The compelling reason for me is that it'd work on my desktop! I skipped Iced because of the OpenGL requirement. If I build the hello world I get

thread 'main' panicked at '0:1(10): error: GLSL 3.30 is not supported. Supported
versions are: 1.10, 1.20, and 1.00 ES

GLSL is a mathematics library. I don't know why this requires an older version.

from tune.

Woyten avatar Woyten commented on July 19, 2024

From what I know GLSL is a shading language. But unlike Vulkan, GLSL should work on any system...strange...! 😆

from tune.

x31eq avatar x31eq commented on July 19, 2024

It isn't normal for Debian stable to provide a too recent library version. I expect this was a sign of the immature OpenGL support in Iced. The repo I pulled is pointing to a specific commit from last November. I can build the latest Iced library, I think there's some OpenGL support in there. I don't know how to specify it.

Wouldn't keyboard events come from a different library?

Harmoxen looks good. It works for me with Druid. The Iced branch builds against Vulkan.

Egui looks promising for what it is. That isn't something I have a use for. I think I'll write something in Druid and find out what problems it has. I see it lists as a non-goal "Support rendering to HTML when targeting the web." That suggests Iced will be better on the Wasm side

from tune.

Woyten avatar Woyten commented on July 19, 2024

Wouldn't keyboard events come from a different library?

I am not sure how that would integrate with the event loops provided by the frameworks. Besides that, is there any cross-platform library for keyboard events? The closest candidate that I can think of is winit.

I might give egui a try this weekend although from reading the docs I can tell that the keyboard event model is too restricted.

By the way, Bevy looks very promising but has no official support for WASM as far as I can tell.

So, at the moment it looks as if Druid has all the required features: WASM and physical keyboard events. But before completely switching to another framework I will request some feedback in the Rust Subreddit.

from tune.

Woyten avatar Woyten commented on July 19, 2024

Current progress: I gave winit a try (wasm-new branch). It has access to physical key locations i.e. scancodes but those scancodes are platform dependent (rust-windowing/winit#1806). Druid scancodes might be platform independent and the Reddit community recommends it (https://www.reddit.com/r/rust/comments/nl0d3b).

from tune.

Woyten avatar Woyten commented on July 19, 2024

So, it seems that Druid is the most promising candidate: It comes with multi-platform support and it's designed with complex graphics in mind. The keyboard model is the best I could find in any of the GUI frameworks but I don't know how well the model works in practice. The only downside of Druid that I know of is that rendering to VST hosts is not possible at the moment (Azorlogh/harmoxen#6, @Azorlogh thanks for sharing your thoughts!). @x31eq Do you think this is a show stopper?

The second best option might be Iced. It worked smoothly in my expriments and can render to VST hosts. The big problems are that it has no access to physical key locations and, since it depends on wgpu, it somehow requires a platform with Vulkan support. I hope what I say here is correct...

from tune.

Woyten avatar Woyten commented on July 19, 2024

Bevy is by far the best suitable framework for the task. It is

  • well-maintained
  • fast
  • has explicit WASM support
  • supports all kinds of input events (physical keys, mouse, gamepad)
  • allows for custom graphics
  • has basic UI widgets
  • enables 3D graphics

Closing this ticket now since I made my decision.

from tune.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.