Game Control Plus  1.2.2
 All Classes Namespaces Functions Variables Pages
net.java.games.input.ControllerEnvironment Class Referenceabstract
Inheritance diagram for net.java.games.input.ControllerEnvironment:

Public Member Functions

abstract Controller[] getControllers ()
 
void addControllerListener (ControllerListener l)
 
void removeControllerListener (ControllerListener l)
 

Static Public Member Functions

static ControllerEnvironment getEnvironment ()
 

Protected Member Functions

 ControllerEnvironment ()
 
void fireControllerAdded (Controller c)
 
void fireControllerRemoved (Controller c)
 

Protected Attributes

final ArrayList controllerListeners = new ArrayList()
 

Static Protected Attributes

static final byte MACOSX = 0
 
static final byte WINDOWS = 1
 
static final byte LINUX = 2
 
static final byte OTHER = 3
 
static final byte os = getOS()
 
static final byte wordsize = getWordSize()
 

Static Package Functions

static void logln (String msg)
 
static void log (String msg)
 

Static Private Member Functions

static byte getOS ()
 
static byte getWordSize ()
 

Static Private Attributes

static ControllerEnvironment instance
 

Detailed Description

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.)

Constructor & Destructor Documentation

net.java.games.input.ControllerEnvironment.ControllerEnvironment ( )
protected

Protected constructor for subclassing.

Member Function Documentation

void net.java.games.input.ControllerEnvironment.addControllerListener ( ControllerListener  l)

Adds a listener for controller state change events.

void net.java.games.input.ControllerEnvironment.fireControllerAdded ( Controller  c)
protected

Creates and sends an event to the controller listeners that a controller has been added.

void net.java.games.input.ControllerEnvironment.fireControllerRemoved ( Controller  c)
protected

Creates and sends an event to the controller listeners that a controller has been lost.

abstract Controller [] net.java.games.input.ControllerEnvironment.getControllers ( )
pure virtual

Returns a list of all controllers available to this environment, or an empty array if there are no controllers in this environment.

Implemented in net.java.games.input.DirectInputEnvironmentPlugin, net.java.games.input.OSXEnvironmentPlugin, net.java.games.input.RawInputEnvironmentPlugin, and net.java.games.input.LinuxEnvironmentPlugin.

static ControllerEnvironment net.java.games.input.ControllerEnvironment.getEnvironment ( )
static

Gives back the Environment fitting for your OS

Returns
static byte net.java.games.input.ControllerEnvironment.getOS ( )
staticprivate

Returns the Byte for the OS the lib is running on. 0 for MACOSX 1 for WINDOWS 2 for LINUX 3 for OTHER

Returns
static byte net.java.games.input.ControllerEnvironment.getWordSize ( )
staticprivate

Returns the platform word size.
32 - for 32 bit OS 64 - for 64 bit OS 0 - unknown

void net.java.games.input.ControllerEnvironment.removeControllerListener ( ControllerListener  l)

Removes a listener for controller state change events.

Member Data Documentation

final ArrayList net.java.games.input.ControllerEnvironment.controllerListeners = new ArrayList()
protected

Folder to the native libs List of controller listeners

final byte net.java.games.input.ControllerEnvironment.LINUX = 2
staticprotected

Standing for LINUX

final byte net.java.games.input.ControllerEnvironment.MACOSX = 0
staticprotected

Standing for MACOSX

final byte net.java.games.input.ControllerEnvironment.os = getOS()
staticprotected

System the lib is currently running on, can be MACOSX, WINDOWS, LINUX or OTHER

final byte net.java.games.input.ControllerEnvironment.OTHER = 3
staticprotected

Standing for any other System

final byte net.java.games.input.ControllerEnvironment.WINDOWS = 1
staticprotected

Standing for WINDOWS

final byte net.java.games.input.ControllerEnvironment.wordsize = getWordSize()
staticprotected

Platform specific word size i.e. 32 or 64. If 0 (zero) then it is unknow