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]
members = [
"crates/*",
"examples/dynamic_plugin_loading/example_plugin"
]
[dev-dependencies]

View file

@ -476,7 +476,7 @@ pub fn derive_app_plugin(input: TokenStream) -> TokenStream {
TokenStream::from(quote! {
#[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?
print!("");
// make sure the constructor is the correct type.

View file

@ -4,8 +4,8 @@ use bevy::prelude::*;
pub struct ExamplePlugin;
impl AppPlugin for ExamplePlugin {
fn build(&self, app_builder: AppBuilder) -> AppBuilder {
app_builder.setup(setup)
fn build(&self, app_builder: &mut AppBuilder) {
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),
)),
..Default::default()
})
.build();
});
}

View file

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