upgrade sdl2 and sdl2_image. use beta 2

This commit is contained in:
2015-04-22 13:32:21 +02:00
parent d7d1ab1dc7
commit b91ae6cb29
4 changed files with 16 additions and 18 deletions

19
Cargo.lock generated
View File

@@ -2,8 +2,8 @@
name = "super-matte-bros" name = "super-matte-bros"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"sdl2 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "sdl2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"sdl2_image 0.0.33 (git+https://github.com/logaritmisk/rust-sdl2_image.git)", "sdl2_image 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -49,19 +49,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "sdl2" name = "sdl2"
version = "0.1.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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)", "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)", "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]] [[package]]
name = "sdl2-sys" name = "sdl2-sys"
version = "0.1.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -70,11 +70,12 @@ dependencies = [
[[package]] [[package]]
name = "sdl2_image" name = "sdl2_image"
version = "0.0.33" version = "0.2.1"
source = "git+https://github.com/logaritmisk/rust-sdl2_image.git#404ccefedd74862d01e7462ea3fe696caa9f1e9f" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"sdl2-sys 0.1.0 (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)",
] ]

View File

@@ -4,10 +4,8 @@ version = "0.0.1"
authors = ["logaritmisk <anders.e.olsson@gmail.com>"] authors = ["logaritmisk <anders.e.olsson@gmail.com>"]
[dependencies] [dependencies]
sdl2 = "0.1.0" sdl2 = "0.2.1"
sdl2_image = "0.2.1"
[dependencies.sdl2_image]
git = "https://github.com/logaritmisk/rust-sdl2_image"
[[bin]] [[bin]]
name = "super-matte-bros" name = "super-matte-bros"

View File

@@ -52,15 +52,14 @@ enum Tile<'a> {
fn main() { fn main() {
let sdl_context = sdl2::init(sdl2::INIT_EVERYTHING).unwrap(); let sdl_context = sdl2::init(sdl2::INIT_EVERYTHING).unwrap();
sdl2_image::init(sdl2_image::INIT_PNG); 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, Ok(window) => window,
Err(err) => panic!("failed to create window: {}", err) 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, Ok(renderer) => renderer,
Err(err) => panic!("failed to create renderer: {}", err) Err(err) => panic!("failed to create renderer: {}", err)
}; };

View File

@@ -9,7 +9,7 @@ pub trait Sprite {
pub struct StaticSprite<'a> { pub struct StaticSprite<'a> {
texture: &'a Texture<'a>, texture: &'a Texture,
x: i32, x: i32,
y: i32 y: i32
} }
@@ -32,7 +32,7 @@ impl<'a> Sprite for StaticSprite<'a> {
pub struct AnimatedSprite<'a> { pub struct AnimatedSprite<'a> {
texture: &'a Texture<'a>, texture: &'a Texture,
x: i32, x: i32,
y: i32, y: i32,
frame: i32, frame: i32,