aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2018-10-29 20:23:57 -0400
committerEduardo Julian2018-10-29 20:23:57 -0400
commit4415549185eabde554be0b32415140ad6d950a6b (patch)
treeec72afc33227f273f6f69bd2a47c864d909d1e12 /stdlib/source
parent3b6098efb623ed2413e118e0620f84d79031e1ef (diff)
Added a module for keyboard input.
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/world/input/keyboard.lux78
1 files changed, 78 insertions, 0 deletions
diff --git a/stdlib/source/lux/world/input/keyboard.lux b/stdlib/source/lux/world/input/keyboard.lux
new file mode 100644
index 000000000..99ed5b2cc
--- /dev/null
+++ b/stdlib/source/lux/world/input/keyboard.lux
@@ -0,0 +1,78 @@
+(.module:
+ [lux #*
+ [data
+ [text (#+ Char)]]])
+
+(type: #export Key
+ Nat)
+
+(do-template [<name> <code>]
+ [(def: #export <name> Key <code>)]
+
+ [caps-lock 20]
+ [num-lock 144]
+ [scroll-lock 145]
+
+ [back-space 8]
+ [enter 10]
+
+ [shift 16]
+ [control 17]
+ [alt 18]
+
+ [escape 27]
+ [page-up 33]
+ [page-down 34]
+ [end 35]
+ [home 36]
+
+ [left 37]
+ [up 38]
+ [right 39]
+ [down 40]
+
+ [delete 127]
+ [print-screen 154]
+ [insert 155]
+ [windows 524]
+
+ [num-pad-0 96]
+ [num-pad-1 97]
+ [num-pad-2 98]
+ [num-pad-3 99]
+ [num-pad-4 100]
+ [num-pad-5 101]
+ [num-pad-6 102]
+ [num-pad-7 103]
+ [num-pad-8 104]
+ [num-pad-9 105]
+
+ [f1 112]
+ [f2 113]
+ [f3 114]
+ [f4 115]
+ [f5 116]
+ [f6 117]
+ [f7 118]
+ [f8 119]
+ [f9 120]
+ [f10 121]
+ [f11 122]
+ [f12 123]
+ [f13 61440]
+ [f14 61441]
+ [f15 61442]
+ [f16 61443]
+ [f17 61444]
+ [f18 61445]
+ [f19 61446]
+ [f20 61447]
+ [f21 61448]
+ [f22 61449]
+ [f23 61450]
+ [f24 61451]
+ )
+
+(type: #export Press
+ {#input (Either Key Char)
+ #pressed? Bit})