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 /html/081print.mu.html | |
parent | 15ed8cc164f947d6a49b6b73a00ff9955931ab50 (diff) | |
download | mu-f9294899d0b952072de3dc87b3ea97e98f150ea4.tar.gz |
3622 - handle fractional coordinates in print
Diffstat (limited to 'html/081print.mu.html')
-rw-r--r-- | html/081print.mu.html | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/html/081print.mu.html b/html/081print.mu.html index 241cf857..5214e80c 100644 --- a/html/081print.mu.html +++ b/html/081print.mu.html @@ -141,11 +141,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color height:num <span class="Special"><-</span> get *screen, <span class="Constant">num-rows:offset</span> <span class="Comment"># if cursor is out of bounds, silently exit</span> row:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-row:offset</span> + row <span class="Special"><-</span> round row legal?:bool <span class="Special"><-</span> greater-or-equal row,<span class="Constant"> 0</span> <span class="muControl">return-unless</span> legal? legal? <span class="Special"><-</span> lesser-than row, height <span class="muControl">return-unless</span> legal? column:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-column:offset</span> + column <span class="Special"><-</span> round column legal? <span class="Special"><-</span> greater-or-equal column,<span class="Constant"> 0</span> <span class="muControl">return-unless</span> legal? legal? <span class="Special"><-</span> lesser-than column, width @@ -220,6 +222,25 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] +<span class="muScenario">scenario</span> print-character-at-fractional-coordinate [ + <span class="Constant">local-scope</span> + fake-screen:&:screen <span class="Special"><-</span> new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + a:char <span class="Special"><-</span> copy <span class="Constant">97/a</span> + run [ + move-cursor fake-screen, 0.5,<span class="Constant"> 0</span> + fake-screen <span class="Special"><-</span> print fake-screen, a:char + cell:&:@:screen-cell <span class="Special"><-</span> get *fake-screen, <span class="Constant">data:offset</span> + 1:@:screen-cell/<span class="Special">raw</span> <span class="Special"><-</span> copy *cell + ] + memory-should-contain [ + <span class="Constant"> 1</span> <span class="Special"><-</span><span class="Constant"> 6</span> <span class="Comment"># width*height</span> + <span class="Constant"> 2</span> <span class="Special"><-</span><span class="Constant"> 97</span> <span class="Comment"># 'a'</span> + <span class="Constant"> 3</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> + <span class="Comment"># rest of screen is empty</span> + <span class="Constant"> 4</span> <span class="Special"><-</span><span class="Constant"> 0</span> + ] +] + <span class="muScenario">scenario</span> print-character-in-color [ <span class="Constant">local-scope</span> fake-screen:&:screen <span class="Special"><-</span> new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> |