OpenRA/OpenRA — pull request #6893 by Mailaender (2014-11-05 17:07:34+00:00)
Title: Ported window creation and input to OpenTK

This deprecates https://github.com/flibitijibibo/SDL2-CS and replaces it with @OpenTK. In practice this does not change much. The SDL2 backend is still preferred especially on Mac OS X, but it is not a hard dependency anymore. The GameWindow will fall back to other native implementations. This has several advantages:

* We gain portability to platforms where SDL2 is not supported or installed. Writing a renderer for OpenGL ES can then target mobile devices or Windows users without OpenGL capable drivers when ANGLE translates these to the DirectX API for us.
* The outdated MiniTK we used before has been dropped by upstream. https://github.com/flibitijibibo/SDL2-CS/issues/20 We now use one library that is actively maintained with tagged releases. This also makes life easier for Linux packagers when they unbundle our thirdparty dependencies. https://github.com/OpenRA/OpenRA/issues/6863
* Personally I like the C#yfied API. I don't need constructs like OpenGl.Gl.gl* to remind me of C namespaces/macros that look alien in the .NET world as I usually discover APIs through auto-complete in my IDE. This cleans up the code and allows even a newbie like me to work with these internals.
* I discovered that OpenTK can query display devices and change resolutions. This may help us resolve https://github.com/OpenRA/OpenRA/issues/6405 and https://github.com/OpenRA/OpenRA/issues/4440. Also https://github.com/OpenRA/OpenRA/issues/3774 may be possible with the OnResize events.
* The latest releases http://www.opentk.com/news/opentk-1.1.2-stable-released-with-cocoa-backend promise a lot of performance optimization in binding initialization and memory usage. I hope this improves performance now and in the future.

There are also some disadvantages or known issues:

* I could not get PseudoFullscreen behavior to work so I removed it as also suggested in https://github.com/OpenRA/OpenRA/pull/6367.
* Clipboard access is not yet implemented so I had to remove it. http://www.opentk.com/node/3699#comment-15838
* The window will always grab the mouse. You can ALT+TAB to lose focus, but there is no free mouse cursor. I did not find any settings to emulate this old behavior.

Also this requires extensive testing on all currently supported platforms for regressions. It will also be interesting if we already support *BSD now. https://github.com/OpenRA/OpenRA/issues/5446