An unofficial, read-only Hacker News reader.

2035 came early (opens external site)

1039 points by setheron 5 days ago | fzakaria.com | 382 comments on HN

View full thread · View on Hacker News

Comment thread (3)

  1. > Immediate mode GUIs like Dear Imgui or Clay allow for super-simple looking code in basic C

    Layout computation is always awkward in immediate guis. You have to do an extra pass or throw away a frame.

    Replies (2)
    1. Clay's algorithm actually does many passes, that doesn't mean it invokes the UI function multiple times. You are allowed to retain state during computation.

      Here's a cool explainer video:

      https://www.youtube.com/watch?v=by9lQvpvMIc

    2. Jetpack Compose splits this into measure and layout passes, and running either pass twice crashes the UI. They can do this because they are faking immediate-mode on top of a retained-mode layout tree, sort of like React.