I’m trying to set a multi-windowed program, where the windows are managed by the OS (ie. calling glfxCreateWindow for each window I want to create).
Currently, cocos doesn’t appear to support this. Couple questions from that:
1 - is there any plan to support multiple windows?
2 - if there’s no plan (and we take on the task), what would be the most recommended implementation strategy?
3 - If we implement it, is there a process to get it approved to be rolled into future official releases?
Regarding 2, I have been thinking of a few strategies.
The first is to refactor the Director singleton so that it’s not a singleton anymore, but consists of many instances managed by a DirectorManager (or some other name). The DirectorManager would manage the various instances of Director, keeping a 1:1 ratio of director to window. The various things that need to be shared (like the texture cache) would be moved up to the manager so that all directors still work on shared textures. My gut feeling is that this is closer to the “correct” solution but comes with a significant amount of refactoring. Due to the refactoring necessary, integrating future releases will be incredibly painful.
The second is to have a hacked Scene subclass which is responsible for the layout of all the windows at once. It would have to know about windows and can call directly or indirectly glfwCreateWindow. It would probably also have to manage its own window size and keep a track of its own projection matrix, scale factor, and assume responsibility for some other things that Director takes care of. This probably wouldn’t require as much refactoring as the first solution but is messy, and I believe we lose on some of the nice features that Director gives us, such as scene transitions.
I’ve only spent about a week looking through the cocos code, so hopefully someone will tell me I’m crazy and that there’s a much better way to do this