diff --git a/Cargo.lock b/Cargo.lock index 483bc4c..c9486ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,8 +2,8 @@ name = "super-matte-bros" version = "0.0.1" dependencies = [ - "sdl2 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sdl2_image 0.0.33 (git+https://github.com/logaritmisk/rust-sdl2_image.git)", + "sdl2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sdl2_image 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -49,19 +49,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sdl2" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "sdl2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sdl2-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sdl2-sys" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -70,11 +70,12 @@ dependencies = [ [[package]] name = "sdl2_image" -version = "0.0.33" -source = "git+https://github.com/logaritmisk/rust-sdl2_image.git#404ccefedd74862d01e7462ea3fe696caa9f1e9f" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sdl2 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sdl2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "sdl2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sdl2-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 3023e7a..434054c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,8 @@ version = "0.0.1" authors = ["logaritmisk "] [dependencies] -sdl2 = "0.1.0" - -[dependencies.sdl2_image] -git = "https://github.com/logaritmisk/rust-sdl2_image" +sdl2 = "0.2.1" +sdl2_image = "0.2.1" [[bin]] name = "super-matte-bros" diff --git a/src/main.rs b/src/main.rs index 05f77fe..7e5dd40 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,15 +52,14 @@ enum Tile<'a> { fn main() { let sdl_context = sdl2::init(sdl2::INIT_EVERYTHING).unwrap(); - sdl2_image::init(sdl2_image::INIT_PNG); - let window = match Window::new("Super Matte Bros", WindowPos::PosCentered, WindowPos::PosCentered, SCREEN_WIDTH, SCREEN_HEIGHT, OPENGL) { + let window = match Window::new(&sdl_context, "Super Matte Bros", WindowPos::PosCentered, WindowPos::PosCentered, SCREEN_WIDTH, SCREEN_HEIGHT, OPENGL) { Ok(window) => window, Err(err) => panic!("failed to create window: {}", err) }; - let renderer = match sdl2::render::Renderer::from_window(window, sdl2::render::RenderDriverIndex::Auto, sdl2::render::ACCELERATED) { + let mut renderer = match sdl2::render::Renderer::from_window(window, sdl2::render::RenderDriverIndex::Auto, sdl2::render::ACCELERATED) { Ok(renderer) => renderer, Err(err) => panic!("failed to create renderer: {}", err) }; diff --git a/src/sprite.rs b/src/sprite.rs index b4f431b..690235a 100644 --- a/src/sprite.rs +++ b/src/sprite.rs @@ -9,7 +9,7 @@ pub trait Sprite { pub struct StaticSprite<'a> { - texture: &'a Texture<'a>, + texture: &'a Texture, x: i32, y: i32 } @@ -32,7 +32,7 @@ impl<'a> Sprite for StaticSprite<'a> { pub struct AnimatedSprite<'a> { - texture: &'a Texture<'a>, + texture: &'a Texture, x: i32, y: i32, frame: i32,