emoon / rust_minifb

Cross platfrom window and framebuffer crate for Rust
MIT License
980 stars 92 forks source link

Support raw_window_handle #325

Closed sotrh closed 11 months ago

sotrh commented 11 months ago

I noticed that you you are working on adding gpu support manually, and I thought I'd mention that the raw_window_handle crate is a thing. Adding support for that would allow people such as myself to use minifb with wgpu.

Regardless it's nice to see some pure Rust alternatives to winit. While winit is robust and supports a lot of platforms, it's nice to have complete control over the game loop.

emoon commented 11 months ago

Hey,

Thanks for the praise, just notice that minifb isn't really indeded as a "full blown" windowing library so you may miss features down the line.

That being said minifb already supports raw_window_handle https://github.com/emoon/rust_minifb/blob/master/src/lib.rs#L148

sotrh commented 11 months ago

Oh good to know!

emoon commented 11 months ago

I just noticed that minifb uses raw_window_handle version 0.4 while there is a 0.5 version now. I don't know how much they differ in terms of API compatibility, but just keep that in mind if something doesn't seem to work correctly. Then it might be that:

  1. minifb needs to be updated to use 0.5.x (PRs welcome!)
  2. For now use 0.4 when testing in your project if that is acceptable.