print sdl errors (#478)

This commit is contained in:
Logan McNaughton 2025-07-09 10:19:44 +02:00 committed by GitHub
parent 6c977dbe5e
commit a5ddea353a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,10 +37,18 @@ pub fn init(device: &mut device::Device) {
sdl3_sys::video::SDL_CreateWindow(title.as_ptr(), window_width, window_height, flags)
};
if device.ui.video.window.is_null() {
panic!("Could not create window");
panic!("Could not create window: {}", unsafe {
std::ffi::CStr::from_ptr(sdl3_sys::error::SDL_GetError())
.to_str()
.unwrap()
});
}
if !unsafe { sdl3_sys::video::SDL_ShowWindow(device.ui.video.window) } {
panic!("Could not show window");
panic!("Could not show window: {}", unsafe {
std::ffi::CStr::from_ptr(sdl3_sys::error::SDL_GetError())
.to_str()
.unwrap()
});
}
unsafe {
sdl3_sys::everything::SDL_HideCursor();