Skip to content

GPU-accelerated GUI development for Node.js and the browser

License

Notifications You must be signed in to change notification settings

andreamancuso/xframes

Repository files navigation

XFrames - DOM-free GUI development

Motivation

I've always found DOM-free GUI development very interesting conceptually but I never really needed to use it - until relatively recently.

I invested quite a bit of time and effort into figuring out how WebAssembly and Emscripten work. I eventually managed to compile the Dear ImGui emscripten example and modified it to suit my requirements. Given my lack of experience with C/C++, I can tell you that this has been far from being a straightforward process. I have eventually realized that someone else out there might benefit from this experience of mine.

As I write these paragraphs, I realise that, despite accomplishing a few small initial goals, there is still lot to do. I hope you find these libraries useful, if anything just to get yourself acquainted with WebAssembly, C/C++, GLFW, OpenGL.

Caveats

Overall quality

I work on this project during my spare time so the overall quality is ... suboptimal. Please bear with me while I make the necessary improvements.

Due of my limited expertise with C/C++, you might come across bugs - and the code may not be particularly performant.

On the plus side, although still lacking, I added some unit tests for the C++ layer.

Performance

As the rendering is delegated to the GPU, the overall performance should be at the very least half-decent. That said, I am still getting familiar with the more advanced data structures available in C++.

I still need to benchmark/compare the differences in terms performance between WASM and the native Node module.

Accessibility

GUI libraries such as egui are a very good example of accessible non-DOM based GUIs. The overall impression I get is that DOM-based GUIs are more accessible. Perhaps this project will foster interest in the topic and motivate people and/or companies to invest more in this area.

Support for other frameworks

At the moment I am focusing on bindings for React only. The renderer is actually adapted from react-native's Fabric renderer. Perhaps there are other options I could/should have considered. Feel free to let me know your thoughts.

Basic online demo

(online demo) Only browsers that natively support WebGPU: Chrome, Edge, Firefox nightly, possibly Safari (though I have not tested it).

Screenshots

Recording.2024-10-06.134348.mp4

React Dear Imgui screenshot

React Dear Imgui screenshot

React Dear Imgui screenshot 4

React Dear Imgui Electron demo

Contributors ✨

Thanks goes to these wonderful people (emoji key):

genautz
genautz

💻 📖 📦 🔧 🚇

This project follows the all-contributors specification. Contributions of any kind welcome!