TheCherno / Sparky

Cross-Platform High Performance 2D/3D game engine for people like me who like to write code.
Apache License 2.0
1.09k stars 222 forks source link

Multiple Windows #62

Open rcurtis opened 8 years ago

rcurtis commented 8 years ago

I am currently evaluating your drawing engine for a work project. One of my requirements is to be able to open/close multiple windows. Looking at the implementation this looks fairly trivial, but I don't have a very full understanding of the entire engine. Let me know what you think!

Robert

TheCherno commented 8 years ago

Multiple windows are currently not supported. You're right, it wouldn't be very difficult to add support for that, but it would take some work, since quite a few things rely on there being a single window.

Unfortunately I don't have time to take a look at this anytime soon, but feel free to see what you can do.

Mebourner commented 8 years ago

@rcurtis U'll store a map/array of windows, but each will need their own context. You'll need render commands to know which context they belong to. It gets quite complicated to implement, and even more time consuming if you need multi-platform support.

rcurtis commented 8 years ago

@Mebourner I believe you can use the same context and just make it current on each window... similar to how SFML does it. So yes, you will need a list or the windows. You iterate over them calling some MakeCurrent type function and then execute your drawing. That doesn't sound very complicated.

rcurtis commented 8 years ago

@TheCherno Yes the stumbling block seems to be all the services that assume only 1 window, stuff like input handling etc.