-
Notifications
You must be signed in to change notification settings - Fork 2
/
InputHandler.pde
89 lines (86 loc) · 2.41 KB
/
InputHandler.pde
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
public class InputHandler {
private GloveState keyboard;
private GloveState virtual;
private Communicator communicator;
public InputHandler (Communicator communicator) {
this.keyboard = new GloveState(9);
this.virtual = new GloveState(9);
this.communicator = communicator;
}
public void handleKeystroke(char keystroke) {
switch (key + "") {
case "1":
keyboard.setPouch(0, 15);
communicator.sendInflationState(keyboard);
break;
case "2":
keyboard.setPouch(1, 15);
communicator.sendInflationState(keyboard);
break;
case "3":
keyboard.setPouch(2, 15);
communicator.sendInflationState(keyboard);
break;
case "4":
keyboard.setPouch(3, 15);
communicator.sendInflationState(keyboard);
break;
case "5":
keyboard.setPouch(4, 15);
communicator.sendInflationState(keyboard);
break;
case "6":
keyboard.setPouch(5, 15);
communicator.sendInflationState(keyboard);
break;
case "7":
keyboard.setPouch(6, 15);
communicator.sendInflationState(keyboard);
break;
case "8":
keyboard.setPouch(7, 15);
communicator.sendInflationState(keyboard);
break;
case "9":
keyboard.setPouch(8, 15);
communicator.sendInflationState(keyboard);
break;
case "q":
keyboard.setPouch(0, 0);
communicator.sendInflationState(keyboard);
break;
case "w":
keyboard.setPouch(1, 0);
communicator.sendInflationState(keyboard);
break;
case "e":
keyboard.setPouch(2, 0);
communicator.sendInflationState(keyboard);
break;
case "r":
keyboard.setPouch(3, 0);
communicator.sendInflationState(keyboard);
break;
case "t":
keyboard.setPouch(4, 0);
communicator.sendInflationState(keyboard);
break;
case "y":
keyboard.setPouch(5, 0);
communicator.sendInflationState(keyboard);
break;
case "u":
keyboard.setPouch(6, 0);
communicator.sendInflationState(keyboard);
break;
case "i":
keyboard.setPouch(7, 0);
communicator.sendInflationState(keyboard);
break;
case "o":
keyboard.setPouch(8, 0);
communicator.sendInflationState(keyboard);
break;
}
}
}