|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.java.games.input.ControllerEnvironment
public abstract class ControllerEnvironment
A ControllerEnvironment represents a collection of controllers that are physically or logically linked. By default, this corresponds to the environment for the local machine.
In this reference implementation, this class can also be used to register controllers with the default environment as "plug-ins". A plug-in is created by subclassing ControllerEnvironment with a class that has a public no-argument constructor, implements the net.java.games.util.plugins.Plugin interface and has a name ending in "Plugin". (See net.java.games.input.DirectInputEnvironmentPlugin in the DXplugin part of the source tree for an example.) When the DefaultControllerEnvrionment is instanced it uses the plugin library to look for Plugins in both [java.home]/lib/controller and [user.dir]/controller. This allows controller plugins to be installed either globally for the entire Java environment or locally for just one particular Java app. For more information on the organization of plugins within the controller root directories, see net.java.games.util.plugins.Plugins (Note the plural -- "Plugins" not "Plugin" which is just a marker interface.)
Field Summary | |
---|---|
protected java.util.ArrayList |
controllerListeners
List of controller listeners |
Constructor Summary | |
---|---|
protected |
ControllerEnvironment()
Protected constructor for subclassing. |
Method Summary | |
---|---|
void |
addControllerListener(ControllerListener l)
Adds a listener for controller state change events. |
protected void |
fireControllerAdded(Controller c)
Creates and sends an event to the controller listeners that a controller has been added. |
protected void |
fireControllerRemoved(Controller c)
Creates and sends an event to the controller listeners that a controller has been lost. |
abstract Controller[] |
getControllers()
Returns a list of all controllers available to this environment, or an empty array if there are no controllers in this environment. |
static ControllerEnvironment |
getDefaultEnvironment()
Returns the default environment for input controllers. |
abstract boolean |
isSupported()
Returns the isSupported status of this environment. |
void |
removeControllerListener(ControllerListener l)
Removes a listener for controller state change events. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.ArrayList controllerListeners
Constructor Detail |
---|
protected ControllerEnvironment()
Method Detail |
---|
public abstract Controller[] getControllers()
public void addControllerListener(ControllerListener l)
public abstract boolean isSupported()
public void removeControllerListener(ControllerListener l)
protected void fireControllerAdded(Controller c)
protected void fireControllerRemoved(Controller c)
public static ControllerEnvironment getDefaultEnvironment()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |