From e1ba5ff36cefd602e64210dcfd0c4076c871e38c Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Mon, 26 Feb 2018 19:22:18 +0200 Subject: Early commit: both desktop and wasm support --- .gitignore | 3 +- Cargo.lock | 85 ++------------------------------------------------- Cargo.toml | 8 ++--- Makefile | 19 ++++++++++++ assets/sprites.atlas | Bin 18 -> 18 bytes assets/sprites.png | Bin 6445 -> 6394 bytes src/main.rs | 6 ++-- 7 files changed, 27 insertions(+), 94 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 0196246..4ef4e0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ - /target/ +/html/ **/*.rs.bk + diff --git a/Cargo.lock b/Cargo.lock index f3e3515..36eefb5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,10 +30,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "bug_basher" version = "0.1.0" dependencies = [ - "gate 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gate_build 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "vorbis 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gate 0.2.1", + "gate_build 0.2.1", ] [[package]] @@ -99,7 +97,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "gate" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "gl 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -110,7 +107,6 @@ dependencies = [ [[package]] name = "gate_build" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -118,11 +114,6 @@ dependencies = [ "regex 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "gcc" -version = "0.3.54" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "gif" version = "0.9.2" @@ -286,21 +277,6 @@ dependencies = [ "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ogg-sys" -version = "0.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pkg-config" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "png" version = "0.9.0" @@ -427,54 +403,6 @@ name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "vorbis" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "vorbis-encoder 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "vorbisfile-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "vorbis-encoder" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "vorbis-sys" -version = "0.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "vorbisfile-sys" -version = "0.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "winapi" version = "0.3.4" @@ -517,9 +445,6 @@ dependencies = [ "checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum gate 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8405fdc6964dba329bfb3f6c428162f9c5cd3423c1c16479005e481ed7aa5347" -"checksum gate_build 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c18d12a2c1059d163ce143fea0f72d65b830e29316ff42a8d39330721aad2e7a" -"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" "checksum gif 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e41945ba23db3bf51b24756d73d81acb4f28d85c3dccc32c6fae904438c25f" "checksum gl 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1c73b90c285f02059b34a6c66bc645ba5faa18c0e3ab332e0725654fc71db441" "checksum gl_generator 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "75d69f914b49d9ff32fdf394cbd798f8c716d74fd19f9cc29da3e99797b2a78d" @@ -541,8 +466,6 @@ dependencies = [ "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e7de20f146db9d920c45ee8ed8f71681fd9ade71909b48c3acbd766aa504cf10" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" -"checksum ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a95b8c172e17df1a41bf8d666301d3b2c4efeb90d9d0415e2a4dc0668b35fdb2" -"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum png 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f256476eee4447f55909d52d22a16cfa6e5e55e5cb77fa182c7fcc8c4456ee3c" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" @@ -558,10 +481,6 @@ dependencies = [ "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum vorbis 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "760993e54524128b88d4d7aff09c773c2f16a9f18db3c8ae1ccca5afd1287656" -"checksum vorbis-encoder 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3fb66bcdde056dd230991bb86669a1269778fe8ad1f6cee403428ac7985391bc" -"checksum vorbis-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "729e1f15395850b4e6d19ca0cd1d42ef44707503a53b69d40ff49182b3c5589d" -"checksum vorbisfile-sys 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f4306d7e1ac4699b55e20de9483750b90c250913188efd7484db6bfbe9042d1" "checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 8d65f6e..fa8d4bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,11 +6,7 @@ authors = ["Justin Worthe "] build = "build.rs" [dependencies] -gate = "0.2.1" -ogg-sys = "0.0.9" -vorbis = "0.1.0" +gate = { path = "../gate/gate" } [build-dependencies] -gate_build = "0.2.1" - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] \ No newline at end of file +gate_build = { path = "../gate/gate_build" } diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..30f6f27 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +all: build + +build-web: + cargo +nightly build --target=wasm32-unknown-unknown --release + cp target/wasm32-unknown-unknown/release/bug_basher.wasm html/gate_app.wasm + +build-desktop: + cargo build --release + +build: build-desktop build-web + +test: + cargo test --release + +clean: + cargo clean + + +.PHONY: all build-web build-desktop build test clean diff --git a/assets/sprites.atlas b/assets/sprites.atlas index c4f2007..f82a233 100644 Binary files a/assets/sprites.atlas and b/assets/sprites.atlas differ diff --git a/assets/sprites.png b/assets/sprites.png index c4a1010..5b1e82b 100644 Binary files a/assets/sprites.png and b/assets/sprites.png differ diff --git a/src/main.rs b/src/main.rs index eedf9f4..8d987a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,8 @@ extern crate gate; -extern crate ogg_sys; - use gate::{App, Audio}; use gate::app_info::AppInfo; -use gate::input::{KeyEvent, KeyCode}; +use gate::input::{InputEvent, KeyCode}; use gate::renderer::{Renderer, Affine}; mod asset_id { include!(concat!(env!("OUT_DIR"), "/asset_id.rs")); } @@ -25,7 +23,7 @@ impl App for BugBasherGame { true } - fn input(&mut self, evt: KeyEvent, key: KeyCode, _audio: &mut Audio) -> bool { + fn input(&mut self, evt: InputEvent, _audio: &mut Audio) -> bool { true } -- cgit v1.2.3