fix: only render on changes
This commit is contained in:
@@ -37,6 +37,10 @@ real_main :: proc() {
|
||||
|
||||
m3_init_dark()
|
||||
|
||||
// Only draw when something actually changed. Without this the loop renders
|
||||
// flat out forever, which on a phone is straight battery burn.
|
||||
engine.set_render_on_change(true)
|
||||
|
||||
for !engine.should_quit() {
|
||||
engine.frame_start()
|
||||
defer engine.frame_end()
|
||||
@@ -55,6 +59,13 @@ real_main :: proc() {
|
||||
|
||||
if !insets_valid {
|
||||
insets_valid = refresh_insets()
|
||||
if !insets_valid {
|
||||
// The decor view attaches asynchronously and produces no event
|
||||
// when it does. Under render_on_change the loop would park
|
||||
// before the retry ever ran, leaving the app bar with no status
|
||||
// bar padding.
|
||||
engine.request_render()
|
||||
}
|
||||
}
|
||||
|
||||
window_size := engine.get_window_size()
|
||||
|
||||
Reference in New Issue
Block a user