aboutsummaryrefslogtreecommitdiff
path: root/doc/tutorials/intro/48.grabbing_keystrokes.pd
blob: 8bf37e15efa29bb866477d518c964e89e4f95ef7 (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
#N canvas 10 40 620 460 12;
#X obj 10 10 cnv 15 400 40 empty empty grabbing_keystrokes 20 12 0
24 -228992 -66577 0;
#X obj 115 152 key;
#X floatatom 115 176 5 0 0 0 - - -;
#X text 284 216 This times how long between each;
#X text 284 232 press of the 'a' key.;
#X floatatom 215 176 5 0 0 0 - - -;
#X obj 215 152 keyup;
#X floatatom 315 176 5 0 0 0 - - -;
#X obj 315 152 keyname;
#X symbolatom 379 176 10 0 0 0 - - -;
#X text 20 231 't' key as toggle:;
#X obj 68 303 select 116;
#X obj 68 272 keyup;
#N canvas 10 40 620 460 /SUBPATCH/ 0;
#X obj 101 10 inlet;
#X obj 100 100 tgl 32 0 empty \$0-tgl empty 0 -6 0 8 -166441 -166441
-262144 0 1;
#X obj 156 68 select 1;
#X msg 172 186 color \$1 \$2 \$3;
#X msg 268 146 1 1 0;
#X msg 133 144 -65281 0 -1;
#X obj 268 85 bang;
#X obj 176 241 send \$0-tgl;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 2 0 5 0;
#X connect 2 1 6 0;
#X connect 3 0 7 0;
#X connect 4 0 3 0;
#X connect 5 0 3 0;
#X connect 6 0 4 0;
#X coords 0 -1 1 1 32 32 1 100 100;
#X restore 68 327 pd;
#X text 13 63 Pd provides a set of objects for getting events from
the keyboard. [key] outputs on key down \, [keyup] outputs on key up
\, and [keyname] outputs both key up and key down \, and gives a symbolic
name for the current key.;
#X text 21 391 These objects will only grab keys when this window has
focus. If you click on the Pd window \, this window won't get key events
anymore.;
#X obj 376 259 key;
#X floatatom 376 283 5 0 0 0 - - -;
#X obj 475 261 keyup;
#X obj 376 312 select 97;
#X obj 475 312 select 97;
#X obj 411 341 timer;
#X floatatom 411 367 5 0 0 0 - - -;
#X connect 1 0 2 0;
#X connect 6 0 5 0;
#X connect 8 0 7 0;
#X connect 8 1 9 0;
#X connect 11 0 13 0;
#X connect 12 0 11 0;
#X connect 16 0 17 0;
#X connect 17 0 19 0;
#X connect 18 0 20 0;
#X connect 19 0 21 0;
#X connect 20 0 21 1;
#X connect 21 0 22 0;