From a46c2b0d84249ef278b37e5b975ebfef91622696 Mon Sep 17 00:00:00 2001 From: Layl Conway Date: Tue, 26 May 2015 03:54:50 +0200 Subject: [PATCH 1/5] Use crates.io dependencies --- Cargo.lock | 76 +++++++++++++++++++++++++----------------------------- Cargo.toml | 18 ++++--------- 2 files changed, 40 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be15cf2..c3d10ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,10 +2,10 @@ name = "athena_editor" version = "0.1.0" dependencies = [ - "gfx 0.5.2 (git+https://github.com/gfx-rs/gfx-rs)", - "gfx_device_gl 0.3.1 (git+https://github.com/gfx-rs/gfx_device_gl)", - "gfx_window_glutin 0.1.1 (git+https://github.com/gfx-rs/gfx_window_glutin)", - "glutin 0.1.6 (git+https://github.com/tomaka/glutin)", + "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_device_gl 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_window_glutin 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "phosphorus 0.0.1 (git+https://github.com/athena-org/phosphorus.git?branch=develop)", "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -28,7 +28,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cgmath" version = "0.2.0" -source = "git+https://github.com/bjz/cgmath-rs#aebe5fd9bfb2daa468754a19a1eac02aa8f959e8" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "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)", @@ -38,7 +38,7 @@ dependencies = [ [[package]] name = "draw_state" version = "0.0.7" -source = "git+https://github.com/gfx-rs/draw_state#44a0aed11abccbf970fc7efbe84b6482f0548248" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -61,8 +61,8 @@ dependencies = [ [[package]] name = "freetype-rs" -version = "0.0.9" -source = "git+https://github.com/PistonDevelopers/freetype-rs#686a4d7ff99eddfc64fbe7d2c3a19832ee564614" +version = "0.0.10" +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)", @@ -90,10 +90,10 @@ dependencies = [ [[package]] name = "gfx" version = "0.5.2" -source = "git+https://github.com/gfx-rs/gfx-rs#876ee8aa69524c6e81656fec0a20a4fe16b129ee" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "draw_state 0.0.7 (git+https://github.com/gfx-rs/draw_state)", + "draw_state 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "gfx_device_gl" version = "0.3.1" -source = "git+https://github.com/gfx-rs/gfx_device_gl#4e6b7dc048650316c64af4ab79579686e58e4024" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gfx 0.5.2 (git+https://github.com/gfx-rs/gfx-rs)", + "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_gl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -123,21 +123,21 @@ dependencies = [ [[package]] name = "gfx_text" version = "0.0.0" -source = "git+https://github.com/PistonDevelopers/gfx_text#00c2a2a5b9ae429f7e74ea16c91f67e4386037eb" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "freetype-rs 0.0.9 (git+https://github.com/PistonDevelopers/freetype-rs)", - "gfx 0.5.2 (git+https://github.com/gfx-rs/gfx-rs)", + "freetype-rs 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx_window_glutin" version = "0.1.1" -source = "git+https://github.com/gfx-rs/gfx_window_glutin#be7f4331b5b299b2d8e6074efeae16704db18fae" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gfx 0.5.2 (git+https://github.com/gfx-rs/gfx-rs)", - "gfx_device_gl 0.3.1 (git+https://github.com/gfx-rs/gfx_device_gl)", - "glutin 0.1.6 (git+https://github.com/tomaka/glutin)", + "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_device_gl 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -161,7 +161,7 @@ dependencies = [ [[package]] name = "glutin" version = "0.1.6" -source = "git+https://github.com/tomaka/glutin#e5f888e19a0396b62c2e2a776ddc86652792defb" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -178,7 +178,7 @@ dependencies = [ "osmesa-sys 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "shared_library 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "user32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wayland-client 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-kbd 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "x11-dl 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -213,19 +213,14 @@ dependencies = [ [[package]] name = "image" -version = "0.3.9" -source = "git+https://github.com/PistonDevelopers/image#75f9b791d6b030bc975ec737e9a2d78de39331af" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 0.3.10 (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)", ] -[[package]] -name = "jade" -version = "0.0.1" -source = "git+https://github.com/athena-org/jade-rs?branch=develop#4f255255873f4b4559df43936b551c81e3f22964" - [[package]] name = "kernel32-sys" version = "0.1.0" @@ -313,29 +308,28 @@ dependencies = [ [[package]] name = "phosphorus" version = "0.0.1" -source = "git+https://github.com/athena-org/phosphorus.git?branch=develop#53e6df76cc30c6f01c0520a2252e595653b0da80" +source = "git+https://github.com/athena-org/phosphorus.git?branch=develop#85c764abbe5bd28a53d5a0a083ea365362bce777" dependencies = [ - "cgmath 0.2.0 (git+https://github.com/bjz/cgmath-rs)", - "gfx 0.5.2 (git+https://github.com/gfx-rs/gfx-rs)", - "gfx_text 0.0.0 (git+https://github.com/PistonDevelopers/gfx_text)", - "jade 0.0.1 (git+https://github.com/athena-org/jade-rs?branch=develop)", - "piston-gfx_texture 0.0.6 (git+https://github.com/PistonDevelopers/gfx_texture)", + "cgmath 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_text 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-gfx_texture 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "piston-gfx_texture" version = "0.0.6" -source = "git+https://github.com/PistonDevelopers/gfx_texture#910fc5fedd52291c01c29196ba67f02e92b317ce" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gfx 0.5.2 (git+https://github.com/gfx-rs/gfx-rs)", - "image 0.3.9 (git+https://github.com/PistonDevelopers/image)", - "piston-texture 0.0.1 (git+https://github.com/PistonDevelopers/texture)", + "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "image 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-texture 0.0.1 (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" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" @@ -383,7 +377,7 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -400,7 +394,7 @@ dependencies = [ "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (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.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8a80014..c89cfa1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,20 +5,12 @@ authors = ["The Athena Developers"] license = "Apache-2.0" [dependencies] -rustc-serialize = "*" +glutin = "0.1.6" +gfx = "0.5.2" +gfx_device_gl = "0.3.1" +gfx_window_glutin = "0.1.1" +rustc-serialize = "0.3.14" [dependencies.phosphorus] git = "https://github.com/athena-org/phosphorus.git" branch = "develop" - -[dependencies.gfx] -git = "https://github.com/gfx-rs/gfx-rs" - -[dependencies.gfx_device_gl] -git = "https://github.com/gfx-rs/gfx_device_gl" - -[dependencies.gfx_window_glutin] -git = "https://github.com/gfx-rs/gfx_window_glutin" - -[dependencies.glutin] -git = "https://github.com/tomaka/glutin" From ddafb967980b8084e474e159208897d7413d3318 Mon Sep 17 00:00:00 2001 From: Layl Conway Date: Tue, 9 Jun 2015 15:44:20 +0200 Subject: [PATCH 2/5] Slightly improve error reporting on failure to open --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 04c1cf2..f5d64e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -92,7 +92,10 @@ fn main() { } fn save_model(proj_path: &PathBuf, model: &Model){ - let mut file = File::create(proj_path).unwrap(); + let mut file = match File::create(proj_path) { + Ok(f) => f, + Err(e) => panic!(format!("Folder does not exist or is not accessable, error: {:?}", e)) + }; file.write_all(&json::encode(&model).unwrap().as_bytes()).unwrap(); } From 48b97513ba1c77a42fb75abb26c228693d375e70 Mon Sep 17 00:00:00 2001 From: Layl Conway Date: Tue, 16 Jun 2015 00:16:45 +0200 Subject: [PATCH 3/5] Add position to entities --- Cargo.lock | 147 +++++++++++++++++++++++++++++++--------------------- Cargo.toml | 6 +-- src/main.rs | 46 ++++++++++------ 3 files changed, 121 insertions(+), 78 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3d10ba..45985ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,12 @@ name = "athena_editor" version = "0.1.0" dependencies = [ - "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx_device_gl 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx_window_glutin 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_device_gl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_window_glutin 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "phosphorus 0.0.1 (git+https://github.com/athena-org/phosphorus.git?branch=develop)", - "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -20,6 +20,11 @@ name = "bitflags" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bitflags" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "0.3.10" @@ -30,17 +35,22 @@ name = "cgmath" version = "0.2.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.25 (registry+https://github.com/rust-lang/crates.io-index)", "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)", + "rustc-serialize 0.3.15 (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 = "draw_state" -version = "0.0.7" +version = "0.1.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)", + "bitflags 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -56,54 +66,54 @@ name = "enum_primitive" version = "0.0.1" 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.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "freetype-rs" -version = "0.0.10" +version = "0.1.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)", - "freetype-sys 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "freetype-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "freetype-sys" -version = "0.0.5" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdi32-sys" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx" -version = "0.5.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "draw_state 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "draw_state 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "num 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx_device_gl" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_gl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -122,24 +132,32 @@ dependencies = [ [[package]] name = "gfx_text" -version = "0.0.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "freetype-rs 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "freetype-rs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gfx_window_glutin" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx_device_gl 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_device_gl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "gif" +version = "0.5.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.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "gl_common" version = "0.0.4" @@ -158,21 +176,26 @@ dependencies = [ "xml-rs 0.1.25 (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.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gdi32-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.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin_cocoa 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_cocoa 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_core_foundation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_core_graphics 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "osmesa-sys 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -180,13 +203,13 @@ dependencies = [ "user32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-kbd 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "x11-dl 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glutin_cocoa" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -213,20 +236,23 @@ dependencies = [ [[package]] name = "image" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 0.3.10 (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)", + "gif 0.5.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.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -236,7 +262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -246,7 +272,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libz-sys" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -261,6 +287,11 @@ dependencies = [ "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lzw" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "malloc_buf" version = "0.0.5" @@ -280,11 +311,11 @@ dependencies = [ [[package]] name = "num" -version = "0.1.24" +version = "0.1.25" 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)", + "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -308,27 +339,27 @@ dependencies = [ [[package]] name = "phosphorus" version = "0.0.1" -source = "git+https://github.com/athena-org/phosphorus.git?branch=develop#85c764abbe5bd28a53d5a0a083ea365362bce777" +source = "git+https://github.com/athena-org/phosphorus.git?branch=develop#d8956d906068e5ccaccc68431880f2299ab81c15" dependencies = [ "cgmath 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gfx_text 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "piston-gfx_texture 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_text 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-gfx_texture 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "piston-gfx_texture" -version = "0.0.6" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gfx 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "image 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", - "piston-texture 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "image 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "piston-texture 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "piston-texture" -version = "0.0.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -346,7 +377,7 @@ dependencies = [ [[package]] name = "rustc-serialize" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -354,7 +385,7 @@ name = "shared_library" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -371,7 +402,7 @@ name = "user32-sys" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-build 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -381,7 +412,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -391,7 +422,7 @@ version = "0.1.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)", - "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (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.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -399,7 +430,7 @@ dependencies = [ [[package]] name = "winapi" -version = "0.1.18" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -424,6 +455,6 @@ name = "xml-rs" version = "0.1.25" 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.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index c89cfa1..b146a76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,9 @@ license = "Apache-2.0" [dependencies] glutin = "0.1.6" -gfx = "0.5.2" -gfx_device_gl = "0.3.1" -gfx_window_glutin = "0.1.1" +gfx = "0.6.4" +gfx_device_gl = "0.4.0" +gfx_window_glutin = "0.2.0" rustc-serialize = "0.3.14" [dependencies.phosphorus] diff --git a/src/main.rs b/src/main.rs index f5d64e0..5639015 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,7 +38,10 @@ struct SharedData { } #[derive(RustcDecodable, RustcEncodable, Clone)] -struct EntityEntry; +struct EntityEntry { + x: f32, + y: f32 +} #[derive(RustcDecodable, RustcEncodable, Clone)] struct WorldModel { @@ -62,20 +65,25 @@ fn main() { } }; + // Make sure it's a zeus project + let mut toml_path = PathBuf::from(path.clone()); + toml_path.push("Zeus.toml"); + if !toml_path.exists() { display_error("Not a zeus project!"); return; } + // Get the actual path of the data file - let mut path = PathBuf::from(path); - path.push("editor.json"); + let mut editor_path = PathBuf::from(path); + editor_path.push("editor.json"); - let model = Rc::new(RefCell::new(if !path.exists() { + let model = Rc::new(RefCell::new(if !editor_path.exists() { println!("Creating new editor.json..."); let model = Model { worlds: vec![] }; - save_model(&path, &model); + save_model(&editor_path, &model); model } else { println!("Loading in editor.json..."); - let mut file = File::open(path.clone()).unwrap(); + let mut file = File::open(editor_path.clone()).unwrap(); let mut file_data = String::new(); file.read_to_string(&mut file_data).unwrap(); @@ -84,7 +92,7 @@ fn main() { // Set up our Phosphorus UI let data = Rc::new(RefCell::new(SharedData { canceled: false, queued_layout: None })); - let layout = generate_view(path, data.clone(), model); + let layout = generate_view(editor_path, data.clone(), model); data.borrow_mut().queued_layout = Some(layout); @@ -100,11 +108,13 @@ fn save_model(proj_path: &PathBuf, model: &Model){ } fn generate_view(proj_path: PathBuf, data: Rc>, model: Rc>) -> Layout { + // Save our model before generating so the file's always up-to-date with what's visible save_model(&proj_path, &model.borrow()); let mut builder = LayoutBuilder::::new() .with_background_color([21, 23, 24]); + // Show all of our worlds let mut wnum = 0; for world in &model.borrow_mut().worlds { builder = builder @@ -112,15 +122,18 @@ fn generate_view(proj_path: PathBuf, data: Rc>, model: Rc>, model: Rc>, model: Rc>, model: Rc>) gfx_window_glutin::init(window) }; - let mut gui = Gui::new( - &mut device, - data.borrow_mut().queued_layout.take().unwrap(), - |d: &mut gfx_device_gl::Device| d.spawn_factory()); + let mut gui = Gui::new(&mut device, &mut factory, data.borrow_mut().queued_layout.take().unwrap()); // Run our actual UI loop 'main: loop { From c4445a9a82eda66965dbbecf5dc963c2bb8abf4e Mon Sep 17 00:00:00 2001 From: Layl Conway Date: Tue, 16 Jun 2015 00:57:13 +0200 Subject: [PATCH 4/5] Add editor buttons for position --- src/main.rs | 99 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 88 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5639015..074962f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,16 +40,18 @@ struct SharedData { #[derive(RustcDecodable, RustcEncodable, Clone)] struct EntityEntry { x: f32, - y: f32 + y: f32, + z: f32 } #[derive(RustcDecodable, RustcEncodable, Clone)] struct WorldModel { - entities: Vec + entities: Vec>> } #[derive(RustcDecodable, RustcEncodable, Clone)] struct Model { + current_entity: Option>>, worlds: Vec } @@ -76,7 +78,7 @@ fn main() { let model = Rc::new(RefCell::new(if !editor_path.exists() { println!("Creating new editor.json..."); - let model = Model { worlds: vec![] }; + let model = Model { current_entity: None, worlds: vec![] }; save_model(&editor_path, &model); @@ -89,6 +91,7 @@ fn main() { json::decode::(&file_data).unwrap() })); + model.borrow_mut().current_entity = None; // Set up our Phosphorus UI let data = Rc::new(RefCell::new(SharedData { canceled: false, queued_layout: None })); @@ -124,11 +127,25 @@ fn generate_view(proj_path: PathBuf, data: Rc>, model: Rc>, model: Rc>, model: Rc, + path: &PathBuf, data: &Rc>, model: &Rc>, rc_entity: &Rc>, + text: &'static str, adder: Box) + -> LayoutBuilder +{ + let tmp_model = model.clone(); + let tmp_data = data.clone(); + let tmp_path = path.clone(); + let tmp_entity = rc_entity.clone(); + builder = builder + .with_widget(ButtonBuilder::new() + .with_text(text) + .with_callback(Box::new(move || { + { + let mut entity = tmp_entity.borrow_mut(); + adder(&mut entity); + } + + tmp_data.borrow_mut().queued_layout = Some(generate_view(tmp_path.clone(), tmp_data.clone(), tmp_model.clone())); + })) + .build_boxed() + ); + + builder +} + fn display_error(text: &str) { let data = Rc::new(RefCell::new(SharedData { canceled: false, queued_layout: None })); let data_clone = data.clone(); @@ -199,7 +276,7 @@ fn display_gui(data: Rc>) let window = glutin::WindowBuilder::new() .with_vsync() .with_dimensions(600, 500) - .with_title(String::from("Phosphorus Widgets")) + .with_title(String::from("Athena Editor")) .build_strict().unwrap(); gfx_window_glutin::init(window) }; From 664d49139545b62e7a4e8b31e0a89bce01080c42 Mon Sep 17 00:00:00 2001 From: Layl Conway Date: Tue, 16 Jun 2015 13:57:26 +0200 Subject: [PATCH 5/5] Bump version to 0.1.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b146a76..701c59f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "athena_editor" -version = "0.1.0" +version = "0.1.1" authors = ["The Athena Developers"] license = "Apache-2.0"