|
|
|
|
|
by arianvanp
2607 days ago
|
|
Recently I started playing with https://github.com/ajnsit/concur-documentation/blob/master/R... which has been the most refreshing UI paradigm i've used in a while. and it reminds me a lot of this ImGUI approach, but behind the scenes it uses coroutines instead. The idea is that a button is a UI element that _blocks_ until an event is fired. You can then compose elements in time like: button "hey" >> label "clicked"
which is a program that displays a button, you click it, the button goes away and the text "clicked appears"Or you can compose programs in space: (button "hey" <> label "not clicked")
this is a program that displays both a button, and a label at the same time.Now, by combining both space and time, we can create a program that changes the label when clicking as follows: program = (button "toggle" <> label "off") >> (button "toggle" <> label "on") >> program
This is an application that toggles a label on and off when you press a button. (Note that the definition is recursive) |
|