|Project:||The Open Toolkit library|
A Windows.Forms implementation of GameWindow will significantly reduce the amount of code we have to maintain in OpenTK.Platform. It will also make new new features easier to implement and the code will be better tested.
I have spent some time implementing GameWindow2 using Windows.Forms, GLControl and Kamujin's InterleavedScheduler. The resulting code is, indeed, much simpler and supports several features missing from the current implementation:
- Support for custom main loops.
- Support for window icons.
- Support for setting the window position.
- Saner event interface (closer to the BCL conventions).
On the other hand, the new code is missing keyboard and mouse support, cannot run at unlimited update / render frequencies and is not compatible with GameWindow.
I'd love to hear your feedback:
- Does it run on your system? (which OS?) You should see a black 640x480 window with a fps counter on the top-left corner. I am especially interested in Mac OS X.
- Is your fps stable and close to 60?
- How is the CPU and memory usage compared to the old implementation?
- Try setting different pixel formats in the GameWindow2 constructor - does it still work?
Binaries and source code are attached. I won't be having much free time the next few weeks, so please feel free to make modifications and corrections (consider it released under the OpenTK license).
Edit: New version which suppresses WinForms Mouse & Keyboard messages and changes FrameEventArgs.Time from
Edit 2: New version that allows you to choose between the old and new GameWindow implementation for comparison.
Edit 3: New version that forces VSync to off.
Edit 4: Please ignore the attachment below, it is outdated. Use the file located here.