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

added iced tour example template #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthieugayon
Copy link

Just the beginning of an iced template for cargo mobile :)
It's based on the tour example https://github.com/hecrj/iced/tree/master/examples/tour
and it's pointing to this version of iced iced-rs/iced#650
which is a pending PR to add basic mobile support to iced

@francesca64
Copy link
Contributor

This is super cool!

There's probably some way we could make Metal validation configurable, unless you think it's likely to only be a short-term issue.

It doesn't seem like I'm able to touch the Next button on iOS. Is that expected? Besides that, it renders perfectly, and the scroll bar works too. Of course, I'll accept this PR either way!

I also hit an ICE (!) when building for Android. Though, since this is originally based on simlay's work, I'm guessing iced only supports iOS so far? If so, adding this section to Cargo.toml.hbs will cause cargo-mobile to warn when trying to build for Android:

[package.metadata.cargo-android]
supported = false

@francesca64
Copy link
Contributor

Also, assets (like ferris.png) will only be available on mobile if they're in the assets directory. Either renaming the images dir to assets or moving the images dir into a new dir named assets would work.

Of course, the path of the asset directory can also be configured in mobile.toml; assets is just the fault. However, template packs don't have any control over the config in mobile.toml, so you have to stick with the default for now.

@zeerooth
Copy link
Contributor

zeerooth commented May 24, 2021

The PR you mentioned was merged to iced some time ago, so I locally merged the current master branch from cargo-mobile into iced-template, changed the iced version in Cargo.toml to

iced = { git = "https://github.com/hecrj/iced", branch = "master", features = ["image", "debug"] }

and tried running it on my Android device.

Unfortunately, there seems to be an issue with the current vulkan backend in gfx-backend-vulkan crate, because I get a panic:

RustStdoutStderr: thread '<unnamed>' panicked at 'AndroidSurface failed: ERROR_NATIVE_WINDOW_IN_USE_KHR', /home/radek/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/gfx-backend-vulkan-0.7.0/src/window.rs:133:69

I also tried enabling the glow feature to try an OpenGL backend, but this one won't even compile

error[E0615]: attempted to take value of method `SwapBuffersWithDamageKHR` on type `&api::egl::egl::Egl`
   --> /home/radek/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/glutin-0.26.0/src/api/egl/mod.rs:660:13
    |
660 |         egl.SwapBuffersWithDamageKHR.is_loaded()
    |             ^^^^^^^^^^^^^^^^^^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
660 |         egl.SwapBuffersWithDamageKHR(_, _, _, _).is_loaded()
    | 

Now, it looks like Android is not really supported in glutin as per this PR
And somebody had a similar issue but I don't think they managed to make it work in the end.

So that's the current status - I'll try to fix those issues and make some PRs if necessary, because currently iced is closest among all UI crates in Rust to being usable on Android and it would be so cool to have it included in cargo-mobile if possible.

Edit: Android Tracking Issue was opened in iced repo containing a list of things that need to be addressed before iced can be run on Android.

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.

3 participants