Recently the gamedev-wg has been working on trying to improve the gamedev scene for Rust, and one thing that we came up with was a way to slightly disconnect windowing libraries and graphical libraries by having them both work through a very small intermediary crate.
Basically you make your Window type implement the HasRawWindowHandle trait, and that has a method which offers up a pointer to the OS handle for the window. Then the graphics library can get the pointer and initialize the graphics API in whatever way.
This protocol is currently supported in the winit 0.20-alpha, and we're working to also get it supported in 0.19 as well as in sdl2. We'd appreciate if the glfw crate could add this in the next release or two.
Hello everyone.
Recently the gamedev-wg has been working on trying to improve the gamedev scene for Rust, and one thing that we came up with was a way to slightly disconnect windowing libraries and graphical libraries by having them both work through a very small intermediary crate.
It has the very imaginative name of raw-window-handle.
Basically you make your
Window
type implement theHasRawWindowHandle
trait, and that has a method which offers up a pointer to the OS handle for the window. Then the graphics library can get the pointer and initialize the graphics API in whatever way.This protocol is currently supported in the
winit
0.20-alpha, and we're working to also get it supported in 0.19 as well as insdl2
. We'd appreciate if theglfw
crate could add this in the next release or two.