I was struggling to build a cross-platform desktop application with C, both because I'm a novice at C (and native applications in general) and because there weren't many libraries to do what I need.
Rewrite the app in Rust instead of C. Use winit for window management and cpal for audio, instead of SDL. Use wgpu for graphics; it's backed by the same libraries as SDL, but also supports portable shaders. Use Dear ImGui rust bindings for a GUI, instead of nuklear.
Rewriting the app in Rust has a few advantages:
I actually know Rust, so I can develop more quickly.
FFI is reasonably easy, meaning that the project can use C libraries (shrooms-vb-core) and C++ libraries (dear imgui) without makefile surgery.
Rust has a high-quality portable standard library and many easy-to-use "crates"/packages, so I don't have to spend a lot of time writing/integrating an .ini parser/CLI parser/ring buffer/dictionary
Rust is cross-platform by default, so I am a lot more confident that this will run on OSX.
There's some downsides too:
Not a ton of people in the VB community know Rust, so it'll be hard for other people to contribute.
Builds are way slower, especially in release mode.
The app is much bigger (rust binaries are already big, and I pull in libraries like a node.js dev).
The app is slower than a pure C application. I haven't set up cross-platform LTO, and winit/wgpu do more than SDL did. However, I don't think it's noticeably slower, since the VB only runs at 20mhz anyway.
I think this loses compatibility with Windows XP (Rust runs there, but winit is relatively new and might not support old-timey platforms like that).
I was struggling to build a cross-platform desktop application with C, both because I'm a novice at C (and native applications in general) and because there weren't many libraries to do what I need.
Rewrite the app in Rust instead of C. Use [winit](https://github.com/rust-windowing/winit) for window management and [cpal](https://github.com/RustAudio/cpal) for audio, instead of SDL. Use [wgpu](https://wgpu.rs/) for graphics; it's backed by the same libraries as SDL, but also supports portable shaders. Use [Dear ImGui rust bindings](https://github.com/imgui-rs/imgui-rs) for a GUI, instead of nuklear.
Rewriting the app in Rust has a few advantages:
- I actually know Rust, so I can develop more quickly.
- FFI is reasonably easy, meaning that the project can use C libraries (shrooms-vb-core) and C++ libraries (dear imgui) without makefile surgery.
- Rust has an [installer](https://rustup.rs/), [package manager](https://crates.io/), and [distribution tooling](https://opensource.axo.dev/cargo-dist/). All of these are automatically cross-platform and fairly easy to set up.
- Rust has a high-quality portable standard library and many easy-to-use "crates"/packages, so I don't have to spend a lot of time writing/integrating an .ini parser/CLI parser/ring buffer/dictionary
- Rust is cross-platform by default, so I am a lot more confident that this will run on OSX.
There's some downsides too:
- Not a ton of people in the VB community know Rust, so it'll be hard for other people to contribute.
- Builds are way slower, especially in release mode.
- The app is much bigger (rust binaries are already big, and I pull in libraries like a node.js dev).
- The app is slower than a pure C application. I haven't set up cross-platform LTO, and winit/wgpu do more than SDL did. However, I don't think it's _noticeably_ slower, since the VB only runs at 20mhz anyway.
- I think this loses compatibility with Windows XP (Rust runs there, but winit is relatively new and might not support old-timey platforms like that).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I was struggling to build a cross-platform desktop application with C, both because I'm a novice at C (and native applications in general) and because there weren't many libraries to do what I need.
Rewrite the app in Rust instead of C. Use winit for window management and cpal for audio, instead of SDL. Use wgpu for graphics; it's backed by the same libraries as SDL, but also supports portable shaders. Use Dear ImGui rust bindings for a GUI, instead of nuklear.
Rewriting the app in Rust has a few advantages:
There's some downsides too:
94cb5a542dto99d6970323