fix dynamic plugin example

This commit is contained in:
Carter Anderson 2020-04-24 18:23:37 -07:00
parent 65d072fc6a
commit 057ad97a46
4 changed files with 6 additions and 6 deletions

View File

@ -47,6 +47,7 @@ glam = "0.8.6"
[workspace] [workspace]
members = [ members = [
"crates/*", "crates/*",
"examples/dynamic_plugin_loading/example_plugin"
] ]
[dev-dependencies] [dev-dependencies]

View File

@ -476,7 +476,7 @@ pub fn derive_app_plugin(input: TokenStream) -> TokenStream {
TokenStream::from(quote! { TokenStream::from(quote! {
#[no_mangle] #[no_mangle]
pub extern "C" fn _create_plugin() -> *mut bevy::app::plugin::AppPlugin { pub extern "C" fn _create_plugin() -> *mut bevy::app::AppPlugin {
// TODO: without this the assembly does nothing. why is that the case? // TODO: without this the assembly does nothing. why is that the case?
print!(""); print!("");
// make sure the constructor is the correct type. // make sure the constructor is the correct type.

View File

@ -4,8 +4,8 @@ use bevy::prelude::*;
pub struct ExamplePlugin; pub struct ExamplePlugin;
impl AppPlugin for ExamplePlugin { impl AppPlugin for ExamplePlugin {
fn build(&self, app_builder: AppBuilder) -> AppBuilder { fn build(&self, app_builder: &mut AppBuilder) {
app_builder.setup(setup) app_builder.add_startup_system(setup);
} }
} }
@ -40,6 +40,5 @@ pub fn setup(world: &mut World, resources: &mut Resources) {
Vec3::new(0.0, 0.0, 1.0), Vec3::new(0.0, 0.0, 1.0),
)), )),
..Default::default() ..Default::default()
}) });
.build();
} }

View File

@ -5,7 +5,7 @@ fn main() {
.add_default_plugins() .add_default_plugins()
.load_plugin(concat!( .load_plugin(concat!(
env!("CARGO_MANIFEST_DIR"), env!("CARGO_MANIFEST_DIR"),
"/examples/dynamic_plugin_loading/example_plugin/target/release/libexample_plugin.so" "/target/debug/libexample_plugin.so"
)) ))
.run(); .run();
} }