mirror of
https://github.com/rust-mobile/android-activity.git
synced 2026-07-19 21:18:54 +00:00
game-activity: rework input API
This leaves the InputBuffer abstraction as an implementation detail
and just exposes an API like this for processing input:
app.input_events(|event| {
// handle event
});
The main consideration here was to have an API that could also be
supported via NativeActivity to keep open the possibility of a standard
Android 'glue' API.
This commit is contained in:
@@ -68,14 +68,9 @@ extern "C" fn android_main() {
|
||||
redraw_pending = false;
|
||||
|
||||
// Handle input
|
||||
if let Some(buf) = app.swap_input_buffers() {
|
||||
for motion in buf.motion_events_iter() {
|
||||
trace!("Motion Event: {motion:?}")
|
||||
}
|
||||
for key in buf.key_events_iter() {
|
||||
trace!("Key Event: {key:?}")
|
||||
}
|
||||
}
|
||||
app.input_events(|event| {
|
||||
trace!("Input Event: {event:?}")
|
||||
})
|
||||
|
||||
// Render...
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user