This commit is contained in:
gallant 2022-05-25 21:45:42 -05:00
parent 3723dc1966
commit 68b82fe1e0

View file

@ -84,7 +84,7 @@
//! ``` //! ```
pub mod physics; pub mod physics;
pub mod vec; pub mod vec2;
use std::{ use std::{
cell::Cell, cell::Cell,
@ -188,7 +188,7 @@ pub struct Sprite {
pub rect: Rect, pub rect: Rect,
surf: Surface<'static>, surf: Surface<'static>,
angle: f64, angle: f64,
is_platform: bool,
} }
@ -200,7 +200,7 @@ impl Sprite {
/// # use cat_box::*; /// # use cat_box::*;
/// let s = Sprite::new("duck.png", 500, 400).unwrap(); /// let s = Sprite::new("duck.png", 500, 400).unwrap();
/// ``` /// ```
pub fn new<P: AsRef<Path>>(path: P, x: i32, y: i32, plat: bool) -> Result<Self> { pub fn new<P: AsRef<Path>>(path: P, x: i32, y: i32) -> Result<Self> {
let ops = RWops::from_file(path, "r")?; let ops = RWops::from_file(path, "r")?;
let surf = ops.load()?; let surf = ops.load()?;
@ -211,7 +211,7 @@ impl Sprite {
rect: dest_rect, rect: dest_rect,
surf, surf,
angle: 0.0, angle: 0.0,
is_platform: plat,
}) })
} }
@ -223,7 +223,7 @@ impl Sprite {
/// let bytes = include_bytes!("../duck.png"); /// let bytes = include_bytes!("../duck.png");
/// let s = Sprite::from_bytes(bytes, 500, 400).unwrap(); /// let s = Sprite::from_bytes(bytes, 500, 400).unwrap();
/// ``` /// ```
pub fn from_bytes<B: AsRef<[u8]>>(bytes: B, x: i32, y: i32, plat: bool) -> Result<Self> { pub fn from_bytes<B: AsRef<[u8]>>(bytes: B, x: i32, y: i32) -> Result<Self> {
let ops = RWops::from_bytes(bytes.as_ref())?; let ops = RWops::from_bytes(bytes.as_ref())?;
let surf = ops.load()?; let surf = ops.load()?;
@ -234,7 +234,7 @@ impl Sprite {
rect: dest_rect, rect: dest_rect,
surf, surf,
angle: 0.0, angle: 0.0,
is_platform: plat,
}) })
} }