I'm currrently working on a small Game Engine using OpenGl. For Window and Context managing I'm using the common glfw library. At the Moment my glfw calls and callback functions sit kind of loseley within the program so I want to encapsulate everything related to window/glfw somehow.
I tried wrapping it in a class but that quickly turned into a huge mess. Callback functions have to be static and there shouldn't be ever more than one window in my game.
So I was thinking about a Singleton class with static callback member functions. However today I read about anonymous namespaces. From my understanding I could write something that works like a full static class using this. Just put all public functions that should be exposed to the rest of the game in the namespace and internal stuff like the variable holding the window handle in a anonymous namespace within the window namespace.
Is my Singleton class solution considered a good approach or is there even a better way to encapsulate window logic apart of the two mentioned approaches that I didn't think about at all?