diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-09-22 22:08:37 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-09-22 22:10:26 -0700 |
commit | 89684e6677afbd6386e5a5a5214348c7ff53074e (patch) | |
tree | a52e8ccaf87999e88cf419ef221d6efd29f1c5c9 /apps/tile | |
parent | 4b3461fa0ad4aaa7a29cf914614dab7a6cdcacfc (diff) | |
download | mu-89684e6677afbd6386e5a5a5214348c7ff53074e.tar.gz |
6838
Interestingly, erasing the screen partially looks better to me even though it's clearly slower. The divider never being redrawn provides a sense of stability.
Diffstat (limited to 'apps/tile')
-rw-r--r-- | apps/tile/box.mu | 41 | ||||
-rw-r--r-- | apps/tile/environment.mu | 3 |
2 files changed, 43 insertions, 1 deletions
diff --git a/apps/tile/box.mu b/apps/tile/box.mu index 7cb69206..bc0f58e1 100644 --- a/apps/tile/box.mu +++ b/apps/tile/box.mu @@ -42,3 +42,44 @@ fn draw-vertical-line screen: (addr screen), row1: int, row2: int, col: int { loop } } + +# erase parts of screen the slow way +fn clear-rect screen: (addr screen), row1: int, col1: int, row2: int, col2: int { + var i/eax: int <- copy row1 + { + compare i, row2 + break-if-> + var j/ecx: int <- copy col1 + move-cursor screen, i, j + { + compare j, col2 + break-if-> + print-grapheme screen 0x20 # space + j <- increment + loop + } + i <- increment + loop + } +} + +fn clear-rect2 screen: (addr screen), row1: int, col1: int, w: int, h: int { + var i/eax: int <- copy 0 + var curr-row/esi: int <- copy row1 + { + compare i, w + break-if->= + move-cursor screen, curr-row, col1 + var j/ecx: int <- copy 0 + { + compare j, h + break-if->= + print-grapheme screen 0x20 # space + j <- increment + loop + } + i <- increment + curr-row <- increment + loop + } +} diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index cd5721b4..5415bf6d 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -163,12 +163,13 @@ fn render _env: (addr environment) { var _screen/eax: (addr screen) <- lookup *screen-ah var screen/edi: (addr screen) <- copy _screen # prepare screen - clear-screen screen var nrows/eax: (addr int) <- get env, nrows var _repl-col/ecx: (addr int) <- get env, code-separator-col var repl-col/ecx: int <- copy *_repl-col draw-vertical-line screen, 1, *nrows, repl-col repl-col <- add 2 # repl-margin-left + var ncols/edx: (addr int) <- get env, ncols + clear-rect screen, 1, repl-col, *nrows, *ncols move-cursor screen, 5, repl-col # input-row + stack-margin-top print-string screen, "stack:" move-cursor screen, 3, repl-col # input-row, input-col |