mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Merge pull request #1006 from GuillaumeGomez/deprecated
Remove/update deprecated items
This commit is contained in:
+1
-2
@@ -1726,8 +1726,7 @@ impl Event {
|
||||
}} // close unsafe & match
|
||||
}
|
||||
|
||||
#[deprecated(since = "0.33.0", note = "This method has been made public accidentally")]
|
||||
pub fn unwrap_keymod(keymod_option: Option<keyboard::Mod>) -> keyboard::Mod {
|
||||
fn unwrap_keymod(keymod_option: Option<keyboard::Mod>) -> keyboard::Mod {
|
||||
match keymod_option {
|
||||
None => keyboard::Mod::empty(),
|
||||
Some(x) => x,
|
||||
|
||||
@@ -343,12 +343,6 @@ pub enum Fading {
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
pub struct Channel(pub i32);
|
||||
|
||||
/// Return a channel object.
|
||||
#[deprecated(since = "0.31.0", note = "use `Channel(i32)` instead")]
|
||||
pub fn channel(chan: i32) -> Channel {
|
||||
Channel(chan)
|
||||
}
|
||||
|
||||
/// Set the number of channels being mixed.
|
||||
pub fn allocate_channels(numchans: i32) -> i32 {
|
||||
unsafe { mixer::Mix_AllocateChannels(numchans as c_int) as i32 }
|
||||
|
||||
@@ -343,36 +343,6 @@ impl Rect {
|
||||
self.raw.h = clamp_size(height) as i32;
|
||||
}
|
||||
|
||||
/// Checks whether this rect contains a given point, or touches it on the
|
||||
/// right and/or bottom edges. This method is deprecated in favor of
|
||||
/// [`Rect::contains_point`](#method.contains_point).
|
||||
///
|
||||
/// For [historical
|
||||
/// reasons](https://github.com/AngryLawyer/rust-sdl2/issues/569), this
|
||||
/// method differs in behavior from
|
||||
/// [`SDL_PointInRect`](https://wiki.libsdl.org/SDL_PointInRect) by
|
||||
/// including points along the bottom and right edges of the rectangle, so
|
||||
/// that a 1-by-1 rectangle actually covers an area of four points, not
|
||||
/// one.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use sdl2::rect::{Rect, Point};
|
||||
/// let rect = Rect::new(1, 2, 3, 4);
|
||||
/// assert!(rect.contains(Point::new(1, 2)));
|
||||
/// assert!(!rect.contains(Point::new(0, 1)));
|
||||
/// assert!(rect.contains(Point::new(3, 5)));
|
||||
/// assert!(rect.contains(Point::new(4, 6))); // N.B.
|
||||
/// assert!(!rect.contains(Point::new(5, 7)));
|
||||
/// ```
|
||||
#[deprecated(since = "0.30.0", note = "use `contains_point` instead")]
|
||||
pub fn contains<P>(&self, point: P) -> bool where P: Into<(i32, i32)> {
|
||||
let (x, y) = point.into();
|
||||
let inside_x = x >= self.left() && x <= self.right();
|
||||
inside_x && (y >= self.top() && y <= self.bottom())
|
||||
}
|
||||
|
||||
/// Checks whether this rectangle contains a given point.
|
||||
///
|
||||
/// Points along the right and bottom edges are not considered to be inside
|
||||
|
||||
Reference in New Issue
Block a user