Class ControllerEnvironment
- Direct Known Subclasses:
- AWTEnvironmentPlugin,- DirectAndRawInputEnvironmentPlugin,- DirectInputEnvironmentPlugin,- LinuxEnvironmentPlugin,- OSXEnvironmentPlugin,- RawInputEnvironmentPlugin,- WinTabEnvironmentPlugin
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 SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedProtected constructor for subclassing.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a listener for controller state change events.protected voidCreates and sends an event to the controller listeners that a controller has been added.protected voidCreates and sends an event to the controller listeners that a controller has been lost.abstract AbstractController[]Returns a list of all controllers available to this environment, or an empty array if there are no controllers in this environment.static ControllerEnvironmentReturns the default environment for input controllers.abstract booleanReturns the isSupported status of this environment.voidRemoves a listener for controller state change events.abstract AbstractController[]Rescans the devices and provides a list of new controllers.
- 
Field Details- 
controllerListenersList of controller listeners
 
- 
- 
Constructor Details- 
ControllerEnvironmentprotected ControllerEnvironment()Protected constructor for subclassing.
 
- 
- 
Method Details- 
getControllersReturns a list of all controllers available to this environment, or an empty array if there are no controllers in this environment.
- 
rescanControllersRescans the devices and provides a list of new controllers.- Returns:
- a list of all controllers available to this environment.
 
- 
addControllerListenerAdds a listener for controller state change events.
- 
isSupportedpublic abstract boolean isSupported()Returns the isSupported status of this environment. What makes an environment supported or not is up to the particular plugin, but may include OS or available hardware.
- 
removeControllerListenerRemoves a listener for controller state change events.
- 
fireControllerAddedCreates and sends an event to the controller listeners that a controller has been added.
- 
fireControllerRemovedCreates and sends an event to the controller listeners that a controller has been lost.
- 
getDefaultEnvironmentReturns the default environment for input controllers. This usually corresponds to the environment for the local machine.
 
-