Rust-SDL2 / rust-sdl2

SDL2 bindings for Rust
MIT License
2.77k stars 474 forks source link

feature: need binding for SDL_CreateWindowFrom #1162

Open eric5f3759df opened 3 years ago

eric5f3759df commented 3 years ago

need this function to create sdl with other window

Spencer1O1 commented 1 year ago

I don't know if this helps you but in my project I just used this to create a window from an hwnd (pointer) in windows:

let window: Result<Window, WindowBuildError> = {
    let raw: *mut SDL_Window = unsafe { sdl2_sys::SDL_CreateWindowFrom(hwnd) };
    if raw.is_null() {
        Err(SdlError(get_error()))
    } else {
        Ok(unsafe { Window::from_ll(video_subsystem, raw) })
    }
};