print error message when sdl fails

This commit is contained in:
Logan McNaughton 2025-01-27 12:02:42 +01:00
parent 2148b1c198
commit cbc9045ad4

View File

@ -45,7 +45,10 @@ pub fn sdl_init(flag: sdl3_sys::init::SDL_InitFlags) {
unsafe {
let init = sdl3_sys::init::SDL_WasInit(0);
if init & flag == 0 && !sdl3_sys::init::SDL_InitSubSystem(flag) {
panic!("Could not initialize SDL subsystem: {}", flag);
let err = std::ffi::CStr::from_ptr(sdl3_sys::error::SDL_GetError())
.to_str()
.unwrap();
panic!("Could not initialize SDL subsystem: {}, {}", flag, err);
}
}
}