Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shape window #1346

Merged
merged 1 commit into from
Nov 12, 2023
Merged

Add shape window #1346

merged 1 commit into from
Nov 12, 2023

Conversation

serpilliere
Copy link
Contributor

This branch adds the support of shaped windows.
Usage example:

    let mut builder =  sdl2::video::WindowBuilder::new(&video_subsystem, "title", width, height).set_shaped();

    let mut shape_surface = sdl2::surface::Surface::from_data(
        &mut shape_data,
        width,
        height,
        width * 4,
        sdl2::pixels::PixelFormatEnum::RGBA8888,
    )
    .map_err(|err| anyhow!("Cannot laod surface {}", err))?;

    let ret = window.set_window_shape(&mut shape_surface);

Copy link
Member

@Cobrand Cobrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! I didn't know this feature was there, very interesting.

I have left a few comments, I think they're necessary for someone like me who didn't know what it was before looking at the source code.

src/sdl2/video.rs Outdated Show resolved Hide resolved
src/sdl2/video.rs Outdated Show resolved Hide resolved
src/sdl2/video.rs Outdated Show resolved Hide resolved
@serpilliere serpilliere force-pushed the shape_window branch 2 times, most recently from 22284d4 to 7f22c0e Compare November 11, 2023 16:05
@Cobrand
Copy link
Member

Cobrand commented Nov 12, 2023

Thanks!

@Cobrand Cobrand merged commit e443428 into Rust-SDL2:master Nov 12, 2023
17 checks passed
@serpilliere serpilliere deleted the shape_window branch November 12, 2023 22:00
@serpilliere
Copy link
Contributor Author

Thanks for the merge @Cobrand !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants