about summary refs log tree commit diff stats
path: root/hest-life.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-05-16 21:58:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-05-16 21:58:13 -0700
commitfb0f0748bcb7e6d24b87b4d3fc45aa7410c641e0 (patch)
tree5dbb5cf3183519b4fc4df3beef502308949fd603 /hest-life.mu
parent6a47fad86f14e3181542aac671595f7b97ce4b0f (diff)
downloadmu-fb0f0748bcb7e6d24b87b4d3fc45aa7410c641e0.tar.gz
press '+' and '-' to zoom in and out respectively
Diffstat (limited to 'hest-life.mu')
-rw-r--r--hest-life.mu30
1 files changed, 30 insertions, 0 deletions
diff --git a/hest-life.mu b/hest-life.mu
index cb732580..38d6d43e 100644
--- a/hest-life.mu
+++ b/hest-life.mu
@@ -240,6 +240,36 @@ fn edit keyboard: (addr keyboard), _self: (addr environment) {
     copy-to *loop, 0
     return
   }
+  # -: zoom out
+  {
+    compare key, 0x2d/-
+    break-if-!=
+    var zoom/eax: (addr int) <- get self, zoom
+    compare *zoom, 4
+    {
+      break-if->=
+      increment *zoom
+      # set tick to a multiple of zoom
+      var tick-a/edx: (addr int) <- get self, tick
+      clear-lowest-bits tick-a, *zoom
+    }
+    return
+  }
+  # +: zoom in
+  {
+    compare key, 0x2b/+
+    break-if-!=
+    var zoom/eax: (addr int) <- get self, zoom
+    compare *zoom, 0
+    {
+      break-if-<=
+      decrement *zoom
+      # set tick to a multiple of zoom
+      var tick-a/edx: (addr int) <- get self, tick
+      clear-lowest-bits tick-a, *zoom
+    }
+    return
+  }
 }
 
 fn pause _self: (addr environment) {