components
Class KeyRegistry

java.lang.Object
  extended by components.KeyRegistry

public class KeyRegistry
extends Object

KeyRegistry is a mutable object that stores the key triggers that the game should respond to.

Author:
ruthdhan
Specification Fields :
keyTriggers : set of triples

Constructor Summary
KeyRegistry()
           
 
Method Summary
 void clearDowns(GameObject obj)
          clear all key down triggers assoc with this object
 void clearUps(GameObject obj)
          clear all key up triggers assoc with this object
 Set<Integer> getAllDownKeys()
          get all down key presses that are listened for
 Set<Integer> getAllUpKeys()
          get all up key presses that are listened for
 Set<GameObject> getDown(int key)
           
 Set<Integer> getDowns(GameObject obj)
           
 Set<GameObject> getUp(int key)
           
 Set<Integer> getUps(GameObject obj)
           
 boolean registerDown(int key, GameObject tgt)
           
 boolean registerUp(int key, GameObject tgt)
           
 boolean remove(int key, boolean down, GameObject tgt)
          remove the specified key press from the registry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyRegistry

public KeyRegistry()
Method Detail

registerDown

public boolean registerDown(int key,
                            GameObject tgt)

registerUp

public boolean registerUp(int key,
                          GameObject tgt)

getDown

public Set<GameObject> getDown(int key)

getUp

public Set<GameObject> getUp(int key)

getDowns

public Set<Integer> getDowns(GameObject obj)
Returns:
all keys whose downpresses trigger obj

getUps

public Set<Integer> getUps(GameObject obj)
Returns:
all keys whose upreleases trigger obj

clearDowns

public void clearDowns(GameObject obj)
clear all key down triggers assoc with this object


clearUps

public void clearUps(GameObject obj)
clear all key up triggers assoc with this object


getAllDownKeys

public Set<Integer> getAllDownKeys()
get all down key presses that are listened for


getAllUpKeys

public Set<Integer> getAllUpKeys()
get all up key presses that are listened for


remove

public boolean remove(int key,
                      boolean down,
                      GameObject tgt)
remove the specified key press from the registry