Rust-SDL2 / rust-sdl2

SDL2 bindings for Rust
MIT License
2.74k stars 468 forks source link

Update to SDL 2.0.18 #1181

Open FrenchDilettante opened 2 years ago

FrenchDilettante commented 2 years ago

Hi,

SDL 2.0.18 has been published and includes a handful of extremely useful new methods, which I would love to use in my Rust program.

What's the procedure to update the SDL2 bindings in sdl2_sys? I'd be happy to open a PR for that if you wish!

Cobrand commented 2 years ago

It's not perfect but you compile rust-sdl2 using use-bindgen (make sure your local SDL2 is 2.0.18), an then copy sdl_binding.rs from target/sdl2-sys-xxxxx/sdl_bindings.rs to sdl2-sys/sdl-bindings.rs

That should do the trick

tasogare3710 commented 2 years ago

I generated sdl_bindings.rs for SDL 2.0.18 using the use-bindgen feature and the SDL2_INCLUDE_PATH environment variable, but a compilation error occurred. It seems to be the same problem as https://github.com/rust-lang/rust-bindgen/issues/1556, but the directly cause seems to be not specifying the proper whitelist.

I added only the necessary api's published by SDL2 to the whitelist, and the compilation was successful. This issue is mentioned in https://github.com/Rust-SDL2/rust-sdl2/issues/1059#issuecomment-750952093 § Build issues with bindgen.

alula commented 2 years ago

Since 2.0.18 is in bundled master, can embedded sdl_bindings.rs be updated to 2.0.18?