You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.
Currently, lokinit is continuously emitting update and render events. For a game that is usually the sole focus of a user, and where things are constantly moving on screen, this makes sense. For other types of apps (like a chat app), it takes up unnecessary CPU.
Suggested solution
It would be nice if there was a setting to just have it emit such events when a redraw is needed. This is similar to e.g. ControlFlow in winit and the EventPump in SDL. From the programmer's perspective we could do this by having a setting refresh_strategy: RefreshStrategy in Conf, where RefreshStrategy is an enum with the values Continuous or Requested. The default would be Continuous, in which case things would work the same as they do now. If the refresh strategy is requested, the update and draw events would only be sent if needed (e.g. when the app is started, or if it has been minimized and then restored). There would also be a post_refresh function on the window module that manually triggers the update and draw events to be sent.
As an implementation note, it is important that the post_refresh function makes sure that the update happens after any pending events.
Also, in order to be able to roll the feature out quicker we can see it as a kind of "hint". I.e., we don't need to have it on all platforms before we merge the code into mainline.
Alternatives
No response
Additional information
No response
Checks
I have checked for existing issues about this, and did not
find any.
The text was updated successfully, but these errors were encountered:
limikael
changed the title
feat: refresh_strategy and post_redisplay()
feat: refresh_strategy and post_refresh()
May 5, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Area
lokinit
Problem
Currently, lokinit is continuously emitting update and render events. For a game that is usually the sole focus of a user, and where things are constantly moving on screen, this makes sense. For other types of apps (like a chat app), it takes up unnecessary CPU.
Suggested solution
It would be nice if there was a setting to just have it emit such events when a redraw is needed. This is similar to e.g. ControlFlow in winit and the EventPump in SDL. From the programmer's perspective we could do this by having a setting
refresh_strategy: RefreshStrategy
in Conf, whereRefreshStrategy
is an enum with the valuesContinuous
orRequested
. The default would beContinuous
, in which case things would work the same as they do now. If the refresh strategy is requested, the update and draw events would only be sent if needed (e.g. when the app is started, or if it has been minimized and then restored). There would also be apost_refresh
function on thewindow
module that manually triggers the update and draw events to be sent.As an implementation note, it is important that the
post_refresh
function makes sure that the update happens after any pending events.Also, in order to be able to roll the feature out quicker we can see it as a kind of "hint". I.e., we don't need to have it on all platforms before we merge the code into mainline.
Alternatives
No response
Additional information
No response
Checks
find any.
The text was updated successfully, but these errors were encountered: