From 7242a9c8664fb5f878fbe1bb0673529652a96dd3 Mon Sep 17 00:00:00 2001 From: phideg Date: Sun, 10 Jan 2016 17:31:49 +0100 Subject: [PATCH] correct build errors --- .gitignore | 1 - Cargo.lock | 778 +++++++++++++++++++++++++++++++++-------- Cargo.toml | 10 +- src/app.rs | 38 +- src/board.rs | 4 +- src/main.rs | 27 +- src/number_renderer.rs | 11 +- src/tile.rs | 2 +- 8 files changed, 675 insertions(+), 196 deletions(-) diff --git a/.gitignore b/.gitignore index da5ff62..1750ac1 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,3 @@ /build/ /.rust/ rusti.sh - diff --git a/Cargo.lock b/Cargo.lock index c4d6b0d..a79c2b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,328 +2,816 @@ name = "rust-2048" version = "0.0.0" dependencies = [ - "piston 0.1.1 (git+https://github.com/pistondevelopers/piston)", - "piston2d-graphics 0.0.46 (git+https://github.com/pistondevelopers/graphics)", - "piston2d-opengl_graphics 0.0.16 (git+https://github.com/pistondevelopers/opengl_graphics)", - "pistoncore-sdl2_window 0.0.13 (git+https://github.com/pistondevelopers/sdl2_window)", - "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "piston2d-opengl_graphics 0.22.0 (git+https://github.com/PistonDevelopers/opengl_graphics.git)", + "piston_window 0.33.0 (git+https://github.com/pistondevelopers/piston_window)", + "pistoncore-sdl2_window 0.23.0 (git+https://github.com/pistondevelopers/sdl2_window)", + "rand 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "advapi32-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "android_glue" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bitflags" -version = "0.1.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "0.3.9" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "clock_ticks" -version = "0.0.5" -source = "git+https://github.com/tomaka/clock_ticks#462848731d99ed2f800e2e5a19e2d8ca3b11c90c" +name = "cgl" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cocoa" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "color_quant" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-foundation" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-graphics" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "dlib" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libloading 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "draw_state" -version = "0.0.7" -source = "git+https://github.com/gfx-rs/draw_state#44a0aed11abccbf970fc7efbe84b6482f0548248" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dwmapi-sys" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dylib" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "enum_primitive" -version = "0.0.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "flate2" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "freetype-rs" -version = "0.0.9" -source = "git+https://github.com/PistonDevelopers/freetype-rs.git#686a4d7ff99eddfc64fbe7d2c3a19832ee564614" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "freetype-sys 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "freetype-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "freetype-sys" -version = "0.0.5" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gcc" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gdi32-sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gfx" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "draw_state 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gfx_device_gl" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gfx 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_gl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gfx_gl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_common 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "khronos_api 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gif" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "color_quant 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lzw 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gl" -version = "0.0.12" -source = "git+https://github.com/bjz/gl-rs#62b66a85e4c2c0d88fb916040bc462702c8e0346" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gl_common 0.0.4 (git+https://github.com/bjz/gl-rs)", - "gl_generator 0.0.25 (git+https://github.com/bjz/gl-rs)", - "khronos_api 0.0.5 (git+https://github.com/bjz/gl-rs)", - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gl_common" -version = "0.0.4" -source = "git+https://github.com/bjz/gl-rs#62b66a85e4c2c0d88fb916040bc462702c8e0346" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gl_generator" -version = "0.0.25" -source = "git+https://github.com/bjz/gl-rs#62b66a85e4c2c0d88fb916040bc462702c8e0346" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "khronos_api 0.0.5 (git+https://github.com/bjz/gl-rs)", - "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "xml-rs 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "khronos_api 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gl_generator" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gleam" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glob" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "glutin" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_common 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "osmesa-sys 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "shared_library 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "user32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-kbd 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-window 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "x11-dl 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "image" -version = "0.3.9" -source = "git+https://github.com/pistondevelopers/image#75f9b791d6b030bc975ec737e9a2d78de39331af" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "enum_primitive 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "enum_primitive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gif 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "inflate" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "interpolation" -version = "0.0.5" -source = "git+https://github.com/PistonDevelopers/interpolation#c0c9e970e42a48402514285a5608e4729cf83298" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "kernel32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "khronos_api" -version = "0.0.5" -source = "git+https://github.com/bjz/gl-rs#62b66a85e4c2c0d88fb916040bc462702c8e0346" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "khronos_api" -version = "0.0.5" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.1.7" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "libz-sys" -version = "0.1.3" +name = "libc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libloading" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libz-sys" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "log" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lzw" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz-sys" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mmap" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num" -version = "0.1.24" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "osmesa-sys" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "shared_library 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "piston" -version = "0.1.1" -source = "git+https://github.com/pistondevelopers/piston#e4b588cf22275acb230a4d6baace2567ea66391a" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "pistoncore-event 0.1.3 (git+https://github.com/pistondevelopers/event)", - "pistoncore-input 0.0.9 (git+https://github.com/pistondevelopers/input)", - "pistoncore-window 0.1.2 (git+https://github.com/pistondevelopers/window)", + "pistoncore-event_loop 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-input 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-window 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "piston-float" -version = "0.0.1" -source = "git+https://github.com/pistondevelopers/float#2c73a3e34c384c79e95b35c069d5a69dda3a0cc4" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "piston-gfx_texture" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gfx 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "image 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-texture 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "piston-shaders_graphics2d" -version = "0.0.0" -source = "git+https://github.com/pistondevelopers/shaders#a2cbd6c63b5cb6852f2bef9e28e04301bca96efe" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "piston-texture" -version = "0.0.1" -source = "git+https://github.com/pistondevelopers/texture#3cc4cddc3f8c51c36ea11dd2f63d70aa887f53fb" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "piston-viewport" -version = "0.0.2" -source = "git+https://github.com/pistondevelopers/viewport#3819edeb0982d2552669e03ad9c0317e75340510" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "piston-float 0.0.1 (git+https://github.com/pistondevelopers/float)", + "piston-float 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "piston2d-gfx_graphics" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "freetype-rs 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-gfx_texture 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-shaders_graphics2d 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston2d-graphics 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "piston2d-graphics" -version = "0.0.46" -source = "git+https://github.com/pistondevelopers/graphics#e5885956fd49bafa968f85976b153b341a473389" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "draw_state 0.0.7 (git+https://github.com/gfx-rs/draw_state)", - "interpolation 0.0.5 (git+https://github.com/PistonDevelopers/interpolation)", - "piston-texture 0.0.1 (git+https://github.com/pistondevelopers/texture)", - "piston-viewport 0.0.2 (git+https://github.com/pistondevelopers/viewport)", - "read_color 0.0.2 (git+https://github.com/PistonDevelopers/read_color)", - "vecmath 0.0.22 (git+https://github.com/PistonDevelopers/vecmath)", + "draw_state 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "interpolation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-texture 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-viewport 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "read_color 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "vecmath 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "piston2d-opengl_graphics" -version = "0.0.16" -source = "git+https://github.com/pistondevelopers/opengl_graphics#c5d22694c53d58290b9e58e3411053d39250da89" +version = "0.22.0" +source = "git+https://github.com/PistonDevelopers/opengl_graphics.git#34cd83d798d55beed0e9696c2b6b7343ae532b79" dependencies = [ - "freetype-rs 0.0.9 (git+https://github.com/PistonDevelopers/freetype-rs.git)", - "gl 0.0.12 (git+https://github.com/bjz/gl-rs)", - "image 0.3.9 (git+https://github.com/pistondevelopers/image)", - "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "piston-shaders_graphics2d 0.0.0 (git+https://github.com/pistondevelopers/shaders)", - "piston-texture 0.0.1 (git+https://github.com/pistondevelopers/texture)", - "piston2d-graphics 0.0.46 (git+https://github.com/pistondevelopers/graphics)", - "shader_version 0.0.6 (git+https://github.com/pistondevelopers/shader_version)", + "freetype-rs 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gl 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "image 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "khronos_api 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-shaders_graphics2d 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-texture 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston2d-graphics 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "shader_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "pistoncore-event" -version = "0.1.3" -source = "git+https://github.com/pistondevelopers/event#c51e721f4b346fe7cc8a4c0e2658a70d257202ce" +name = "piston_window" +version = "0.33.0" +source = "git+https://github.com/pistondevelopers/piston_window#2174a533308b793f6936a5dd78f0218149c6f73f" dependencies = [ - "pistoncore-event_loop 0.1.5 (git+https://github.com/PistonDevelopers/event_loop)", - "pistoncore-input 0.0.9 (git+https://github.com/pistondevelopers/input)", - "pistoncore-window 0.1.2 (git+https://github.com/pistondevelopers/window)", + "gfx 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_device_gl 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston2d-gfx_graphics 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston2d-graphics 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-glutin_window 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "shader_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pistoncore-event_loop" -version = "0.1.5" -source = "git+https://github.com/PistonDevelopers/event_loop#d7541e44e33016b0584579e800879120cf982639" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "clock_ticks 0.0.5 (git+https://github.com/tomaka/clock_ticks)", - "piston-viewport 0.0.2 (git+https://github.com/pistondevelopers/viewport)", - "pistoncore-window 0.1.2 (git+https://github.com/pistondevelopers/window)", + "piston-viewport 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-input 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-window 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pistoncore-glutin_window" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-input 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-window 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "shader_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pistoncore-input" -version = "0.0.9" -source = "git+https://github.com/pistondevelopers/input#cb0615041f0dd1e4cd1cfc6d4e0e4bae0a575a8e" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-viewport 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pistoncore-sdl2_window" -version = "0.0.13" -source = "git+https://github.com/pistondevelopers/sdl2_window#d9dd95cadd5c8de09ddb163812761738b999b3f4" +version = "0.23.0" +source = "git+https://github.com/pistondevelopers/sdl2_window#e2fbd22dbd9ba03a5c33a276b134a92bb318dff9" dependencies = [ - "gl 0.0.12 (git+https://github.com/bjz/gl-rs)", - "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "piston 0.1.1 (git+https://github.com/pistondevelopers/piston)", - "sdl2 0.2.3 (git+https://github.com/AngryLawyer/rust-sdl2)", - "shader_version 0.0.6 (git+https://github.com/pistondevelopers/shader_version)", + "gl 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-input 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pistoncore-window 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sdl2 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "shader_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pistoncore-window" -version = "0.1.2" -source = "git+https://github.com/pistondevelopers/window#73314c130ce0b8fc22e47fc636a4724b6e02a365" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "pistoncore-input 0.0.9 (git+https://github.com/pistondevelopers/input)", + "pistoncore-input 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "shader_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "rand" -version = "0.3.8" +name = "png" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "inflate 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "read_color" -version = "0.0.2" -source = "git+https://github.com/PistonDevelopers/read_color#568723fb7d9a69833e1d5a5ec79ded8ce9562920" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-serialize" -version = "0.3.14" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sdl2" -version = "0.2.3" -source = "git+https://github.com/AngryLawyer/rust-sdl2#f270e9879cd91324a3adc7c0367971e7cda27b9c" +version = "0.13.0" +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.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "sdl2-sys 0.2.2 (git+https://github.com/AngryLawyer/rust-sdl2)", + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "sdl2-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sdl2-sys" -version = "0.2.2" -source = "git+https://github.com/AngryLawyer/rust-sdl2#f270e9879cd91324a3adc7c0367971e7cda27b9c" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "shader_version" -version = "0.0.6" -source = "git+https://github.com/pistondevelopers/shader_version#14aa73be33b6d23d6b3cb27f94426545372df287" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "shared_library" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "shell32-sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempdir" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempfile" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "user32-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "vecmath" -version = "0.0.22" -source = "git+https://github.com/PistonDevelopers/vecmath#d6bb5cf609b51cae8f296945e179bd42a74c9a51" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "piston-float 0.0.1 (git+https://github.com/pistondevelopers/float)", + "piston-float 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-client" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "dlib 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-kbd" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "dlib 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "mmap 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-scanner" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "xml-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-sys" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dlib 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-window" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "x11-dl" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dylib 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "xml-rs" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xml-rs" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index e25007b..96c8e61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,14 +13,12 @@ path = "src/main.rs" rustc-serialize = "0.3" rand = "0.3.7" -[dependencies.piston2d-graphics] -git = "https://github.com/pistondevelopers/graphics" - -[dependencies.piston] -git = "https://github.com/pistondevelopers/piston" +[dependencies.piston_window] +git = "https://github.com/pistondevelopers/piston_window" [dependencies.piston2d-opengl_graphics] -git = "https://github.com/pistondevelopers/opengl_graphics" +git = "https://github.com/PistonDevelopers/opengl_graphics.git" [dependencies.pistoncore-sdl2_window] git = "https://github.com/pistondevelopers/sdl2_window" + diff --git a/src/app.rs b/src/app.rs index eaac62e..a42d284 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,22 +1,20 @@ use std::path::{ Path, PathBuf }; -use graphics::*; -use piston::input::Button; -use piston::event::*; - +use piston_window::*; +use opengl_graphics::GlGraphics; +use opengl_graphics::Texture as GlTexture; use board::Board; use number_renderer::NumberRenderer; use settings::Settings; -use opengl_graphics::{ GlGraphics, Texture }; pub struct App<'a> { board: Board<'a>, number_renderer: Option, settings: &'a Settings, - logo: Option, - comment1: Option, - comment2: Option, + logo: Option, + comment1: Option, + comment2: Option, window_background_color: [f32; 4], } @@ -36,10 +34,8 @@ impl<'a> App<'a> { } } - fn render_ui(&self, c: &Context, gl: &mut GlGraphics) { - use graphics::*; - - Image::new_colored(rgb2rgba(self.settings.text_dark_color)) + fn render_ui(&self, c: &Context, gl: &mut GlGraphics) { + Image::new_color(rgb2rgba(self.settings.text_dark_color)) .draw(self.logo.iter().next().unwrap(), default_draw_state(), c.trans(self.settings.board_padding,self.settings.board_padding).transform, @@ -59,12 +55,12 @@ impl<'a> App<'a> { App::render_comment(self.settings, comment2, comment2_offset_y, c, gl); } - fn render_comment(settings: &Settings, comment: &Texture, y: f64, c: &Context, gl: &mut GlGraphics) { + fn render_comment(settings: &Settings, comment: &GlTexture, y: f64, c: &Context, gl: &mut GlGraphics) { let (width, height) = comment.get_size(); let w = settings.window_size[0] as f64 - 2.0 * settings.board_padding; let h = height as f64 * w / width as f64; - Image::new_colored(rgb2rgba(settings.text_dark_color)) + Image::new_color(rgb2rgba(settings.text_dark_color)) .rect([settings.board_padding, y, w, h]) .draw( comment, default_draw_state(), @@ -84,13 +80,13 @@ impl<'a> App<'a> { comment2_path.push(Path::new("comment2.png")); self.number_renderer = Some(NumberRenderer::new()); - self.logo = Some(Texture::from_path(&logo_path).unwrap()); - self.comment1 = Some(Texture::from_path(&comment1_path).unwrap()); - self.comment2 = Some(Texture::from_path(&comment2_path).unwrap()); + self.logo = Some(GlTexture::from_path(&logo_path).unwrap()); + self.comment1 = Some(GlTexture::from_path(&comment1_path).unwrap()); + self.comment2 = Some(GlTexture::from_path(&comment2_path).unwrap()); } pub fn render(&mut self, args: &RenderArgs, gl: &mut GlGraphics) { - let ref c = Context::abs(args.width as f64, args.height as f64); + let ref c = Context::new_abs(args.width as f64, args.height as f64); let w_bg_col = self.window_background_color; let ref nr = self.number_renderer; @@ -108,9 +104,9 @@ impl<'a> App<'a> { } pub fn key_press(&mut self, args: &Button) { - use piston::input::Button::Keyboard; - use piston::input::keyboard::Key; - + use piston_window::Button::Keyboard; + use piston_window::Key; + if *args == Keyboard(Key::Left) { self.board.merge_from_right_to_left(); } diff --git a/src/board.rs b/src/board.rs index 9bd3534..e36fe87 100644 --- a/src/board.rs +++ b/src/board.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; use rand::random; -use graphics::*; -use opengl_graphics::{ GlGraphics }; +use piston_window::*; +use opengl_graphics::GlGraphics; use number_renderer::NumberRenderer; use settings::Settings; use tile::{ Tile, TileState }; diff --git a/src/main.rs b/src/main.rs index 6a005cd..4591c8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,11 @@ extern crate rustc_serialize; extern crate rand; - -extern crate graphics; -extern crate piston; +extern crate piston_window; extern crate opengl_graphics; extern crate sdl2_window; -use piston::event::*; -use piston::window::{ WindowSettings, Size }; +use piston_window::*; use sdl2_window::Sdl2Window; -use opengl_graphics::{ GlGraphics, OpenGL }; mod app; mod board; @@ -18,25 +14,26 @@ mod settings; mod tile; fn main() { + use opengl_graphics::GlGraphics; let settings = settings::Settings::load(); - let window = Sdl2Window::new( - OpenGL::_3_2, - WindowSettings::new( - "Rust-2048".to_string(), - Size { width: settings.window_size[0], height: settings.window_size[1] }) + let (width, height) = (settings.window_size[0], + settings.window_size[1]); + + let window: PistonWindow<(), Sdl2Window> = + WindowSettings::new("Rust-2048", [width, height]) .exit_on_esc(true) - ); + .opengl(OpenGL::V3_2) + .build() + .unwrap_or_else(|e| { panic!("Failed to build PistonWindow: {}", e) }); let mut app = app::App::new(&settings); app.load(); - let mut gl = GlGraphics::new(OpenGL::_3_2); + let mut gl = GlGraphics::new(OpenGL::V3_2); for e in window.events() { - use piston::event::{ RenderEvent, PressEvent }; - if let Some(ref args) = e.render_args() { app.render(args, &mut gl); } diff --git a/src/number_renderer.rs b/src/number_renderer.rs index 15089eb..7c0324c 100644 --- a/src/number_renderer.rs +++ b/src/number_renderer.rs @@ -1,18 +1,19 @@ use std::path::Path; -use graphics::*; -use opengl_graphics::{ GlGraphics, Texture }; +use piston_window::*; +use opengl_graphics::GlGraphics; +use opengl_graphics::Texture as GlTexture; static DIGITS_WIDTH: f64 = 20.0; static DIGITS_HEIGHT: f64 = 26.0; pub struct NumberRenderer { - image: Texture, + image: GlTexture, } impl NumberRenderer { pub fn new() -> NumberRenderer { NumberRenderer { - image: Texture::from_path(Path::new("bin/assets/digits.png")).unwrap(), + image: GlTexture::from_path(Path::new("bin/assets/digits.png")).unwrap(), } } @@ -31,7 +32,7 @@ impl NumberRenderer { let y = center_y - height / 2.0; for digit in digits.iter() { - Image::new_colored([color[0], color[1], color[2], 1.0]) + Image::new_color([color[0], color[1], color[2], 1.0]) .src_rect([(*digit * DIGITS_WIDTH as u32) as i32, 0, DIGITS_WIDTH as i32, DIGITS_HEIGHT as i32]) .rect([x, y, width, height]) .draw(&self.image, diff --git a/src/tile.rs b/src/tile.rs index eeaa609..3878a25 100644 --- a/src/tile.rs +++ b/src/tile.rs @@ -1,4 +1,4 @@ -use graphics::*; +use piston_window::*; use opengl_graphics::GlGraphics; use number_renderer::NumberRenderer; use settings::Settings;