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

Img src from image handle not working #49

Closed
Vixeliz opened this issue Mar 4, 2023 · 2 comments
Closed

Img src from image handle not working #49

Vixeliz opened this issue Mar 4, 2023 · 2 comments

Comments

@Vixeliz
Copy link

Vixeliz commented Mar 4, 2023

I tried using a bevy handle for the image src however I get the error

error[E0277]: the trait bound `Variant: From<bevy::prelude::Handle<bevy::prelude::Image>>` is not satisfied
  --> client/src/states/game/setup.rs:45:22
   |
45 |             <img src=crosshair_handle/>
   |                      ^^^^^^^^^^^^^^^^ the trait `From<bevy::prelude::Handle<bevy::prelude::Image>>` is not implemented for `Variant`
   |
   = help: the following other types implement trait `From<T>`:
             <Variant as From<&&str>>
             <Variant as From<&str>>
             <Variant as From<BtnMode>>
             <Variant as From<ImgMode>>
             <Variant as From<JustifyContent>>
             <Variant as From<PropertyValue>>
             <Variant as From<Val>>
             <Variant as From<belly::belly_core::eml::Params>>
           and 7 others
   = note: required for `bevy::prelude::Handle<bevy::prelude::Image>` to implement `Into<Variant>`

this is the code:

    let crosshair_handle: Handle<Image> = asset_server.load("crosshair.png");

    commands.add(eml! {
        <body s:padding="50px" s:position-type="absolute">
            <img src=crosshair_handle/>
        </body>
    });

Based off of the example image-sources.rs i don't see anything im doing wrong. It's worth noting im on git instead of release so i realize that may be the issue. Im on git due to the alsa in the Cargo.toml not fixed in a release yet afaik. Any help would be appreciated. (Im aware i can just pass in a string and itll load the image however it seems to be inconsistent in my use case)

@jkb0o
Copy link
Owner

jkb0o commented Mar 4, 2023

Looks like you use old version of the crate. Try to update the deps:

cargo update -p belly

If this doesn't help share the output of

cargo tree | grep belly

Thank you for the contribution!

@Vixeliz
Copy link
Author

Vixeliz commented Mar 4, 2023

Yep that worked thank you!

@Vixeliz Vixeliz closed this as completed Mar 4, 2023
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

No branches or pull requests

2 participants