Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epoxy
GitHub Repository: epoxy/proj11
Path: blob/master/SLICK_HOME/src/org/newdawn/slick/command/KeyControl.java
1456 views
1
package org.newdawn.slick.command;
2
3
/**
4
* A control relating to a command indicate that it should be fired when a specific key is pressed
5
* or released.
6
*
7
* @author joverton
8
*/
9
public class KeyControl implements Control {
10
/** The key code that needs to be pressed */
11
private int keycode;
12
13
/**
14
* Create a new control that caused an command to be fired on a key pressed/released
15
*
16
* @param keycode The code of the key that causes the command
17
*/
18
public KeyControl(int keycode) {
19
this.keycode = keycode;
20
}
21
22
/**
23
* @see java.lang.Object#equals(java.lang.Object)
24
*/
25
public boolean equals(Object o) {
26
if (o instanceof KeyControl) {
27
return ((KeyControl)o).keycode == keycode;
28
}
29
30
return false;
31
}
32
33
/**
34
* @see java.lang.Object#hashCode()
35
*/
36
public int hashCode() {
37
return keycode;
38
}
39
}
40
41