GUI (Graphical User Interface)
Table of Contents
1. Immediate Mode GUI
- Good for games or applications that run in FPS
- Good libraries (all of them allow any backend to be used)
- raygui (uses raylib as backend) (C)
- imgui (C++)
- clay (C) (any backend. raylib, sdl2, cairo backends provided)
- nuklear (C)
2. Non Immediate-Mode
2.1. Non Native
- NAppGUI (C) (A cross platform C SDK)
- GTK (C)
- QT (C++)
2.2. Native Widgets library
- wxWidgets (C++)
- tk (tcl)
3. Layouting
How Clay's UI Layout Algorithm Works: https://youtu.be/by9lQvpvMIc?si=R_6aSFosDxGM01LR&t=2181
Compute the following turn by turn:
- Fit sizing widths in Reverse Breadth First traversal of the tree
- Grow & Shrink Sizing widths in Breadth First traversal
- Wrap Text
- Fix sizing heights
- Grow & Shrink Sizing heights
- Positions
- Draw Commands
4. Reactive UI
- Towards a unified theory of reactive UI: https://raphlinus.github.io/ui/druid/2019/11/22/reactive-ui.html
- Towards principled reactive UI: https://raphlinus.github.io/rust/druid/2020/09/25/principled-reactive-ui.html
- Three principles:
- Whether to use "observable objects"
- How to express mutation of the render object tree
- Notion of stable identity of nodes in that tree
- Tab focusing requires Stable identity for the widgets
- Simple control flow is better:
- simplest is function call
- easier to reason
- Three principles:
- React as a UI Runtime https://overreacted.io/react-as-a-ui-runtime/
- React evaluates the whole component tree when the parent re-renders. Unless the child has memoized itself.
- Xilem: an architecture for UI in Rust https://raphlinus.github.io/rust/gui/2022/05/07/ui-architecture.html
- The most innovative aspect of Xilem is event dispatching based on an id path, at each stage providing mutable access to app state