Merge pull request #896 from BO41/docu

Add documentation to set_icon
This commit is contained in:
Cobrand
2019-05-25 15:58:20 +02:00
committed by GitHub
+10
View File
@@ -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())