4 ms·
Manually checking if buttons are pressed seems very wrong to me, I want some kind of event framework to associate a 'button' area to an action. Then when a clic
by keeperofdakeys 14y ago
Manually checking if buttons are pressed seems very wrong to me, I want some kind of event framework to associate a 'button' area to an action. Then when a click is fired, work out which button this maps to, and execute the specific action.
I don't see how IMGUI specifically can add features over other methods either.
- seanmcdirmid 14y agoIt 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()