mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-08 04:41:51 +09:00
added sources for Slick
Former-commit-id: 1647fa32ef6894bd7db44f741f07c2f4dcdf9054 Former-commit-id: 0e5810dcfbe1fd59b13e7cabe9f1e93c5542da2d
This commit is contained in:
39
lib/slick-source/org/newdawn/slick/command/KeyControl.java
Normal file
39
lib/slick-source/org/newdawn/slick/command/KeyControl.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package org.newdawn.slick.command;
|
||||
|
||||
/**
|
||||
* A control relating to a command indicate that it should be fired when a specific key is pressed
|
||||
* or released.
|
||||
*
|
||||
* @author joverton
|
||||
*/
|
||||
public class KeyControl implements Control {
|
||||
/** The key code that needs to be pressed */
|
||||
private int keycode;
|
||||
|
||||
/**
|
||||
* Create a new control that caused an command to be fired on a key pressed/released
|
||||
*
|
||||
* @param keycode The code of the key that causes the command
|
||||
*/
|
||||
public KeyControl(int keycode) {
|
||||
this.keycode = keycode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof KeyControl) {
|
||||
return ((KeyControl)o).keycode == keycode;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
public int hashCode() {
|
||||
return keycode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user