diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-05-12 07:56:38 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-05-12 07:56:38 -0700 |
commit | 8195ed4ee94f490d377b91caa0d79f21dd3e86ed (patch) | |
tree | a0267cfb168e437768d239daf18624cabe361f16 /sandbox | |
parent | 43f634adb0eda2fc0377423e5c5b2a7d8f087780 (diff) | |
download | mu-8195ed4ee94f490d377b91caa0d79f21dd3e86ed.tar.gz |
3853
Bring back commit 3844, albeit in simplified form. I'd forgotten that the one place where we still need to buffer rendering is when people hold down up/down arrow keys.
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/004-programming-environment.mu | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu index a29324b0..2dca181d 100644 --- a/sandbox/004-programming-environment.mu +++ b/sandbox/004-programming-environment.mu @@ -28,6 +28,10 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources: local-scope load-ingredients current-sandbox:&:editor <- get *env, current-sandbox:offset + # if we fall behind we'll stop updating the screen, but then we have to + # render the entire screen when we catch up. + # todo: test this + render-all-on-no-more-events?:bool <- copy 0/false { # looping over each (keyboard or touch) event as it occurs +next-event @@ -73,11 +77,18 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources: screen <- render-all screen, env, render-without-moving-cursor loop +next-event } - # if it's not global and not a touch event, send to appropriate editor + # not global and not a touch event { render?:bool <- handle-keyboard-event screen, current-sandbox, e:event break-unless render? - screen <- render-all screen, env, render + # try to batch up rendering if there are more events queued up + render-all-on-no-more-events? <- or render-all-on-no-more-events?, render? + more-events?:bool <- has-more-events? console + { + break-if more-events? + break-unless render-all-on-no-more-events? + screen <- render-all screen, env, render + } } loop } |