TheOpenSpaceProgram / new-ospgl

A space exploration game in OpenGL. Devblog: https://tatjam.github.io/index.html
MIT License
42 stars 6 forks source link

Smarter GUI preparing #41

Closed tatjam closed 1 year ago

tatjam commented 1 year ago

The current GUI prepare system is a mess, as made evident by my attempt to implement drop-down boxes. The solution to this problem is to do a total of 5 passes, with new functions instead of clumping everything together in prepare.

Furthermore, the GUIScreen system could keep track of all canvases, so that you don't need to manually call anything else than:

gui_screen->prepare_pass(); // this calls pre_prepare, position and prepare
// 3d input stuff here which may be blocked by GUI and may at the same time block it
gui_screen->input_pass(); // this calls prepare again, but with execute user actions

This system should be straightforward to implement and should work for pretty much all GUI situations.