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:
Robert Bragg
2022-05-20 01:51:05 +01:00
parent 57dda66a54
commit 164957ec65
3 changed files with 42 additions and 26 deletions
+3 -8
View File
@@ -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...
}