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

Public Member Functions

final Controller[] getControllers ()
 
final Component[] getComponents ()
 
final Component getComponent (Component.Identifier id)
 
final Rumbler[] getRumblers ()
 
PortType getPortType ()
 
int getPortNumber ()
 
final String getName ()
 
String toString ()
 
Type getType ()
 
final void setEventQueueSize (int size)
 
final EventQueue getEventQueue ()
 
synchronized boolean poll ()
 

Protected Member Functions

 AbstractController (String name, Component[] components, Controller[] children, Rumbler[] rumblers)
 
void setDeviceEventQueueSize (int size) throws IOException
 
abstract boolean getNextDeviceEvent (Event event) throws IOException
 
void pollDevice () throws IOException
 

Static Package Attributes

static final int EVENT_QUEUE_DEPTH = 32
 

Private Attributes

final String name
 
final Component[] components
 
final Controller[] children
 
final Rumbler[] rumblers
 
final Map id_to_components = new HashMap()
 
EventQueue event_queue = new EventQueue(EVENT_QUEUE_DEPTH)
 

Static Private Attributes

static final Event event = new Event()
 

Detailed Description

An AbstractController is a skeleton implementation of a controller that contains a fixed number of axes, controllers, and rumblers.

Constructor & Destructor Documentation

net.java.games.input.AbstractController.AbstractController ( String  name,
Component[]  components,
Controller[]  children,
Rumbler[]  rumblers 
)
protected

Protected constructor for a controller containing the specified axes, child controllers, and rumblers

Parameters
namename for the controller
componentscomponents for the controller
childrenchild controllers for the controller
rumblersrumblers for the controller

Member Function Documentation

final Component net.java.games.input.AbstractController.getComponent ( Component.Identifier  id)
virtual

Returns a single component based on its identifier, or null if no component with the specified type could be found.

Implements net.java.games.input.Controller.

final Component [] net.java.games.input.AbstractController.getComponents ( )
virtual

Returns the components on this controller, in order of assignment priority. For example, the button controller on a mouse returns an array containing the primary or leftmost mouse button, followed by the secondary or rightmost mouse button (if present), followed by the middle mouse button (if present). The array returned is an empty array if this controller contains no components (such as a logical grouping of child controllers).

Implements net.java.games.input.Controller.

final Controller [] net.java.games.input.AbstractController.getControllers ( )

Returns the controllers connected to make up this controller, or an empty array if this controller contains no child controllers. The objects in the array are returned in order of assignment priority (primary stick, secondary buttons, etc.).

final EventQueue net.java.games.input.AbstractController.getEventQueue ( )
virtual

Get the device event queue

Implements net.java.games.input.Controller.

final String net.java.games.input.AbstractController.getName ( )
virtual

Returns a human-readable name for this Controller.

Implements net.java.games.input.Controller.

int net.java.games.input.AbstractController.getPortNumber ( )
virtual

Returns the zero-based port number for this Controller.

Returns
0 by default, can be overridden

Implements net.java.games.input.Controller.

final Rumbler [] net.java.games.input.AbstractController.getRumblers ( )
virtual

Returns the rumblers for sending feedback to this controller, or an empty array if there are no rumblers on this controller.

Implements net.java.games.input.Controller.

synchronized boolean net.java.games.input.AbstractController.poll ( )
virtual

Polls axes for data. Returns false if the controller is no longer valid. Polling reflects the current state of the device when polled.

Implements net.java.games.input.Controller.

void net.java.games.input.AbstractController.setDeviceEventQueueSize ( int  size) throws IOException
protected

Plugins override this method to adjust their internal event queue size

final void net.java.games.input.AbstractController.setEventQueueSize ( int  size)
virtual

Creates a new EventQueue. Events in old queue are lost.

Implements net.java.games.input.Controller.

String net.java.games.input.AbstractController.toString ( )

Returns a non-localized string description of this controller.

Member Data Documentation

final Controller [] net.java.games.input.AbstractController.children
private

Array of child controllers

final Component [] net.java.games.input.AbstractController.components
private

Array of components

final Map net.java.games.input.AbstractController.id_to_components = new HashMap()
private

Map from Component.Identifiers to Components

final String net.java.games.input.AbstractController.name
private

Human-readable name for this Controller

final Rumbler [] net.java.games.input.AbstractController.rumblers
private

Array of rumblers