aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/input/keyboard.lux
blob: e33e8c4a7bb3b9f795839aa43a24981f9f4fd190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
(.module:
  [library
   [lux #*]])

(type: .public Key
  {#.doc (example "A key from a keyboard, identify by a numeric ID.")}
  Nat)

(template [<code> <name>]
  [(def: .public <name> Key <code>)]

  [00008 back_space]
  [00010 enter]
  [00016 shift]
  [00017 control]
  [00018 alt]
  [00020 caps_lock]
  [00027 escape]
  [00032 space]
  [00033 page_up]
  [00034 page_down]
  [00035 end]
  [00036 home]

  [00037 left]
  [00038 up]
  [00039 right]
  [00040 down]
  
  [00065 a]
  [00066 b]
  [00067 c]
  [00068 d]
  [00069 e]
  [00070 f]
  [00071 g]
  [00072 h]
  [00073 i]
  [00074 j]
  [00075 k]
  [00076 l]
  [00077 m]
  [00078 n]
  [00079 o]
  [00080 p]
  [00081 q]
  [00082 r]
  [00083 s]
  [00084 t]
  [00085 u]
  [00086 v]
  [00087 w]
  [00088 x]
  [00089 y]
  [00090 z]
  
  [00096 num_pad_0]
  [00097 num_pad_1]
  [00098 num_pad_2]
  [00099 num_pad_3]
  [00100 num_pad_4]
  [00101 num_pad_5]
  [00102 num_pad_6]
  [00103 num_pad_7]
  [00104 num_pad_8]
  [00105 num_pad_9]

  [00127 delete]
  [00144 num_lock]
  [00145 scroll_lock]
  [00154 print_screen]
  [00155 insert]
  [00524 windows]

  [00112 f1]
  [00113 f2]
  [00114 f3]
  [00115 f4]
  [00116 f5]
  [00117 f6]
  [00118 f7]
  [00119 f8]
  [00120 f9]
  [00121 f10]
  [00122 f11]
  [00123 f12]
  [61440 f13]
  [61441 f14]
  [61442 f15]
  [61443 f16]
  [61444 f17]
  [61445 f18]
  [61446 f19]
  [61447 f20]
  [61448 f21]
  [61449 f22]
  [61450 f23]
  [61451 f24]
  )

(type: .public Press
  {#.doc (example "A key-press for a key.")}
  (Record
   {#pressed? Bit
    #input Key}))

(template [<bit> <name>]
  [(def: .public (<name> key)
     (-> Key Press)
     {#pressed? <bit>
      #input key})]

  [#0 release]
  [#1 press]
  )