swatteau/sokoban-rs

Updating sdl2_ttf breaks build

Closed this issue · 2 comments

Compiling sokoban-rs v1.0.4 (file:///tmp/sokoban-rs-master)
src/render.rs:167:46: 167:63 error: unresolved name `sdl2_ttf::blended` [E0425]
src/render.rs:167         let surface = self.font.render(text, sdl2_ttf::blended(self.bar_text_color)).unwrap();
                                                               ^~~~~~~~~~~~~~~~~
src/render.rs:167:46: 167:63 help: run `rustc --explain E0425` to see a detailed explanation
src/main.rs:135:5: 135:21 error: unresolved name `sdl2_image::quit` [E0425]
src/main.rs:135     sdl2_image::quit();
                    ^~~~~~~~~~~~~~~~
src/main.rs:135:5: 135:21 help: run `rustc --explain E0425` to see a detailed explanation
src/render.rs:56:13: 56:28 error: no associated item named `from_file` found for type `sdl2_ttf::font::Font` in the current scope
src/render.rs:56             Font::from_file(&ttf, 20).unwrap()
                             ^~~~~~~~~~~~~~~
src/render.rs:80:22: 80:36 error: this function takes 3 parameters but 2 parameters were supplied [E0061]
src/render.rs:80                     .create_and_set(PixelFormatEnum::RGBA8888, fullsize);
                                      ^~~~~~~~~~~~~~
src/render.rs:80:22: 80:36 help: run `rustc --explain E0061` to see a detailed explanation
src/render.rs:96:34: 96:50 error: no associated item named `new_unwrap` found for type `sdl2::rect::Rect` in the current scope
src/render.rs:96         let original_rect = Some(Rect::new_unwrap(0, 0, fullsize.0, fullsize.1));
                                                  ^~~~~~~~~~~~~~~~
src/render.rs:150:20: 150:36 error: no associated item named `new_unwrap` found for type `sdl2::rect::Rect` in the current scope
src/render.rs:150         let rect = Rect::new_unwrap(0,
                                     ^~~~~~~~~~~~~~~~
src/render.rs:167:33: 167:39 error: this function takes 1 parameter but 2 parameters were supplied [E0061]
src/render.rs:167         let surface = self.font.render(text, sdl2_ttf::blended(self.bar_text_color)).unwrap();
                                                  ^~~~~~
src/render.rs:167:33: 167:39 help: run `rustc --explain E0061` to see a detailed explanation
src/render.rs:183:49: 183:65 error: no associated item named `new_unwrap` found for type `sdl2::rect::Rect` in the current scope
src/render.rs:183         self.renderer.copy(&texture, None, Some(Rect::new_unwrap(x, y, w, h)));
                                                                  ^~~~~~~~~~~~~~~~
src/render.rs:192:32: 192:48 error: no associated item named `new_unwrap` found for type `sdl2::rect::Rect` in the current scope
src/render.rs:192         let target_rect = Some(Rect::new_unwrap(x,
                                                 ^~~~~~~~~~~~~~~~
src/render.rs:216:14: 216:30 error: no associated item named `new_unwrap` found for type `sdl2::rect::Rect` in the current scope
src/render.rs:216         Some(Rect::new_unwrap(x, y, img_size.0, img_size.1))
                               ^~~~~~~~~~~~~~~~
src/render.rs:298:14: 298:30 error: no associated item named `new_unwrap` found for type `sdl2::rect::Rect` in the current scope
src/render.rs:298         Some(Rect::new_unwrap(x, y, w, h))
                               ^~~~~~~~~~~~~~~~
error: aborting due to 9 previous errors

The update is necessary to fix ARM as the current Cargo.toml points to sdl2_ttf and sdl2_image versions that don't compile there.

I was going to send a PR updating the dependencies but it turned out sokoban didn't compile.

Hi,

This is fixed. I upgraded to version 0.16 of the SDL2 crates and adapted the code to the API changes.

Great job, thanks a lot!