Popups are finished! (almost)
After a little bit of work, a popup system (which I gotta say is written kinda well compared to all the other code) is in place!
Currently, there are:
- Exit Confirmation Popup
- Save File Dialog
- Load File Dialog
One last thing is still missing though: The please press a button popup for inputs (,).
Technical Details
The popup system works by using a sub-struct inside of the global state struct (state.popup). It contains data such as whether a popup is active, if it accepts text input and handlers for drawing and the confirm button.
There’s a base func (create_popup_base()) that draws a new basic outline for the popup. After that, only the contents of the popup get refreshed via the custom handler set via setting a function pointer (state.popup.refresh_handler).
The popup also “captures” input. There’s a seperate if for state.popup.active before the main input validation which processes inputs and then skips the normal input processing.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.