android: add platform config to set an FPS setting when blocking_event_loop is enabled#594
Conversation
| /// continuously drawing without having to continuously schedule updates that can | ||
| /// choke the receiver queue. | ||
| /// | ||
| /// Currently supported only on Android. |
There was a problem hiding this comment.
Maybe reuse swap_interval for this? I am concerned that users will try to use fps to set target fps on other platforms.
If not swap_interval - I would name it something among the android_perioidical_wakeup_timer lines - to make it very explicit that its a very special setting, not a general way to set target fps to 60 on web.
There was a problem hiding this comment.
swap_interval is for vsync and is not correct here. In fact I think this code should be added to the android EGL init in src/native/android.rs but that is a separate commit:
if (libegl.eglSwapInterval)(egl_display, conf.platform.swap_interval.unwrap_or(1)) == 0 {
eprintln!("eglSwapInterval failed");
}I didn't do it yet since the only meaningful values on Android are 0 or 1 and we generally want 1 anyway.
Secondly, my plan is actually to make FPS a setting for all platforms where possible to conserve battery/system resources. So I think its best to conserve it in the general platform settings unless you prefer to later deprecate the android specific setting and introduce a global one later.
|
Should I rename Also if you prefer, we can put |
I do prefer |
…ng) when blocking_event_loop is enabled. Currently in my app I have a task scheduling updates continuously but this introduces latency and uneeded cpu usage. Instead we can make the receiver optionally call .recv_timeout() inside the main event loop. In fact all native platforms in miniquad should support `sleep_interval_ms` by default instead of continuous drawing.
|
ok done, force pushed renamed the setting to |
|
Thanks for PR! |
Currently in my app I have a task scheduling updates continuously but this introduces latency and uneeded cpu usage. Instead we can make the receiver optionally call .recv_timeout() inside the main event loop. In fact all native platforms in miniquad should use an FPS by default instead of continuous drawing.
(on android you dont want to continuous draw() or else it will drain battery. In fact you dont want to do this on most platforms)