I am designing an immediate gui using C++ and SDL2. As I was starting to design my framework, I noticed that basically everything needs a renderer or some sort of event or other relevant information (Fonts, Themes, etc.). Does it make sense to put these is global static object that only the gui functions have access to, or just keep passing everything in.
Would this be ok? This could be the header:
struct GuiForm {
GuiId active_id;
GuiId hot_id;
std::vector<Window> windows;
Renderer* renderer;
};
Then this could be the .cpp file:
static GuiForm* gui_form;
void SomeGuiWidget() {
GuiId current_hot_id = gui_form.hot_id;
/* Whatever the widget is going to do */
}