native-activity: Fix InputAvailable support

"native-activity" builds were recently broken by bb8eeb705c which
this patch fixes.

The na-mainloop example has also been updated to verify this by
reducing the fake "render" timeout and also triggering a fake
render when an InputAvailable event is received.

Fixes: #12
This commit is contained in:
Robert Bragg
2022-08-12 00:53:25 +01:00
parent 0d0c10ebb2
commit 7a77402279
2 changed files with 19 additions and 13 deletions
+4 -1
View File
@@ -11,7 +11,7 @@ fn android_main(app: AndroidApp) {
while !quit {
app.poll_events(
Some(std::time::Duration::from_millis(500)), /* timeout */
Some(std::time::Duration::from_secs(1)), /* timeout */
|event| {
match event {
PollEvent::Wake => {
@@ -49,6 +49,9 @@ fn android_main(app: AndroidApp) {
MainEvent::RedrawNeeded { .. } => {
redraw_pending = true;
}
MainEvent::InputAvailable { .. } => {
redraw_pending = true;
}
MainEvent::LowMemory => {}
MainEvent::Destroy => quit = true,