Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Bevy 0.11 #14

Closed
wants to merge 3 commits into from
Closed

Conversation

DaylightNebula
Copy link

I have found this library very useful with Bevy 0.10, however, Bevy 0.11 was just released. So here is my solution to update to Bevy 0.11 following the migration guide.

@sparten11740
Copy link
Owner

thanks for your work - I was also meaning to get to this but discovered a bug in the multi-bar scenario where only the bar would get updated that had its plugin registered first. I first thought this had something to do with the bevy upgrade but it's also present in 0.10. I will merge #15 so this lib is available for 0.11.0 and maybe we can continue with the web fixes here

Comment on lines +83 to +91
impl TypePath for BarMaterial {
fn type_path() -> &'static str {
"bevy_health_bar3d::BarMaterial"
}

fn short_type_path() -> &'static str {
"bevy_health_bar3d::BarMaterial"
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be derived either indirectly by deriving Reflect or directly by deriving TypePath. The short type path of the derived version would return BarMaterial and the full path bevy_health_bar3d::material::BarMaterial

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is my bad. I forgot I could do that when I saw that TypePath was now required in 0.11.

@@ -22,18 +23,18 @@ impl<T: Percentage + Component> Default for HealthBarPlugin<T> {
}
}

impl<T: Percentage + Component> Plugin for HealthBarPlugin<T> {
impl<T: Percentage + Component + TypePath> Plugin for HealthBarPlugin<T> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to avoid adding this constraint on T (which I did in my PR). Disadvantage is that the registered types have to go for now. I am hoping for a solution on the bevy side that allows falling back to std::any::type_name

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that to fix a compilation error that occurs in the register_type calls before that say type path is required to register BarWidth or BarOffset.

value: percentage.value(),
// settings: Vec4 { x: percentage.value(), y: border_width, z: width, w: height },
// settings: Vec4(percentage.value(), border_width, width, height),
settings: (percentage.value(), border.width, width, height).into(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of these are settings of sorts. maybe a little arbitrary to pack these 4 in a vector. why is that needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I tried to run a game using this on the web. I was getting the error mentioned here. My fix was to make everything 16 byte aligned by converting all of the shaders inputs to vec4's.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IC, makes sense. web wasn't on my radar, thanks for bringing it to my attention. I ported part of your fix to #17

@sparten11740
Copy link
Owner

mind closing here as this is supported upstream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants