com.golden.gamedev.funbox
Class KeyCapture
java.lang.Object
|
+--com.golden.gamedev.funbox.KeyCapture
- public class KeyCapture
- extends Object
Capturing key sequence combination, usually used to turn on cheat mode.
For example:
KeyCaptureListener listener = new KeyCaptureListener() {
public void keyCaptured(KeyCapture src) {
System.out.println("hello world");
}
};
String key = "HYPERSPEED";
KeyCapture keycap = new KeyCapture(GameCore.bsInput, key, 1000, listener);
// in game update() method
// pressing "hyperspeed" will print out "hello world" to the console
keycap.update();
input
protected final BaseInput input
DEBUG
public boolean DEBUG
KeyCapture
public KeyCapture(BaseInput input,
int[] key,
int delay,
KeyCaptureListener l)
- Constructs new
KeyCapture
- Parameters:
input
- key
- delay
- l
-
KeyCapture
public KeyCapture(BaseInput input,
String keyString,
int delay,
KeyCaptureListener l)
getModifiers
public int[] getModifiers()
setModifiers
public void setModifiers(int[] i)
setModifiers
public void setModifiers(int i)
getKeySequence
public int[] getKeySequence()
setKeySequence
public void setKeySequence(int[] key)
setKeySequence
public void setKeySequence(String st)
- Parse String
st
into key sequence.
Example:
String key = "HYPERSPEED";
keyCapture.setKeySequence(key);
- Parameters:
st
- String
to be parsed into key sequence
- Throws:
RuntimeException
- If the String st
can not be parsed.- See Also:
setKeySequence(int[])
getDelayTime
public int getDelayTime()
setDelayTime
public void setDelayTime(int i)
isActive
public boolean isActive()
setActive
public void setActive(boolean b)
getKeyString
public String getKeyString()
getKeyCaptureListener
public KeyCaptureListener getKeyCaptureListener()
setKeyCaptureListener
public void setKeyCaptureListener(KeyCaptureListener l)
update
public void update()
toString
public String toString()
- Overrides:
toString
in class Object