Make repeated invalidations more efficient

This commit is contained in:
Drew DeVault 2019-01-14 21:11:33 -05:00
parent 8492a21a51
commit 0b37441f17
1 changed files with 10 additions and 0 deletions

View File

@ -78,6 +78,16 @@ func (state *UI) Tick() bool {
}
state.Content.Event(event)
case <-state.invalidations:
for {
// Flush any other pending invalidations
select {
case <-state.invalidations:
break
default:
goto done
}
}
done:
state.Content.Draw(state.ctx)
state.screen.Show()
default: