3 ms·
It requires a twist in your thinking for sure. We are so used to events, but don't realize how user unfriendly they can be. Polling is quite usable, and its rat
by seanmcdirmid 14y ago
It requires a twist in your thinking for sure. We are so used to events, but don't realize how user unfriendly they can be. Polling is quite usable, and its rather easy to modularize polling code without any callbacks or inverted control flow.
- repsilat 14y agoIf you have an object-oriented language (or near enough) with usable function types you can still emulate "traditional" GUI things if you really want to. Behold: class ButtonObj method call(): if(button(label, loc) callback() member Rect loc member String label member Func callback list displayList = []; displayList.add(ButtonObj("label", 100, 100, buttonAction)) Func eventLoop(): for i in displayList: i.call()