about summary refs log tree commit diff stats
path: root/cpp/keyboard.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-04 13:59:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-04 14:34:10 -0700
commitbbff2a35a9e4b70a8d02751a904bbf491ba0c12a (patch)
tree2cabff0d31df40297ed1652020f5beadb4af520d /cpp/keyboard.mu
parent82c04e61516756a65587eaceb1a6df41082573a9 (diff)
downloadmu-bbff2a35a9e4b70a8d02751a904bbf491ba0c12a.tar.gz
1255 - keyboard support
Diffstat (limited to 'cpp/keyboard.mu')
-rw-r--r--cpp/keyboard.mu14
1 files changed, 14 insertions, 0 deletions
diff --git a/cpp/keyboard.mu b/cpp/keyboard.mu
new file mode 100644
index 00000000..d6f728f6
--- /dev/null
+++ b/cpp/keyboard.mu
@@ -0,0 +1,14 @@
+# example reading keys from keyboard
+#
+# Keeps printing 'a' until you press a key. Then prints the key you pressed
+# and exits.
+recipe main [
+  switch-to-display
+  {
+    c:character, found?:boolean <- read-key-from-keyboard
+    break-if found?:boolean
+    print-character-to-display 97:literal
+    loop
+  }
+  return-to-console
+]