mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
@@ -1225,6 +1225,16 @@ impl Window {
|
||||
}
|
||||
}
|
||||
|
||||
/// Use this function to set the icon for a window.
|
||||
///
|
||||
/// # Example:
|
||||
/// ```compile_fail
|
||||
/// // requires "--features 'image'"
|
||||
/// use sdl2::surface::Surface;
|
||||
///
|
||||
/// let window_icon = Surface::from_file("/path/to/icon.png")?;
|
||||
/// window.set_icon(window_icon);
|
||||
/// ```
|
||||
pub fn set_icon<S: AsRef<SurfaceRef>>(&mut self, icon: S) {
|
||||
unsafe {
|
||||
sys::SDL_SetWindowIcon(self.context.raw, icon.as_ref().raw())
|
||||
|
||||
Reference in New Issue
Block a user