Last active
August 15, 2020 18:15
-
-
Save allswellthatsmaxwell/3a797d649b85c93f8e199bac79852a13 to your computer and use it in GitHub Desktop.
bevy tutorial add plugins step
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "game" | |
version = "0.1.0" | |
authors = ["maxwell"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
bevy = "0.1.2" # make sure this is the latest version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::prelude::*; | |
struct Person; | |
struct Name(String); | |
fn hello_world() { | |
println!("hello world!"); | |
} | |
fn add_people(mut commands: Commands) { | |
commands | |
.spawn((Person, Name("Elaina Proctor".to_string()))) | |
.spawn((Person, Name("Renzo Hume".to_string()))) | |
.spawn((Person, Name("Zayna Nieves".to_string()))); | |
} | |
fn greet_people(person: &Person, name: &Name) { | |
println!("hello {}!", name.0); | |
} | |
fn main() { | |
App::build() | |
.add_default_plugins() | |
.add_startup_system(add_people.system()) | |
.add_system(hello_world.system()) | |
.add_system(greet_people.system()) | |
.run(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/programs/game$ env RUST_BACKTRACE=full cargo run | |
warning: unused variable: `person` | |
--> src/main.rs:17:17 | |
| | |
17 | fn greet_people(person: &Person, name: &Name) { | |
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_person` | |
| | |
= note: `#[warn(unused_variables)]` on by default | |
warning: 1 warning emitted | |
Finished dev [unoptimized + debuginfo] target(s) in 0.20s | |
Running `target/debug/game` | |
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/maxwell/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_wgpu-0.1.0/src/wgpu_renderer.rs:22:23 | |
stack backtrace: | |
0: 0x555bd6641fe5 - backtrace::backtrace::libunwind::trace::ha215bbf14e328799 | |
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86 | |
1: 0x555bd6641fe5 - backtrace::backtrace::trace_unsynchronized::h3384b099b135857a | |
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66 | |
2: 0x555bd6641fe5 - std::sys_common::backtrace::_print_fmt::hfec93740f7294682 | |
at src/libstd/sys_common/backtrace.rs:78 | |
3: 0x555bd6641fe5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5fe20777f4174074 | |
at src/libstd/sys_common/backtrace.rs:59 | |
4: 0x555bd666e37c - core::fmt::write::he14c3177144df275 | |
at src/libcore/fmt/mod.rs:1076 | |
5: 0x555bd663e233 - std::io::Write::write_fmt::h8e26323bfab8bcc5 | |
at src/libstd/io/mod.rs:1537 | |
6: 0x555bd6644dc0 - std::sys_common::backtrace::_print::h9cfa4c87526ba064 | |
at src/libstd/sys_common/backtrace.rs:62 | |
7: 0x555bd6644dc0 - std::sys_common::backtrace::print::h94936584848b3272 | |
at src/libstd/sys_common/backtrace.rs:49 | |
8: 0x555bd6644dc0 - std::panicking::default_hook::{{closure}}::h733b20cc9b496e46 | |
at src/libstd/panicking.rs:198 | |
9: 0x555bd6644b0c - std::panicking::default_hook::h556d8cff6c12a651 | |
at src/libstd/panicking.rs:218 | |
10: 0x555bd66453f7 - std::panicking::rust_panic_with_hook::ha0c7ca5b39baa9d5 | |
at src/libstd/panicking.rs:486 | |
11: 0x555bd6644ffb - rust_begin_unwind | |
at src/libstd/panicking.rs:388 | |
12: 0x555bd666c001 - core::panicking::panic_fmt::h106d7128cbbc7cd2 | |
at src/libcore/panicking.rs:101 | |
13: 0x555bd666bf4d - core::panicking::panic::hfe03c118d2519816 | |
at src/libcore/panicking.rs:56 | |
14: 0x555bd54b379f - core::option::Option<T>::unwrap::h44434fcbe4098c48 | |
at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libcore/macros/mod.rs:10 | |
15: 0x555bd546e676 - bevy_wgpu::wgpu_renderer::WgpuRenderer::new::{{closure}}::h4306164a44baab1f | |
at /home/maxwell/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_wgpu-0.1.0/src/wgpu_renderer.rs:22 | |
16: 0x555bd54ce2b4 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h4eba355fd256caa1 | |
at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libcore/future/mod.rs:73 | |
17: 0x555bd5469286 - pollster::block_on::hcaec530150895f97 | |
at /home/maxwell/.cargo/registry/src/github.com-1ecc6299db9ec823/pollster-0.2.0/src/lib.rs:64 | |
18: 0x555bd544204e - bevy_wgpu::wgpu_render_system::h66255b159df9f913 | |
at /home/maxwell/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_wgpu-0.1.0/src/lib.rs:35 | |
19: 0x555bd5441f0a - <bevy_wgpu::WgpuPlugin as bevy_app::plugin::Plugin>::build::h2cbdcb26dfdfdf41 | |
at /home/maxwell/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_wgpu-0.1.0/src/lib.rs:22 | |
20: 0x555bd54357e4 - bevy_app::app_builder::AppBuilder::add_plugin::h227b6619099c1a69 | |
at /home/maxwell/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.1.0/src/app_builder.rs:235 | |
21: 0x555bd54377b5 - <bevy_app::app_builder::AppBuilder as bevy::add_default_plugins::AddDefaultPlugins>::add_default_plugins::h922b97a71f4b1ce3 | |
at /home/maxwell/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy-0.1.2/src/add_default_plugins.rs:33 | |
22: 0x555bd5431771 - game::main::heabd118ce19758c6 | |
at src/main.rs:22 | |
23: 0x555bd542b6db - std::rt::lang_start::{{closure}}::h6d03a314088763ff | |
at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libstd/rt.rs:67 | |
24: 0x555bd6645888 - std::rt::lang_start_internal::{{closure}}::hefb489d56a389b75 | |
at src/libstd/rt.rs:52 | |
25: 0x555bd6645888 - std::panicking::try::do_call::hb2bfa58b743656f1 | |
at src/libstd/panicking.rs:297 | |
26: 0x555bd6645888 - std::panicking::try::haaa85a89ce3784c3 | |
at src/libstd/panicking.rs:274 | |
27: 0x555bd6645888 - std::panic::catch_unwind::h49baa277f74e60cb | |
at src/libstd/panic.rs:394 | |
28: 0x555bd6645888 - std::rt::lang_start_internal::h7aa2f6739b31fe58 | |
at src/libstd/rt.rs:51 | |
29: 0x555bd542b6b7 - std::rt::lang_start::h16175c9b03f4a3e9 | |
at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libstd/rt.rs:67 | |
30: 0x555bd543188a - main | |
31: 0x7f773a7e5b97 - __libc_start_main | |
32: 0x555bd542b42a - _start | |
33: 0x0 - <unknown> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment