-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonHandler.java
More file actions
43 lines (36 loc) · 846 Bytes
/
ButtonHandler.java
File metadata and controls
43 lines (36 loc) · 846 Bytes
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
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class ButtonHandler extends KeyAdapter {
public ButtonHandler() {
}
public void keyTyped(KeyEvent arg0) {
}
public void keyReleased(KeyEvent key) {
actionPerformed(key, false);
}
public void keyPressed(KeyEvent key) {
actionPerformed(key, true);
}
public void actionPerformed(KeyEvent key, boolean Value) {
switch (key.getKeyCode()) {
case KeyEvent.VK_UP:
Stuff.charater.setUp(Value);
break;
case KeyEvent.VK_LEFT:
Stuff.charater.setLeft(Value);
break;
case KeyEvent.VK_DOWN:
Stuff.charater.setDown(Value);
break;
case KeyEvent.VK_RIGHT:
Stuff.charater.setRight(Value);
break;
case KeyEvent.VK_S:
Stuff.charater.setClick(Value);
break;
case KeyEvent.VK_D:
Stuff.charater.setFlag(Value);
break;
}
}
}