Closed fornwall closed 11 months ago
Ah, yep, awkward.
This is a bit fiddly because the input API specifically differs quite significantly between the game-activity
and native-activity
backends and we have repeatedly hit issues from trying to expose compatible APIs using different types.
For implementation convenience the native-activity
backend used to more-directly expose all the ndk
input types but this has repeatedly led to compatibility issues between the native-activity
and game-activity
backends where the game-activity
types haven't matched the ndk
API exactly or where downstream crates have just assumed they can use the ndk
types and then not been compatible with the game-activity
backend at all.
Ref: https://github.com/rust-mobile/android-activity/pull/107 and https://github.com/rust-mobile/android-activity/issues/92
Because of this I've generally tried to switch away from using any of the ndk crate types here unless they can also be used with the game-activity backend too and so I'm thinking we should probably instead double-down with consolidating input types and look at wrapping the Pointer
type so we can hide the ndk
Pointer
as an implementation detail for the native-activity
backend.
Pointer
and PointersIter
are essentially the last two ndk
input types that are still exposed publicly.
In a similar way, Pointer::tool_type()
still poses a portability hazard between the native-activity
and game-activity
backends.
Thanks for sharing the info!
we should probably instead double-down with consolidating input types and look at wrapping the Pointer type so we can hide the ndk Pointer as an implementation detail for the native-activity backend.
Makes sense! Created https://github.com/rust-mobile/android-activity/pull/122 as an initial iteration on that, so closing this PR in favour of that one!
Currently
android_activity::input::Axis
is always the enum defined by theandroid-activity
crate.This means that when
native-activity
is used, the below code does not currently compile, since thePointer
re-exported from the ndk expects anAxis
also re-exported from the ndk: