C
Colin Rofls
cmyr.net · Personal blog · on HN since 2017
Colin Rofls (cmyr) is a Rust developer who writes on GUI frameworks, font tools, and Rust programming techniques.
What HN saysCommenters recommend his GUI framework ingredients and Rust GUI infrastructure posts as overviews of the hard parts, including accessibility, of building a GUI from scratch.
18HN people shared it
5linked it in comments
17stories submitted
722story points
3 years agolast shared
2017people per year2026
Most-shared posts
- 1So you want to write a GUI framework8 people · 286 points · first shared 2021 · 173 comments on HN
- 2Type-checked keypaths in Rust5 people · 88 points · first shared 2021 · 20 comments on HN
- 3Rust GUI Infrastructure4 people · 5 points · first shared 2021 · discussion on HN
- 4Writing Pythonic Rust2 people · 219 points · first shared 2021 · 203 comments on HN
- 5The Hyperbezier Pen Tool2 people · 121 points · first shared 2020 · 22 comments on HN
- 6Assembled Poems (2014)1 people · 2 points · first shared 2017 · discussion on HN
- 7Dynamic Widget Sketches1 people · 1 points · first shared 2020 · discussion on HN
What HN people wrote when they linked it
bbkane · 2023-02-04
This is a strange take for me- people are CONSTANTLY trying to find new, better ways to do UI. Elm, React, DearIMGUI, Flutter, and Xilem are some of the more well-known fairly recent libraries.
See https://raphlinus.github.io/rust/gui/2022/07/15/next-dozen-guis.html for an overview of UI libs in Rust.
See https://www.cmyr.net/blog/gui-framework-ingredients.html for a great overview of some of the challenges making a GUI library
raphlinus · 2022-03-21
http://www.cmyr.net/blog/gui-framework-ingredients.html has a bunch of what you'll need to know about building a GUI from scratch, especially if you're interested in any of the "hard parts" rather than making a toy. It's Rust rather than C++ but many of the principles are similar.
Other than that, I do recommend the immediate mode GUI approach if you're writing everything yourself, as it's the lowest overall system complexity of all the approaches. It has a number of drawbacks, and things don't abstract/compose as easily as a standard object-oriented retained, or a newer React/SwiftUI approach, but exposing the raw parts has its upsides.
athrowaway3z · 2021-08-27
Not a direct answer but a good read/overview.
https://www.cmyr.net/blog/rust-gui-infra.html and the precursor https://www.cmyr.net/blog/gui-framework-ingredients.html
skyfaller · 2022-05-28
Do you happen to know if Relm addresses accessibility at all, or has plans to do so in the future? Every time I see a Rust GUI post, that's my first question: https://www.cmyr.net/blog/rust-gui-infra.html#accessibility
peter_d_sherman · 2023-07-17
Didn't know about Skia previously! Thank you for the excellent suggestion!
So, let's provide some links:
Overview: https://en.wikipedia.org/wiki/Skia_Graphics_Engine
Homepage: https://skia.org/
Source: https://skia.googlesource.com/skia/ (or) https://github.com/google/skia
Also -- there's this old HN post: https://news.ycombinator.com/item?id=28143972 where the following github projects which involve drawing are mentioned:
https://github.com/bkaradzic/bgfx
https://github.com/memononen/nanovg
https://github.com/wjakob/nanogui
In the following article: https://www.cmyr.net/blog/gui-framework-ingredients.html we find the following interesting quote:
>"These APIs exist, in subtly different form, on the various platforms. on macOS, there is CoreGraphics [Quartz 2D], on windows Direct2D, and on linux there is Cairo. One approach, then, is to present a common API abstraction over top of these platform APIs, puttying over the rough edges and filling in the gaps. (This is the approach we have currently taken, with the piet library.)"
So, some more quick links:
https://en.wikipedia.org/wiki/Direct2D
https://en.wikipedia.org/wiki/Quartz_(graphics_layer)
Piet:
https://docs.rs/piet/latest/piet/
https://github.com/linebender/piet
Related: 2018 Paper: "A Proposal to Add 2D Graphics
Rendering and Display to C++":
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0267r8.pdf