diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-11-05 20:34:09 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-11-05 20:35:17 -0700 |
commit | f9294899d0b952072de3dc87b3ea97e98f150ea4 (patch) | |
tree | e962ffc031422cc54c7be1c8ad62846e733c0a9c /081print.mu | |
parent | 15ed8cc164f947d6a49b6b73a00ff9955931ab50 (diff) | |
download | mu-f9294899d0b952072de3dc87b3ea97e98f150ea4.tar.gz |
3622 - handle fractional coordinates in print
Diffstat (limited to '081print.mu')
-rw-r--r-- | 081print.mu | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/081print.mu b/081print.mu index adda5db9..9eecf6d3 100644 --- a/081print.mu +++ b/081print.mu @@ -106,11 +106,13 @@ def print screen:&:screen, c:char -> screen:&:screen [ height:num <- get *screen, num-rows:offset # if cursor is out of bounds, silently exit row:num <- get *screen, cursor-row:offset + row <- round row legal?:bool <- greater-or-equal row, 0 return-unless legal? legal? <- lesser-than row, height return-unless legal? column:num <- get *screen, cursor-column:offset + column <- round column legal? <- greater-or-equal column, 0 return-unless legal? legal? <- lesser-than column, width @@ -185,6 +187,25 @@ scenario print-character-at-top-left [ ] ] +scenario print-character-at-fractional-coordinate [ + local-scope + fake-screen:&:screen <- new-fake-screen 3/width, 2/height + a:char <- copy 97/a + run [ + move-cursor fake-screen, 0.5, 0 + fake-screen <- print fake-screen, a:char + cell:&:@:screen-cell <- get *fake-screen, data:offset + 1:@:screen-cell/raw <- copy *cell + ] + memory-should-contain [ + 1 <- 6 # width*height + 2 <- 97 # 'a' + 3 <- 7 # white + # rest of screen is empty + 4 <- 0 + ] +] + scenario print-character-in-color [ local-scope fake-screen:&:screen <- new-fake-screen 3/width, 2/height |