aboutsummaryrefslogtreecommitdiffstats
path: root/coreAPI
diff options
context:
space:
mode:
authorendolf <[email protected]>2004-08-29 21:23:06 +0000
committerendolf <[email protected]>2004-08-29 21:23:06 +0000
commit48d90dc92ba7be418b983bbd523e1fd8c33fa25f (patch)
tree55230e67cf5833c4e5ed50d468c5762aba53382b /coreAPI
parentbc06262ce753ef2dab7ca080aff770730146b7ce (diff)
Changes for Axis.Identifier changes. This includes renaming Axis to Component, and creating the Identifier objects for Key Axis and Button.
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@85 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'coreAPI')
-rw-r--r--coreAPI/src/java/net/java/games/input/AbstractComponent.java (renamed from coreAPI/src/java/net/java/games/input/AbstractAxis.java)4
-rw-r--r--coreAPI/src/java/net/java/games/input/AbstractController.java42
-rw-r--r--coreAPI/src/java/net/java/games/input/Axis.java365
-rw-r--r--coreAPI/src/java/net/java/games/input/Component.java745
-rw-r--r--coreAPI/src/java/net/java/games/input/Controller.java8
-rw-r--r--coreAPI/src/java/net/java/games/input/Keyboard.java63
-rw-r--r--coreAPI/src/java/net/java/games/input/Mouse.java101
-rw-r--r--coreAPI/src/java/net/java/games/input/Rumbler.java2
-rw-r--r--coreAPI/src/java/net/java/games/input/StandardKeyboard.java268
-rw-r--r--coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java63
-rw-r--r--coreAPI/src/java/net/java/games/input/test/ControllerTextTest.java16
11 files changed, 917 insertions, 760 deletions
diff --git a/coreAPI/src/java/net/java/games/input/AbstractAxis.java b/coreAPI/src/java/net/java/games/input/AbstractComponent.java
index b0fa021..b829c1b 100644
--- a/coreAPI/src/java/net/java/games/input/AbstractAxis.java
+++ b/coreAPI/src/java/net/java/games/input/AbstractComponent.java
@@ -41,7 +41,7 @@ package net.java.games.input;
/**
* Skeleton implementation of a named axis.
*/
-public abstract class AbstractAxis implements Axis {
+public abstract class AbstractComponent implements Component {
/**
* Human-readable name for this Axis
@@ -62,7 +62,7 @@ public abstract class AbstractAxis implements Axis {
* Protected constructor
* @param name A name for the axis
*/
- protected AbstractAxis(String name, Identifier id) {
+ protected AbstractComponent(String name, Identifier id) {
this.name = name;
this.id = id;
this.polling = true;
diff --git a/coreAPI/src/java/net/java/games/input/AbstractController.java b/coreAPI/src/java/net/java/games/input/AbstractController.java
index 99ee2da..93475d2 100644
--- a/coreAPI/src/java/net/java/games/input/AbstractController.java
+++ b/coreAPI/src/java/net/java/games/input/AbstractController.java
@@ -47,7 +47,7 @@ public abstract class AbstractController implements Controller {
/**
* Null array representing no axes
*/
- protected static final Axis[] NO_AXES = {};
+ protected static final Component[] NO_COMPONENTS = {};
/**
* Null array representing no child controllers
@@ -65,9 +65,9 @@ public abstract class AbstractController implements Controller {
private final String name;
/**
- * Array of axes
+ * Array of components
*/
- protected Axis[] axes;
+ protected Component[] components;
/**
* Array of child controllers
@@ -85,21 +85,21 @@ public abstract class AbstractController implements Controller {
* @param name The name for the controller
*/
protected AbstractController(String name) {
- this(name, NO_AXES, NO_CONTROLLERS, NO_RUMBLERS);
+ this(name, NO_COMPONENTS, NO_CONTROLLERS, NO_RUMBLERS);
}
/**
* Protected constructor for a controller containing the specified
* axes, child controllers, and rumblers
* @param name name for the controller
- * @param axes axes for the controller
+ * @param components components for the controller
* @param children child controllers for the controller
* @param rumblers rumblers for the controller
*/
- protected AbstractController(String name, Axis[] axes,
+ protected AbstractController(String name, Component[] components,
Controller[] children, Rumbler[] rumblers) {
this.name = name;
- this.axes = axes;
+ this.components = components;
this.children = children;
this.rumblers = rumblers;
}
@@ -115,33 +115,33 @@ public abstract class AbstractController implements Controller {
}
/**
- * Returns the axes on this controller, in order of assignment priority.
+ * 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 axes
+ * The array returned is an empty array if this controller contains no components
* (such as a logical grouping of child controllers).
*/
- public Axis[] getAxes() {
- return axes;
+ public Component[] getComponents() {
+ return components;
}
/**
- * Returns a single axis based on its identifier, or null
- * if no axis with the specified type could be found.
- * By default, AbstractController calls getAxes in this method so that
- * subclasses may lazily initialize the array of axes, if necessary.
+ * Returns a single component based on its identifier, or null
+ * if no component with the specified type could be found.
+ * By default, AbstractController calls getComponents in this method so that
+ * subclasses may lazily initialize the array of components, if necessary.
*/
- public Axis getAxis(Axis.Identifier id) {
+ public Component getComponent(Component.Identifier id) {
// Calls getAxes() so that subclasses may lazily set the array of axes.
- Axis[] axes = getAxes();
- if (axes.length == 0) {
+ Component[] components = getComponents();
+ if (components.length == 0) {
return null;
}
- for (int i = 0; i < axes.length; i++) {
- if (axes[i].getIdentifier() == id) {
- return axes[i];
+ for (int i = 0; i < components.length; i++) {
+ if (components[i].getIdentifier() == id) {
+ return components[i];
}
}
return null;
diff --git a/coreAPI/src/java/net/java/games/input/Axis.java b/coreAPI/src/java/net/java/games/input/Axis.java
deleted file mode 100644
index 438f37f..0000000
--- a/coreAPI/src/java/net/java/games/input/Axis.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * %W% %E%
- *
- * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
- * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
- */
-/*****************************************************************************
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistribution of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materails provided with the distribution.
- *
- * Neither the name Sun Microsystems, Inc. or the names of the contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind.
- * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
- * ANY IMPLIED WARRANT OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMEN, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND
- * ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS
- * A RESULT OF USING, MODIFYING OR DESTRIBUTING THIS SOFTWARE OR ITS
- * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
- * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
- * INCIDENTAL OR PUNITIVE DAMAGES. HOWEVER CAUSED AND REGARDLESS OF THE THEORY
- * OF LIABILITY, ARISING OUT OF THE USE OF OUR INABILITY TO USE THIS SOFTWARE,
- * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for us in
- * the design, construction, operation or maintenance of any nuclear facility
- *
- *****************************************************************************/
-package net.java.games.input;
-
-/**
- * An axis is a single button, slider, or dial, which has a single range. An
- * axis can hold information for motion (linear or rotational), velocity,
- * force, or acceleration.
- */
-public interface Axis {
-
- /**
- * Returns the identifier of the axis.
- */
- public abstract Identifier getIdentifier();
-
- /**
- * Returns <code>true</code> if data returned from <code>poll</code>
- * is relative to the last call, or <code>false</code> if data
- * is absolute.
- */
- public abstract boolean isRelative();
-
- /**
- * Returns whether or not the axis is analog, or false if it is digital.
- */
- public abstract boolean isAnalog();
-
- /**
- * Returns whether or not data polled from this axis is normalized
- * between the values of -1.0f and 1.0f.
- * @see #getPollData
- */
- public abstract boolean isNormalized();
-
- /**
- * Returns whether or not this axis is ready to receive polling data.
- * @see #getPollData
- * @see Controller#poll
- * @see #setPolling
- */
- public abstract boolean isPolling();
-
- /**
- * Sets whether or not the axis should receive polling data.
- * @see #getPollData
- * @see Controller#poll
- * @see #isPolling
- */
- public abstract void setPolling(boolean polling);
-
- /**
- * Returns the suggested dead zone for this axis. Dead zone is the
- * amount polled data can vary before considered a significant change
- * in value. An application can safely ignore changes less than this
- * value in the positive or negative direction.
- * @see #getPollData
- */
- public abstract float getDeadZone();
-
- /**
- * Returns the data from the last time the control has been polled.
- * If this axis is a button, the value returned will be either 0.0f or 1.0f.
- * If this axis is normalized, the value returned will be between -1.0f and
- * 1.0f.
- * @see Controller#poll
- */
- public abstract float getPollData();
-
- /**
- * Returns a human-readable name for this axis.
- */
- public abstract String getName();
-
- /**
- * Identifiers for different Axes.
- */
- public static class Identifier {
-
- /**
- * Name of axis type
- */
- private final String name;
-
- /**
- * Protected constructor
- */
- protected Identifier(String name) {
- this.name = name;
- }
-
- /**
- * Returns a non-localized string description of this axis type.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns a non-localized string description of this axis type.
- */
- public String toString() {
- return name;
- }
-
- /**
- * An axis for specifying vertical data.
- */
- public static final Identifier X = new Identifier("x");
-
- /**
- * An axis for specifying horizontal data.
- */
- public static final Identifier Y = new Identifier("y");
-
- /**
- * An axis for specifying third dimensional up/down
- * data, or linear data in any direction that is
- * neither horizontal nor vertical.
- */
- public static final Identifier Z = new Identifier("z");
-
- /**
- * An axis for specifying left-right rotational data.
- */
- public static final Identifier RX = new Identifier("rx");
-
- /**
- * An axis for specifying forward-back rotational data.
- */
- public static final Identifier RY = new Identifier("ry");
-
- /**
- * An axis for specifying up-down rotational data
- * (rudder control).
- */
- public static final Identifier RZ = new Identifier("rz");
-
- /**
- * An axis for a button or key.
- */
- public static final Identifier BUTTON = new Identifier("button");
-
- /**
- * An axis for a slider or mouse wheel.
- */
- public static final Identifier SLIDER = new Identifier("slider");
-
- /**
- * An axis for a point-of-view control.
- */
- public static final Identifier POV = new Identifier("pov");
-
- /**
- * An axis for specifying vertical velocity data.
- */
- public static final Identifier X_VELOCITY =
- new Identifier("x-velocity");
-
- /**
- * An axis for specifying horizontal velocity data.
- */
- public static final Identifier Y_VELOCITY =
- new Identifier("y-velocity");
-
- /**
- * An axis for specifying third dimensional up/down velocity
- * data.
- */
- public static final Identifier Z_VELOCITY =
- new Identifier("z-velocity");
-
- /**
- * An axis for specifying left-right angular velocity data.
- */
- public static final Identifier RX_VELOCITY =
- new Identifier("rx-velocity");
-
- /**
- * An axis for specifying forward-back angular velocity data.
- */
- public static final Identifier RY_VELOCITY =
- new Identifier("ry-velocity");
-
- /**
- * An axis for specifying up-down angular velocity data.
- */
- public static final Identifier RZ_VELOCITY =
- new Identifier("rz-velocity");
-
- /**
- * An axis for slider or mouse wheel velocity data.
- */
- public static final Identifier SLIDER_VELOCITY =
- new Identifier("slider-velocity");
-
- /**
- * An axis for specifying vertical acceleration data.
- */
- public static final Identifier X_ACCELERATION =
- new Identifier("x-acceleration");
-
- /**
- * An axis for specifying horizontal acceleration data.
- */
- public static final Identifier Y_ACCELERATION =
- new Identifier("y-acceleration");
-
- /**
- * An axis for specifying third dimensional up/down acceleration
- * data.
- */
- public static final Identifier Z_ACCELERATION =
- new Identifier("z-acceleration");
-
- /**
- * An axis for specifying left-right angular acceleration data.
- */
- public static final Identifier RX_ACCELERATION =
- new Identifier("rx-acceleration");
-
- /**
- * An axis for specifying forward-back angular acceleration data.
- */
- public static final Identifier RY_ACCELERATION =
- new Identifier("ry-acceleration");
-
- /**
- * An axis for specifying up-down angular acceleration data.
- */
- public static final Identifier RZ_ACCELERATION =
- new Identifier("rz-acceleration");
-
- /**
- * An axis for slider or mouse wheel acceleration data.
- */
- public static final Identifier SLIDER_ACCELERATION =
- new Identifier("slider-acceleration");
-
- /**
- * An axis for specifying vertical force data.
- */
- public static final Identifier X_FORCE =
- new Identifier("x-force");
-
- /**
- * An axis for specifying horizontal force data.
- */
- public static final Identifier Y_FORCE =
- new Identifier("y-force");
-
- /**
- * An axis for specifying third dimensional up/down force
- * data.
- */
- public static final Identifier Z_FORCE =
- new Identifier("z-force");
-
- /**
- * An axis for specifying left-right angular force (torque) data.
- */
- public static final Identifier RX_FORCE =
- new Identifier("rx-force");
-
- /**
- * An axis for specifying forward-back angular force (torque) data.
- */
- public static final Identifier RY_FORCE =
- new Identifier("ry-force");
-
- /**
- * An axis for specifying up-down angular force (torque) data.
- */
- public static final Identifier RZ_FORCE =
- new Identifier("rz-force");
-
- /**
- * An axis for slider force data.
- */
- public static final Identifier SLIDER_FORCE =
- new Identifier("slider-force");
- } // class Axis.Identifier
-
- /**
- * POV enum for different positions.
- */
- public static class POV {
- /**
- * Standard value for center HAT position
- */
- public static final float OFF = 0.0f;
- /**
- * Synonmous with OFF
- */
- public static final float CENTER = OFF;
- /**
- * Standard value for up-left HAT position
- */
- public static final float UP_LEFT = 0.125f;
- /**
- * Standard value for up HAT position
- */
- public static final float UP = 0.25f;
- /**
- * Standard value for up-right HAT position
- */
- public static final float UP_RIGHT = 0.375f;
- /**
- * Standard value for right HAT position
- */
- public static final float RIGHT = 0.50f;
- /**
- * Standard value for down-right HAT position
- */
- public static final float DOWN_RIGHT = 0.625f;
- /**
- * Standard value for down HAT position
- */
- public static final float DOWN = 0.75f;
- /**
- * Standard value for down-left HAT position
- */
- public static final float DOWN_LEFT = 0.875f;
- /**
- * Standard value for left HAT position
- */
- public static final float LEFT = 1.0f;
- } // class Axis.POV
-} // interface Axis
diff --git a/coreAPI/src/java/net/java/games/input/Component.java b/coreAPI/src/java/net/java/games/input/Component.java
new file mode 100644
index 0000000..d6ff31d
--- /dev/null
+++ b/coreAPI/src/java/net/java/games/input/Component.java
@@ -0,0 +1,745 @@
+/*
+ * %W% %E%
+ *
+ * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+/*****************************************************************************
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistribution of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materails provided with the distribution.
+ *
+ * Neither the name Sun Microsystems, Inc. or the names of the contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind.
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+ * ANY IMPLIED WARRANT OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NON-INFRINGEMEN, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND
+ * ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS
+ * A RESULT OF USING, MODIFYING OR DESTRIBUTING THIS SOFTWARE OR ITS
+ * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
+ * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
+ * INCIDENTAL OR PUNITIVE DAMAGES. HOWEVER CAUSED AND REGARDLESS OF THE THEORY
+ * OF LIABILITY, ARISING OUT OF THE USE OF OUR INABILITY TO USE THIS SOFTWARE,
+ * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for us in
+ * the design, construction, operation or maintenance of any nuclear facility
+ *
+ *****************************************************************************/
+package net.java.games.input;
+
+/**
+ * An axis is a single button, slider, or dial, which has a single range. An
+ * axis can hold information for motion (linear or rotational), velocity,
+ * force, or acceleration.
+ */
+public interface Component {
+
+ /**
+ * Returns the identifier of the axis.
+ */
+ public abstract Identifier getIdentifier();
+
+ /**
+ * Returns <code>true</code> if data returned from <code>poll</code>
+ * is relative to the last call, or <code>false</code> if data
+ * is absolute.
+ */
+ public abstract boolean isRelative();
+
+ /**
+ * Returns whether or not the axis is analog, or false if it is digital.
+ */
+ public abstract boolean isAnalog();
+
+ /**
+ * Returns whether or not data polled from this axis is normalized
+ * between the values of -1.0f and 1.0f.
+ * @see #getPollData
+ */
+ public abstract boolean isNormalized();
+
+ /**
+ * Returns whether or not this axis is ready to receive polling data.
+ * @see #getPollData
+ * @see Controller#poll
+ * @see #setPolling
+ */
+ public abstract boolean isPolling();
+
+ /**
+ * Sets whether or not the axis should receive polling data.
+ * @see #getPollData
+ * @see Controller#poll
+ * @see #isPolling
+ */
+ public abstract void setPolling(boolean polling);
+
+ /**
+ * Returns the suggested dead zone for this axis. Dead zone is the
+ * amount polled data can vary before considered a significant change
+ * in value. An application can safely ignore changes less than this
+ * value in the positive or negative direction.
+ * @see #getPollData
+ */
+ public abstract float getDeadZone();
+
+ /**
+ * Returns the data from the last time the control has been polled.
+ * If this axis is a button, the value returned will be either 0.0f or 1.0f.
+ * If this axis is normalized, the value returned will be between -1.0f and
+ * 1.0f.
+ * @see Controller#poll
+ */
+ public abstract float getPollData();
+
+ /**
+ * Returns a human-readable name for this axis.
+ */
+ public abstract String getName();
+
+ /**
+ * Identifiers for different Axes.
+ */
+ public static class Identifier {
+
+ /**
+ * Name of axis type
+ */
+ private final String name;
+
+ /**
+ * Protected constructor
+ */
+ protected Identifier(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns a non-localized string description of this axis type.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns a non-localized string description of this axis type.
+ */
+ public String toString() {
+ return name;
+ }
+
+ public static class Axis extends Identifier {
+
+ /**
+ * @param name
+ */
+ protected Axis(String name) {
+ super(name);
+ }
+
+ /**
+ * An axis for specifying vertical data.
+ */
+ public static final Axis X = new Axis("x");
+
+ /**
+ * An axis for specifying horizontal data.
+ */
+ public static final Axis Y = new Axis("y");
+
+ /**
+ * An axis for specifying third dimensional up/down
+ * data, or linear data in any direction that is
+ * neither horizontal nor vertical.
+ */
+ public static final Axis Z = new Axis("z");
+
+ /**
+ * An axis for specifying left-right rotational data.
+ */
+ public static final Axis RX = new Axis("rx");
+
+ /**
+ * An axis for specifying forward-back rotational data.
+ */
+ public static final Axis RY = new Axis("ry");
+
+ /**
+ * An axis for specifying up-down rotational data
+ * (rudder control).
+ */
+ public static final Axis RZ = new Axis("rz");
+
+ /**
+ * An axis for a slider or mouse wheel.
+ */
+ public static final Axis SLIDER = new Axis("slider");
+
+ /**
+ * An axis for slider or mouse wheel acceleration data.
+ */
+ public static final Axis SLIDER_ACCELERATION = new Axis("slider-acceleration");
+
+ /**
+ * An axis for slider force data.
+ */
+ public static final Axis SLIDER_FORCE = new Axis("slider-force");
+
+ /**
+ * An axis for slider or mouse wheel velocity data.
+ */
+ public static final Axis SLIDER_VELOCITY = new Axis("slider-velocity");
+
+ /**
+ * An axis for specifying vertical acceleration data.
+ */
+ public static final Axis X_ACCELERATION = new Axis("x-acceleration");
+
+ /**
+ * An axis for specifying vertical force data.
+ */
+ public static final Axis X_FORCE = new Axis("x-force");
+
+ /**
+ * An axis for specifying vertical velocity data.
+ */
+ public static final Axis X_VELOCITY = new Axis("x-velocity");
+
+ /**
+ * An axis for specifying horizontal acceleration data.
+ */
+ public static final Axis Y_ACCELERATION = new Axis("y-acceleration");
+
+ /**
+ * An axis for specifying horizontal force data.
+ */
+ public static final Axis Y_FORCE = new Axis("y-force");
+
+ /**
+ * An axis for specifying horizontal velocity data.
+ */
+ public static final Axis Y_VELOCITY = new Axis("y-velocity");
+
+ /**
+ * An axis for specifying third dimensional up/down acceleration data.
+ */
+ public static final Axis Z_ACCELERATION = new Axis("z-acceleration");
+
+ /**
+ * An axis for specifying third dimensional up/down force data.
+ */
+ public static final Axis Z_FORCE = new Axis("z-force");
+
+ /**
+ * An axis for specifying third dimensional up/down velocity data.
+ */
+ public static final Axis Z_VELOCITY = new Axis("z-velocity");
+
+ /**
+ * An axis for specifying left-right angular acceleration data.
+ */
+ public static final Axis RX_ACCELERATION = new Axis("rx-acceleration");
+
+ /**
+ * An axis for specifying left-right angular force (torque) data.
+ */
+ public static final Axis RX_FORCE = new Axis("rx-force");
+
+ /**
+ * An axis for specifying left-right angular velocity data.
+ */
+ public static final Axis RX_VELOCITY = new Axis("rx-velocity");
+
+ /**
+ * An axis for specifying forward-back angular acceleration data.
+ */
+ public static final Axis RY_ACCELERATION = new Axis("ry-acceleration");
+
+ /**
+ * An axis for specifying forward-back angular force (torque) data.
+ */
+ public static final Axis RY_FORCE = new Axis("ry-force");
+
+ /**
+ * An axis for specifying forward-back angular velocity data.
+ */
+ public static final Axis RY_VELOCITY = new Axis("ry-velocity");
+
+ /**
+ * An axis for specifying up-down angular acceleration data.
+ */
+ public static final Axis RZ_ACCELERATION = new Axis("rz-acceleration");
+
+ /**
+ * An axis for specifying up-down angular force (torque) data.
+ */
+ public static final Axis RZ_FORCE = new Axis("rz-force");
+
+ /**
+ * An axis for specifying up-down angular velocity data.
+ */
+ public static final Axis RZ_VELOCITY = new Axis("rz-velocity");
+
+ /**
+ * An axis for a point-of-view control.
+ */
+ public static final Axis POV = new Axis("pov");
+
+ }
+
+ public static class Button extends Identifier {
+
+ public Button(String name) {
+ super(name);
+ }
+
+ /** First device button
+ */
+ public static final Button _0 = new Button("0");
+
+ /** Second device button
+ */
+ public static final Button _1 = new Button("1");
+
+ /** Thrid device button
+ */
+ public static final Button _2 = new Button("2");
+
+ /** Fourth device button
+ */
+ public static final Button _3 = new Button("3");
+
+ /** Fifth device button
+ */
+ public static final Button _4 = new Button("4");
+
+ /** Sixth device button
+ */
+ public static final Button _5 = new Button("5");
+
+ /** Seventh device button
+ */
+ public static final Button _6 = new Button("6");
+
+ /** Eighth device button
+ */
+ public static final Button _7 = new Button("7");
+
+ /** Ninth device button
+ */
+ public static final Button _8 = new Button("8");
+
+ /** 10th device button
+ */
+ public static final Button _9 = new Button("9");
+
+ /** Joystick trigger button
+ */
+ public static final Button TRIGGER = new Button("Trigger");
+
+ /** Joystick thumb button
+ */
+ public static final Button THUMB = new Button("Thumb");
+
+ /** Second joystick thumb button
+ */
+ public static final Button THUMB2 = new Button("Thumb 2");
+
+ /** Joystick top button
+ */
+ public static final Button TOP = new Button("Top");
+
+ /** Second joystick top button
+ */
+ public static final Button TOP2 = new Button("Top 2");
+
+ /** The joystick button you play with with you little finger (Pinkie on *that* side
+ * of the pond :P)
+ */
+ public static final Button PINKIE = new Button("Pinkie");
+
+ /** Joystick button on the base of the device
+ */
+ public static final Button BASE = new Button("Base");
+
+ /** Second joystick button on the base of the device
+ */
+ public static final Button BASE2 = new Button("Base 2");
+
+ /** Thrid joystick button on the base of the device
+ */
+ public static final Button BASE3 = new Button("Base 3");
+
+ /** Fourth joystick button on the base of the device
+ */
+ public static final Button BASE4 = new Button("Base 4");
+
+ /** Fifth joystick button on the base of the device
+ */
+ public static final Button BASE5 = new Button("Base 5");
+
+ /** Sixth joystick button on the base of the device
+ */
+ public static final Button BASE6 = new Button("Base 6");
+
+ /** erm, dunno, but it's in the defines so it might exist.
+ */
+ public static final Button DEAD = new Button("Dead");
+
+ /** 'A' button on a gamepad
+ */
+ public static final Button A = new Button("A");
+
+ /** 'B' button on a gamepad
+ */
+ public static final Button B = new Button("B");
+
+ /** 'C' button on a gamepad
+ */
+ public static final Button C = new Button("C");
+
+ /** 'X' button on a gamepad
+ */
+ public static final Button X = new Button("X");
+
+ /** 'Y' button on a gamepad
+ */
+ public static final Button Y = new Button("Y");
+
+ /** 'Z' button on a gamepad
+ */
+ public static final Button Z = new Button("Z");
+
+ /** Left thumb button on a gamepad
+ */
+ public static final Button LEFT_THUMB = new Button("Left Thumb");
+
+ /** Right thumb button on a gamepad
+ */
+ public static final Button RIGHT_THUMB = new Button("Right Thumb");
+
+ /** Second left thumb button on a gamepad
+ */
+ public static final Button LEFT_THUMB2 = new Button("Left Thumb 2");
+
+ /** Second right thumb button on a gamepad
+ */
+ public static final Button RIGHT_THUMB2 = new Button("Right Thumb 2");
+
+ /** 'Select' button on a gamepad
+ */
+ public static final Button SELECT = new Button("Select");
+
+ /** 'Mode' button on a gamepad
+ */
+ public static final Button MODE = new Button("Mode");
+
+ /** Another left thumb button on a gamepad (how many thumbs do you have??)
+ */
+ public static final Button LEFT_THUMB3 = new Button("Left Thumb 3");
+
+ /** Another right thumb button on a gamepad
+ */
+ public static final Button RIGHT_THUMB3 = new Button("Right Thumb 3");
+
+ /** Digitiser pen tool button
+ */
+ public static final Button TOOL_PEN = new Button("Pen");
+
+ /** Digitiser rubber (eraser) tool button
+ */
+ public static final Button TOOL_RUBBER = new Button("Rubber");
+
+ /** Digitiser brush tool button
+ */
+ public static final Button TOOL_BRUSH = new Button("Brush");
+
+ /** Digitiser pencil tool button
+ */
+ public static final Button TOOL_PENCIL = new Button("Pencil");
+
+ /** Digitiser airbrush tool button
+ */
+ public static final Button TOOL_AIRBRUSH = new Button("Airbrush");
+
+ /** Digitiser finger tool button
+ */
+ public static final Button TOOL_FINGER = new Button("Finger");
+
+ /** Digitiser mouse tool button
+ */
+ public static final Button TOOL_MOUSE = new Button("Mouse");
+
+ /** Digitiser lens tool button
+ */
+ public static final Button TOOL_LENS = new Button("Lens");
+
+ /** Digitiser touch button
+ */
+ public static final Button TOUCH = new Button("Touch");
+
+ /** Digitiser stylus button
+ */
+ public static final Button STYLUS = new Button("Stylus");
+
+ /** Second digitiser stylus button
+ */
+ public static final Button STYLUS2 = new Button("Stylus 2");
+
+ /**
+ * An unknown button
+ */
+ public static final Button UNKNOWN = new Button("Unknown");
+
+ /**
+ * Returns the back mouse button.
+ */
+ public static final Button BACK = new Button("Back");
+
+ /**
+ * Returns the extra mouse button.
+ */
+ public static final Button EXTRA = new Button("Extra");
+
+ /**
+ * Returns the forward mouse button.
+ */
+ public static final Button FORWARD = new Button("Forward");
+
+ /**
+ * The primary or leftmost mouse button.
+ */
+ public static final Button LEFT = new Button("Left");
+
+ /**
+ * Returns the middle mouse button, not present if the mouse has fewer than three buttons.
+ */
+ public static final Button MIDDLE = new Button("Middle");
+
+ /**
+ * The secondary or rightmost mouse button, not present if the mouse is a single-button mouse.
+ */
+ public static final Button RIGHT = new Button("Right");
+
+ /**
+ * Returns the side mouse button.
+ */
+ public static final Button SIDE = new Button("Side");
+
+ }
+
+ /**
+ * KeyIDs for standard PC (LATIN-1) keyboards
+ */
+ public static class Key extends Identifier {
+
+ private int keyID;
+
+ /**
+ * Protected constructor
+ */
+ protected Key(String name, int keyID) {
+ super(name);
+ this.keyID = keyID;
+ }
+
+ protected Key(int keyID) {
+ this("Key " + keyID, keyID);
+ }
+
+ public int getKeyIndex() {
+ return keyID;
+ }
+
+ /**
+ * Standard keyboard (LATIN-1) keys
+ * UNIX X11 keysym values are listed to the right
+ */
+ public static final Key VOID = new Key("Void", 0); // MS 0x00 UNIX 0xFFFFFF
+ public static final Key ESCAPE = new Key("Escape", 1); // MS 0x01 UNIX 0xFF1B
+ public static final Key _1 = new Key("1", 2); // MS 0x02 UNIX 0x031 EXCLAM 0x021
+ public static final Key _2 = new Key("2", 3); // MS 0x03 UNIX 0x032 AT 0x040
+ public static final Key _3 = new Key("3", 4); // MS 0x04 UNIX 0x033 NUMBERSIGN 0x023
+ public static final Key _4 = new Key("4", 5); // MS 0x05 UNIX 0x034 DOLLAR 0x024
+ public static final Key _5 = new Key("5", 6); // MS 0x06 UNIX 0x035 PERCENT 0x025
+ public static final Key _6 = new Key("6", 7); // MS 0x07 UNIX 0x036 CIRCUMFLEX 0x05e
+ public static final Key _7 = new Key("7", 8); // MS 0x08 UNIX 0x037 AMPERSAND 0x026
+ public static final Key _8 = new Key("8", 9); // MS 0x09 UNIX 0x038 ASTERISK 0x02a
+ public static final Key _9 = new Key("9", 10); // MS 0x0A UNIX 0x039 PARENLEFT 0x028
+ public static final Key _0 = new Key("0", 11); // MS 0x0B UNIX 0x030 PARENRIGHT 0x029
+ public static final Key MINUS = new Key("-", 12); // MS 0x0C UNIX 0x02d UNDERSCORE 0x05f
+ public static final Key EQUALS = new Key("=", 13); // MS 0x0D UNIX 0x03d PLUS 0x02b
+ public static final Key BACK = new Key("Back", 14); // MS 0x0E UNIX 0xFF08
+ public static final Key TAB = new Key("Tab", 15); // MS 0x0F UNIX 0xFF09
+ public static final Key Q = new Key("Q", 16); // MS 0x10 UNIX 0x071 UPPER 0x051
+ public static final Key W = new Key("W", 17); // MS 0x11 UNIX 0x077 UPPER 0x057
+ public static final Key E = new Key("E", 18); // MS 0x12 UNIX 0x065 UPPER 0x045
+ public static final Key R = new Key("R", 19); // MS 0x13 UNIX 0x072 UPPER 0x052
+ public static final Key T = new Key("T", 20); // MS 0x14 UNIX 0x074 UPPER 0x054
+ public static final Key Y = new Key("Y", 21); // MS 0x15 UNIX 0x079 UPPER 0x059
+ public static final Key U = new Key("U", 22); // MS 0x16 UNIX 0x075 UPPER 0x055
+ public static final Key I = new Key("I", 23); // MS 0x17 UNIX 0x069 UPPER 0x049
+ public static final Key O = new Key("O", 24); // MS 0x18 UNIX 0x06F UPPER 0x04F
+ public static final Key P = new Key("P", 25); // MS 0x19 UNIX 0x070 UPPER 0x050
+ public static final Key LBRACKET = new Key("[", 26); // MS 0x1A UNIX 0x05b BRACE 0x07b
+ public static final Key RBRACKET = new Key("]", 27); // MS 0x1B UNIX 0x05d BRACE 0x07d
+ public static final Key RETURN = new Key("Return", 28); // MS 0x1C UNIX 0xFF0D
+ public static final Key LCONTROL = new Key("Left Control", 29); // MS 0x1D UNIX 0xFFE3
+ public static final Key A = new Key("A", 30); // MS 0x1E UNIX 0x061 UPPER 0x041
+ public static final Key S = new Key("S", 31); // MS 0x1F UNIX 0x073 UPPER 0x053
+ public static final Key D = new Key("D", 32); // MS 0x20 UNIX 0x064 UPPER 0x044
+ public static final Key F = new Key("F", 33); // MS 0x21 UNIX 0x066 UPPER 0x046
+ public static final Key G = new Key("G", 34); // MS 0x22 UNIX 0x067 UPPER 0x047
+ public static final Key H = new Key("H", 35); // MS 0x23 UNIX 0x068 UPPER 0x048
+ public static final Key J = new Key("J", 36); // MS 0x24 UNIX 0x06A UPPER 0x04A
+ public static final Key K = new Key("K", 37); // MS 0x25 UNIX 0x06B UPPER 0x04B
+ public static final Key L = new Key("L", 38); // MS 0x26 UNIX 0x06C UPPER 0x04C
+ public static final Key SEMICOLON = new Key(";", 39); // MS 0x27 UNIX 0x03b COLON 0x03a
+ public static final Key APOSTROPHE = new Key("'", 40); // MS 0x28 UNIX 0x027 QUOTEDBL 0x022
+ public static final Key GRAVE = new Key("~", 41); // MS 0x29 UNIX 0x060 TILDE 0x07e
+ public static final Key LSHIFT = new Key("Left Shift", 42); // MS 0x2A UNIX 0xFFE1
+ public static final Key BACKSLASH = new Key("\\", 43); // MS 0x2B UNIX 0x05c BAR 0x07c
+ public static final Key Z = new Key("Z", 44); // MS 0x2C UNIX 0x07A UPPER 0x05A
+ public static final Key X = new Key("X", 45); // MS 0x2D UNIX 0x078 UPPER 0x058
+ public static final Key C = new Key("C", 46); // MS 0x2E UNIX 0x063 UPPER 0x043
+ public static final Key V = new Key("V", 47); // MS 0x2F UNIX 0x076 UPPER 0x056
+ public static final Key B = new Key("B", 48); // MS 0x30 UNIX 0x062 UPPER 0x042
+ public static final Key N = new Key("N", 49); // MS 0x31 UNIX 0x06E UPPER 0x04E
+ public static final Key M = new Key("M", 50); // MS 0x32 UNIX 0x06D UPPER 0x04D
+ public static final Key COMMA = new Key(",", 51); // MS 0x33 UNIX 0x02c LESS 0x03c
+ public static final Key PERIOD = new Key(".", 52); // MS 0x34 UNIX 0x02e GREATER 0x03e
+ public static final Key SLASH = new Key("/", 53); // MS 0x35 UNIX 0x02f QUESTION 0x03f
+ public static final Key RSHIFT = new Key("Right Shift", 54); // MS 0x36 UNIX 0xFFE2
+ public static final Key MULTIPLY = new Key("Multiply", 55); // MS 0x37 UNIX 0xFFAA
+ public static final Key LALT = new Key("Left Alt", 56); // MS 0x38 UNIX 0xFFE9
+ public static final Key SPACE = new Key(" ", 57); // MS 0x39 UNIX 0x020
+ public static final Key CAPITAL = new Key("Caps Lock", 58); // MS 0x3A UNIX 0xFFE5 SHIFTLOCK 0xFFE6
+ public static final Key F1 = new Key("F1", 59); // MS 0x3B UNIX 0xFFBE
+ public static final Key F2 = new Key("F2", 60); // MS 0x3C UNIX 0xFFBF
+ public static final Key F3 = new Key("F3", 61); // MS 0x3D UNIX 0xFFC0
+ public static final Key F4 = new Key("F4", 62); // MS 0x3E UNIX 0xFFC1
+ public static final Key F5 = new Key("F5", 63); // MS 0x3F UNIX 0xFFC2
+ public static final Key F6 = new Key("F6", 64); // MS 0x40 UNIX 0xFFC3
+ public static final Key F7 = new Key("F7", 65); // MS 0x41 UNIX 0xFFC4
+ public static final Key F8 = new Key("F8", 66); // MS 0x42 UNIX 0xFFC5
+ public static final Key F9 = new Key("F9", 67); // MS 0x43 UNIX 0xFFC6
+ public static final Key F10 = new Key("F10", 68); // MS 0x44 UNIX 0xFFC7
+ public static final Key NUMLOCK = new Key("Num Lock", 69); // MS 0x45 UNIX 0xFF7F
+ public static final Key SCROLL = new Key("Scroll Lock", 70); // MS 0x46 UNIX 0xFF14
+ public static final Key NUMPAD7 = new Key("Num 7", 71); // MS 0x47 UNIX 0xFFB7 HOME 0xFF95
+ public static final Key NUMPAD8 = new Key("Num 8", 72); // MS 0x48 UNIX 0xFFB8 UP 0xFF97
+ public static final Key NUMPAD9 = new Key("Num 9", 73); // MS 0x49 UNIX 0xFFB9 PRIOR 0xFF9A
+ public static final Key SUBTRACT = new Key("Num -", 74); // MS 0x4A UNIX 0xFFAD
+ public static final Key NUMPAD4 = new Key("Num 4", 75); // MS 0x4B UNIX 0xFFB4 LEFT 0xFF96
+ public static final Key NUMPAD5 = new Key("Num 5", 76); // MS 0x4C UNIX 0xFFB5
+ public static final Key NUMPAD6 = new Key("Num 6", 77); // MS 0x4D UNIX 0xFFB6 RIGHT 0xFF98
+ public static final Key ADD = new Key("Num +", 78); // MS 0x4E UNIX 0xFFAB
+ public static final Key NUMPAD1 = new Key("Num 1", 79); // MS 0x4F UNIX 0xFFB1 END 0xFF9C
+ public static final Key NUMPAD2 = new Key("Num 2", 80); // MS 0x50 UNIX 0xFFB2 DOWN 0xFF99
+ public static final Key NUMPAD3 = new Key("Num 3", 81); // MS 0x51 UNIX 0xFFB3 NEXT 0xFF9B
+ public static final Key NUMPAD0 = new Key("Num 0", 82); // MS 0x52 UNIX 0xFFB0 INSERT 0xFF9E
+ public static final Key DECIMAL = new Key("Num .", 83); // MS 0x53 UNIX 0xFFAE DELETE 0xFF9F
+ public static final Key F11 = new Key("F11", 84); // MS 0x57 UNIX 0xFFC8
+ public static final Key F12 = new Key("F12", 85); // MS 0x58 UNIX 0xFFC9
+ public static final Key F13 = new Key("F13", 86); // MS 0x64 UNIX 0xFFCA
+ public static final Key F14 = new Key("F14", 87); // MS 0x65 UNIX 0xFFCB
+ public static final Key F15 = new Key("F15", 88); // MS 0x66 UNIX 0xFFCC
+ public static final Key KANA = new Key(89); // MS 0x70 UNIX 0xFF2D
+ public static final Key CONVERT = new Key(90); // MS 0x79 Japanese keyboard
+ public static final Key NOCONVERT = new Key(91); // MS 0x7B Japanese keyboard
+ public static final Key YEN = new Key(92); // MS 0x7D UNIX 0x0a5
+ public static final Key NUMPADEQUAL = new Key("Num =", 93); // MS 0x8D UNIX 0xFFBD
+ public static final Key CIRCUMFLEX = new Key(94); // MS 0x90 Japanese keyboard
+ public static final Key AT = new Key(95); // MS 0x91 UNIX 0x040
+ public static final Key COLON = new Key(96); // MS 0x92 UNIX 0x03a
+ public static final Key UNDERLINE = new Key(97); // MS 0x93 NEC PC98
+ public static final Key KANJI = new Key(98); // MS 0x94 UNIX 0xFF21
+ public static final Key STOP = new Key(99); // MS 0x95 UNIX 0xFF69
+ public static final Key AX = new Key(100); // MS 0x96 Japan AX
+ public static final Key UNLABELED = new Key(101); // MS 0x97 J3100
+ public static final Key NUMPADENTER = new Key("Num Enter", 102); // MS 0x9C UNIX 0xFF8D
+ public static final Key RCONTROL = new Key("Right Control", 103); // MS 0x9D UNIX 0xFFE4
+ public static final Key NUMPADCOMMA = new Key("Num ,", 104); // MS 0xB3 UNIX 0xFFAC
+ public static final Key DIVIDE = new Key("Num /", 105); // MS 0xB5 UNIX 0xFFAF
+ public static final Key SYSRQ = new Key(106); // MS 0xB7 UNIX 0xFF15 PRINT 0xFF61
+ public static final Key RALT = new Key("Right Alt", 107); // MS 0xB8 UNIX 0xFFEA
+ public static final Key PAUSE = new Key("Pause", 108); // MS 0xC5 UNIX 0xFF13 BREAK 0xFF6B
+ public static final Key HOME = new Key("Home", 109); // MS 0xC7 UNIX 0xFF50
+ public static final Key UP = new Key("Up", 110); // MS 0xC8 UNIX 0xFF52
+ public static final Key PAGEUP = new Key("Pg Up", 111); // MS 0xC9 UNIX 0xFF55
+ public static final Key LEFT = new Key("Left", 112); // MS 0xCB UNIX 0xFF51
+ public static final Key RIGHT = new Key("Right", 113); // MS 0xCD UNIX 0xFF53
+ public static final Key END = new Key("End", 114); // MS 0xCF UNIX 0xFF57
+ public static final Key DOWN = new Key("Down", 115); // MS 0xD0 UNIX 0xFF54
+ public static final Key PAGEDOWN = new Key("Pg Down", 116); // MS 0xD1 UNIX 0xFF56
+ public static final Key INSERT = new Key("Insert", 117); // MS 0xD2 UNIX 0xFF63
+ public static final Key DELETE = new Key("Delete", 118); // MS 0xD3 UNIX 0xFFFF
+ public static final Key LWIN = new Key("Left Windows", 119); // MS 0xDB UNIX META 0xFFE7 SUPER 0xFFEB HYPER 0xFFED
+ public static final Key RWIN = new Key("Right Windows", 120); // MS 0xDC UNIX META 0xFFE8 SUPER 0xFFEC HYPER 0xFFEE
+ public static final Key APPS = new Key(121); // MS 0xDD UNIX 0xFF67
+ public static final Key POWER = new Key("Power", 122); // MS 0xDE Sun 0x1005FF76 SHIFT 0x1005FF7D
+ public static final Key SLEEP = new Key("Sleep", 123); // MS 0xDF No UNIX keysym
+ public static final Key UNKNOWN = new Key("Unknown", 0);
+ protected static final Key FIRST = VOID;
+ protected static final Key LAST = SLEEP;
+ } // class StandardKeyboard.KeyID
+
+ } // class Axis.Identifier
+
+ /**
+ * POV enum for different positions.
+ */
+ public static class POV {
+ /**
+ * Standard value for center HAT position
+ */
+ public static final float OFF = 0.0f;
+ /**
+ * Synonmous with OFF
+ */
+ public static final float CENTER = OFF;
+ /**
+ * Standard value for up-left HAT position
+ */
+ public static final float UP_LEFT = 0.125f;
+ /**
+ * Standard value for up HAT position
+ */
+ public static final float UP = 0.25f;
+ /**
+ * Standard value for up-right HAT position
+ */
+ public static final float UP_RIGHT = 0.375f;
+ /**
+ * Standard value for right HAT position
+ */
+ public static final float RIGHT = 0.50f;
+ /**
+ * Standard value for down-right HAT position
+ */
+ public static final float DOWN_RIGHT = 0.625f;
+ /**
+ * Standard value for down HAT position
+ */
+ public static final float DOWN = 0.75f;
+ /**
+ * Standard value for down-left HAT position
+ */
+ public static final float DOWN_LEFT = 0.875f;
+ /**
+ * Standard value for left HAT position
+ */
+ public static final float LEFT = 1.0f;
+ } // class Axis.POV
+} // interface Axis
diff --git a/coreAPI/src/java/net/java/games/input/Controller.java b/coreAPI/src/java/net/java/games/input/Controller.java
index c9f3df3..fc22cdd 100644
--- a/coreAPI/src/java/net/java/games/input/Controller.java
+++ b/coreAPI/src/java/net/java/games/input/Controller.java
@@ -61,21 +61,21 @@ public interface Controller {
public abstract Type getType();
/**
- * Returns the axes on this controller, in order of assignment priority.
+ * 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 axes
+ * The array returned is an empty array if this controller contains no components
* (such as a logical grouping of child controllers).
*/
- public abstract Axis[] getAxes();
+ public abstract Component[] getComponents();
/**
* Returns a single axis based on its type, or null
* if no axis with the specified type could be found.
*/
- public abstract Axis getAxis(Axis.Identifier id);
+ public abstract Component getComponent(Component.Identifier id);
/**
* Returns the rumblers for sending feedback to this controller, or an
diff --git a/coreAPI/src/java/net/java/games/input/Keyboard.java b/coreAPI/src/java/net/java/games/input/Keyboard.java
index 92361af..f01317d 100644
--- a/coreAPI/src/java/net/java/games/input/Keyboard.java
+++ b/coreAPI/src/java/net/java/games/input/Keyboard.java
@@ -62,18 +62,17 @@ public abstract class Keyboard extends AbstractController {
}
/**
- * Returns the axis corresponding to a particular key on the keypad,
+ * Returns the component corresponding to a particular key on the keypad,
* or null if a key with the specified ID could not be found.
*/
- public Axis getAxis(Axis.Identifier id) {
- assert axes != null;
+ public Component getComponent(Component.Identifier id) {
+ assert components != null;
// Default implementation uses indices to lookup keys
// in the array of axes
- if (id instanceof KeyID) {
- KeyID kid = (KeyID)id;
- int index = kid.getKeyIndex();
- assert axes.length > index;
- return axes[index];
+ if(id instanceof Component.Identifier.Key) {
+ int index = ((Component.Identifier.Key)id).getKeyIndex();
+ assert components.length > index;
+ return components[index];
}
return null;
}
@@ -88,21 +87,21 @@ public abstract class Keyboard extends AbstractController {
* Axis representing a single key. By default, all keys are set to receive
* polling data.
*/
- public class Key extends AbstractAxis {
+ public class Key extends AbstractComponent {
/**
* Key identifier
*/
- private final KeyID keyID;
+ private final Component.Identifier.Key keyID;
/**
* Construct a new key object
*/
- public Key(KeyID keyID) {
+ public Key(Component.Identifier.Key keyID) {
super(keyID.toString(), keyID);
this.keyID = keyID;
}
-
+
/**
* Returns <code>true</code> if data returned from <code>poll</code>
* is relative to the last call, or <code>false</code> if data
@@ -125,44 +124,4 @@ public abstract class Keyboard extends AbstractController {
return (isKeyPressed(this) ? 1.0f : 0.0f);
}
} // class Keyboard.Key
-
- /**
- * Identifiers for physical keys.
- */
- public static class KeyID extends Axis.Identifier {
-
- /**
- * Key string
- */
- private static final String NAME_KEY = "key";
-
- /**
- * Index in the array of axes supplied to the keyboard contructor for
- * this key.
- */
- protected final int keyIndex;
-
- /**
- * Protected constructor
- * @param keyIndex the index for looking up the key in the array of axes
- */
- protected KeyID(int keyIndex) {
- super(NAME_KEY);
- this.keyIndex = keyIndex;
- }
-
- /**
- * The index for this key for looking up the in the array of axes.
- */
- public int getKeyIndex() {
- return keyIndex;
- }
-
- /**
- * Returns a non-localized string description of this control type.
- */
- public String toString() {
- return super.toString() + " " + Integer.toString(keyIndex);
- }
- } // class Keyboard.KeyID
} // class Keyboard
diff --git a/coreAPI/src/java/net/java/games/input/Mouse.java b/coreAPI/src/java/net/java/games/input/Mouse.java
index 7f8449f..790a6a4 100644
--- a/coreAPI/src/java/net/java/games/input/Mouse.java
+++ b/coreAPI/src/java/net/java/games/input/Mouse.java
@@ -105,17 +105,17 @@ public abstract class Mouse extends AbstractController {
/**
* X-axis; should be initialized by subclasses
*/
- protected Axis x;
+ protected Component x;
/**
* Y-axis; should be initialized by subclasses
*/
- protected Axis y;
+ protected Component y;
/**
* Mouse wheel; should be initialized by subclasses
*/
- protected Axis wheel;
+ protected Component wheel;
/**
* Protected constructor
@@ -134,40 +134,40 @@ public abstract class Mouse extends AbstractController {
/**
* Returns the x-axis for the mouse ball, never null.
*/
- public Axis getX() {
+ public Component getX() {
return x;
}
/**
* Returns the y-axis for the mouse ball, never null.
*/
- public Axis getY() {
+ public Component getY() {
return y;
}
/**
* Returns the mouse wheel, or null if no mouse wheel is present.
*/
- public Axis getWheel() {
+ public Component getWheel() {
return wheel;
}
/**
- * Returns the axes on this controller, in order of assignment priority.
+ * Returns the components on this controller, in order of assignment priority.
* Overridden to return the x-axis, followed by the y-axes, followed by
* the wheel (if present).
* The array returned is an empty array if this controller contains no
* axes (such as a logical grouping of child controllers).
*/
- public Axis[] getAxes() {
- if (axes.length == 0 && x != null && y != null) {
+ public Component[] getComponents() {
+ if (components.length == 0 && x != null && y != null) {
if (wheel == null) {
- axes = new Axis[] { x, y };
+ components = new Component[] { x, y };
} else {
- axes = new Axis[] { x, y, wheel };
+ components = new Component[] { x, y, wheel };
}
}
- return axes;
+ return components;
}
/**
@@ -291,32 +291,32 @@ public abstract class Mouse extends AbstractController {
}
/**
- * Returns the axes on this controller, in order of assignment priority.
+ * Returns the components on this controller, in order of assignment priority.
* Overridden to return the 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
* axes (such as a logical grouping of child controllers).
*/
- public Axis[] getAxes() {
- if (axes.length == 0 && left != null) {
+ public Component[] getComponents() {
+ if (components.length == 0 && left != null) {
if (right == null) {
- axes = new Axis[] { left };
+ components = new Component[] { left };
} else if (middle == null) {
- axes = new Axis[] { left, right };
+ components = new Component[] { left, right };
} else if (side == null) {
- axes = new Axis[] { left, right, middle };
+ components = new Component[] { left, right, middle };
} else if (extra == null) {
- axes = new Axis[] { left, right, middle, side };
+ components = new Component[] { left, right, middle, side };
} else if (forward == null) {
- axes = new Axis[] { left, right, middle, side, extra };
+ components = new Component[] { left, right, middle, side, extra };
} else if (back == null) {
- axes = new Axis[] { left, right, middle, side, extra, forward };
+ components = new Component[] { left, right, middle, side, extra, forward };
} else {
- axes = new Axis[] { left, right, middle, side, extra, forward, back };
+ components = new Component[] { left, right, middle, side, extra, forward, back };
}
}
- return axes;
+ return components;
}
/**
@@ -333,64 +333,13 @@ public abstract class Mouse extends AbstractController {
/**
* Mouse button axis
*/
- public abstract class Button extends AbstractAxis {
+ public abstract class Button extends AbstractComponent {
/**
* Protected constructor
*/
- protected Button(String name, ButtonID id) {
+ protected Button(String name, Component.Identifier.Button id) {
super(name, id);
}
} // class Mouse.Button
-
- /**
- * Identifier for types of mouse buttons
- */
- public static class ButtonID extends Axis.Identifier {
-
- /**
- * Protected constructor
- */
- protected ButtonID(String name) {
- super(name);
- }
-
- /**
- * The primary or leftmost mouse button.
- */
- public static final ButtonID LEFT = new ButtonID("left");
-
- /**
- * The secondary or rightmost mouse button, not present if
- * the mouse is a single-button mouse.
- */
- public static final ButtonID RIGHT = new ButtonID("right");
-
- /**
- * Returns the middle mouse button, not present if the
- * mouse has fewer than three buttons.
- */
- public static final ButtonID MIDDLE = new ButtonID("middle");
-
- /**
- * Returns the side mouse button.
- */
- public static final ButtonID SIDE = new ButtonID("side");
-
- /**
- * Returns the extra mouse button.
- */
- public static final ButtonID EXTRA = new ButtonID("extra");
-
- /**
- * Returns the forward mouse button.
- */
- public static final ButtonID FORWARD = new ButtonID("forward");
-
- /**
- * Returns the back mouse button.
- */
- public static final ButtonID BACK = new ButtonID("back");
-
- } // class Mouse.ButtonID
} // class Mouse
diff --git a/coreAPI/src/java/net/java/games/input/Rumbler.java b/coreAPI/src/java/net/java/games/input/Rumbler.java
index 9da084b..9d64cf3 100644
--- a/coreAPI/src/java/net/java/games/input/Rumbler.java
+++ b/coreAPI/src/java/net/java/games/input/Rumbler.java
@@ -61,7 +61,7 @@ public interface Rumbler {
*
* @return The axis identifier
*/
- public Axis.Identifier getAxisIdentifier();
+ public Component.Identifier getAxisIdentifier();
} // interface Rumbler
diff --git a/coreAPI/src/java/net/java/games/input/StandardKeyboard.java b/coreAPI/src/java/net/java/games/input/StandardKeyboard.java
index 5dc891a..e25ef9b 100644
--- a/coreAPI/src/java/net/java/games/input/StandardKeyboard.java
+++ b/coreAPI/src/java/net/java/games/input/StandardKeyboard.java
@@ -44,68 +44,68 @@ package net.java.games.input;
public abstract class StandardKeyboard extends Keyboard {
private Key[] standardKeys = {
- new Key(KeyID.VOID ), new Key(KeyID.ESCAPE ),
- new Key(KeyID._1 ), new Key(KeyID._2 ),
- new Key(KeyID._3 ), new Key(KeyID._4 ),
- new Key(KeyID._5 ), new Key(KeyID._6 ),
- new Key(KeyID._7 ), new Key(KeyID._8 ),
- new Key(KeyID._9 ), new Key(KeyID._0 ),
- new Key(KeyID.MINUS ), new Key(KeyID.EQUALS ),
- new Key(KeyID.BACK ), new Key(KeyID.TAB ),
- new Key(KeyID.Q ), new Key(KeyID.W ),
- new Key(KeyID.E ), new Key(KeyID.R ),
- new Key(KeyID.T ), new Key(KeyID.Y ),
- new Key(KeyID.U ), new Key(KeyID.I ),
- new Key(KeyID.O ), new Key(KeyID.P ),
- new Key(KeyID.LBRACKET ), new Key(KeyID.RBRACKET ),
- new Key(KeyID.RETURN ), new Key(KeyID.LCONTROL ),
- new Key(KeyID.A ), new Key(KeyID.S ),
- new Key(KeyID.D ), new Key(KeyID.F ),
- new Key(KeyID.G ), new Key(KeyID.H ),
- new Key(KeyID.J ), new Key(KeyID.K ),
- new Key(KeyID.L ), new Key(KeyID.SEMICOLON ),
- new Key(KeyID.APOSTROPHE ), new Key(KeyID.GRAVE ),
- new Key(KeyID.LSHIFT ), new Key(KeyID.BACKSLASH ),
- new Key(KeyID.Z ), new Key(KeyID.X ),
- new Key(KeyID.C ), new Key(KeyID.V ),
- new Key(KeyID.B ), new Key(KeyID.N ),
- new Key(KeyID.M ), new Key(KeyID.COMMA ),
- new Key(KeyID.PERIOD ), new Key(KeyID.SLASH ),
- new Key(KeyID.RSHIFT ), new Key(KeyID.MULTIPLY ),
- new Key(KeyID.LALT ), new Key(KeyID.SPACE ),
- new Key(KeyID.CAPITAL ), new Key(KeyID.F1 ),
- new Key(KeyID.F2 ), new Key(KeyID.F3 ),
- new Key(KeyID.F4 ), new Key(KeyID.F5 ),
- new Key(KeyID.F6 ), new Key(KeyID.F7 ),
- new Key(KeyID.F8 ), new Key(KeyID.F9 ),
- new Key(KeyID.F10 ), new Key(KeyID.NUMLOCK ),
- new Key(KeyID.SCROLL ), new Key(KeyID.NUMPAD7 ),
- new Key(KeyID.NUMPAD8 ), new Key(KeyID.NUMPAD9 ),
- new Key(KeyID.SUBTRACT ), new Key(KeyID.NUMPAD4 ),
- new Key(KeyID.NUMPAD5 ), new Key(KeyID.NUMPAD6 ),
- new Key(KeyID.ADD ), new Key(KeyID.NUMPAD1 ),
- new Key(KeyID.NUMPAD2 ), new Key(KeyID.NUMPAD3 ),
- new Key(KeyID.NUMPAD0 ), new Key(KeyID.DECIMAL ),
- new Key(KeyID.F11 ), new Key(KeyID.F12 ),
- new Key(KeyID.F13 ), new Key(KeyID.F14 ),
- new Key(KeyID.F15 ), new Key(KeyID.KANA ),
- new Key(KeyID.CONVERT ), new Key(KeyID.NOCONVERT ),
- new Key(KeyID.YEN ), new Key(KeyID.NUMPADEQUAL),
- new Key(KeyID.CIRCUMFLEX ), new Key(KeyID.AT ),
- new Key(KeyID.COLON ), new Key(KeyID.UNDERLINE ),
- new Key(KeyID.KANJI ), new Key(KeyID.STOP ),
- new Key(KeyID.AX ), new Key(KeyID.UNLABELED ),
- new Key(KeyID.NUMPADENTER), new Key(KeyID.RCONTROL ),
- new Key(KeyID.NUMPADCOMMA), new Key(KeyID.DIVIDE ),
- new Key(KeyID.SYSRQ ), new Key(KeyID.RALT ),
- new Key(KeyID.PAUSE ), new Key(KeyID.HOME ),
- new Key(KeyID.UP ), new Key(KeyID.PRIOR ),
- new Key(KeyID.LEFT ), new Key(KeyID.RIGHT ),
- new Key(KeyID.END ), new Key(KeyID.DOWN ),
- new Key(KeyID.NEXT ), new Key(KeyID.INSERT ),
- new Key(KeyID.DELETE ), new Key(KeyID.LWIN ),
- new Key(KeyID.RWIN ), new Key(KeyID.APPS ),
- new Key(KeyID.POWER ), new Key(KeyID.SLEEP ),
+ new Key(Component.Identifier.Key.VOID ), new Key(Component.Identifier.Key.ESCAPE ),
+ new Key(Component.Identifier.Key._1 ), new Key(Component.Identifier.Key._2 ),
+ new Key(Component.Identifier.Key._3 ), new Key(Component.Identifier.Key._4 ),
+ new Key(Component.Identifier.Key._5 ), new Key(Component.Identifier.Key._6 ),
+ new Key(Component.Identifier.Key._7 ), new Key(Component.Identifier.Key._8 ),
+ new Key(Component.Identifier.Key._9 ), new Key(Component.Identifier.Key._0 ),
+ new Key(Component.Identifier.Key.MINUS ), new Key(Component.Identifier.Key.EQUALS ),
+ new Key(Component.Identifier.Key.BACK ), new Key(Component.Identifier.Key.TAB ),
+ new Key(Component.Identifier.Key.Q ), new Key(Component.Identifier.Key.W ),
+ new Key(Component.Identifier.Key.E ), new Key(Component.Identifier.Key.R ),
+ new Key(Component.Identifier.Key.T ), new Key(Component.Identifier.Key.Y ),
+ new Key(Component.Identifier.Key.U ), new Key(Component.Identifier.Key.I ),
+ new Key(Component.Identifier.Key.O ), new Key(Component.Identifier.Key.P ),
+ new Key(Component.Identifier.Key.LBRACKET ), new Key(Component.Identifier.Key.RBRACKET ),
+ new Key(Component.Identifier.Key.RETURN ), new Key(Component.Identifier.Key.LCONTROL ),
+ new Key(Component.Identifier.Key.A ), new Key(Component.Identifier.Key.S ),
+ new Key(Component.Identifier.Key.D ), new Key(Component.Identifier.Key.F ),
+ new Key(Component.Identifier.Key.G ), new Key(Component.Identifier.Key.H ),
+ new Key(Component.Identifier.Key.J ), new Key(Component.Identifier.Key.K ),
+ new Key(Component.Identifier.Key.L ), new Key(Component.Identifier.Key.SEMICOLON ),
+ new Key(Component.Identifier.Key.APOSTROPHE ), new Key(Component.Identifier.Key.GRAVE ),
+ new Key(Component.Identifier.Key.LSHIFT ), new Key(Component.Identifier.Key.BACKSLASH ),
+ new Key(Component.Identifier.Key.Z ), new Key(Component.Identifier.Key.X ),
+ new Key(Component.Identifier.Key.C ), new Key(Component.Identifier.Key.V ),
+ new Key(Component.Identifier.Key.B ), new Key(Component.Identifier.Key.N ),
+ new Key(Component.Identifier.Key.M ), new Key(Component.Identifier.Key.COMMA ),
+ new Key(Component.Identifier.Key.PERIOD ), new Key(Component.Identifier.Key.SLASH ),
+ new Key(Component.Identifier.Key.RSHIFT ), new Key(Component.Identifier.Key.MULTIPLY ),
+ new Key(Component.Identifier.Key.LALT ), new Key(Component.Identifier.Key.SPACE ),
+ new Key(Component.Identifier.Key.CAPITAL ), new Key(Component.Identifier.Key.F1 ),
+ new Key(Component.Identifier.Key.F2 ), new Key(Component.Identifier.Key.F3 ),
+ new Key(Component.Identifier.Key.F4 ), new Key(Component.Identifier.Key.F5 ),
+ new Key(Component.Identifier.Key.F6 ), new Key(Component.Identifier.Key.F7 ),
+ new Key(Component.Identifier.Key.F8 ), new Key(Component.Identifier.Key.F9 ),
+ new Key(Component.Identifier.Key.F10 ), new Key(Component.Identifier.Key.NUMLOCK ),
+ new Key(Component.Identifier.Key.SCROLL ), new Key(Component.Identifier.Key.NUMPAD7 ),
+ new Key(Component.Identifier.Key.NUMPAD8 ), new Key(Component.Identifier.Key.NUMPAD9 ),
+ new Key(Component.Identifier.Key.SUBTRACT ), new Key(Component.Identifier.Key.NUMPAD4 ),
+ new Key(Component.Identifier.Key.NUMPAD5 ), new Key(Component.Identifier.Key.NUMPAD6 ),
+ new Key(Component.Identifier.Key.ADD ), new Key(Component.Identifier.Key.NUMPAD1 ),
+ new Key(Component.Identifier.Key.NUMPAD2 ), new Key(Component.Identifier.Key.NUMPAD3 ),
+ new Key(Component.Identifier.Key.NUMPAD0 ), new Key(Component.Identifier.Key.DECIMAL ),
+ new Key(Component.Identifier.Key.F11 ), new Key(Component.Identifier.Key.F12 ),
+ new Key(Component.Identifier.Key.F13 ), new Key(Component.Identifier.Key.F14 ),
+ new Key(Component.Identifier.Key.F15 ), new Key(Component.Identifier.Key.KANA ),
+ new Key(Component.Identifier.Key.CONVERT ), new Key(Component.Identifier.Key.NOCONVERT ),
+ new Key(Component.Identifier.Key.YEN ), new Key(Component.Identifier.Key.NUMPADEQUAL),
+ new Key(Component.Identifier.Key.CIRCUMFLEX ), new Key(Component.Identifier.Key.AT ),
+ new Key(Component.Identifier.Key.COLON ), new Key(Component.Identifier.Key.UNDERLINE ),
+ new Key(Component.Identifier.Key.KANJI ), new Key(Component.Identifier.Key.STOP ),
+ new Key(Component.Identifier.Key.AX ), new Key(Component.Identifier.Key.UNLABELED ),
+ new Key(Component.Identifier.Key.NUMPADENTER), new Key(Component.Identifier.Key.RCONTROL ),
+ new Key(Component.Identifier.Key.NUMPADCOMMA), new Key(Component.Identifier.Key.DIVIDE ),
+ new Key(Component.Identifier.Key.SYSRQ ), new Key(Component.Identifier.Key.RALT ),
+ new Key(Component.Identifier.Key.PAUSE ), new Key(Component.Identifier.Key.HOME ),
+ new Key(Component.Identifier.Key.UP ), new Key(Component.Identifier.Key.PAGEUP ),
+ new Key(Component.Identifier.Key.LEFT ), new Key(Component.Identifier.Key.RIGHT ),
+ new Key(Component.Identifier.Key.END ), new Key(Component.Identifier.Key.DOWN ),
+ new Key(Component.Identifier.Key.PAGEDOWN ), new Key(Component.Identifier.Key.INSERT ),
+ new Key(Component.Identifier.Key.DELETE ), new Key(Component.Identifier.Key.LWIN ),
+ new Key(Component.Identifier.Key.RWIN ), new Key(Component.Identifier.Key.APPS ),
+ new Key(Component.Identifier.Key.POWER ), new Key(Component.Identifier.Key.SLEEP ),
};
/**
@@ -114,148 +114,6 @@ public abstract class StandardKeyboard extends Keyboard {
*/
protected StandardKeyboard(String name) {
super(name);
- axes = standardKeys;
+ components = standardKeys;
}
-
- /**
- * KeyIDs for standard PC (LATIN-1) keyboards
- */
- public static class KeyID extends Keyboard.KeyID {
- /**
- * Protected constructor
- */
- protected KeyID(int keyID) {
- super(keyID);
- }
- /**
- * Standard keyboard (LATIN-1) keys
- * UNIX X11 keysym values are listed to the right
- */
- public static final KeyID VOID = new KeyID(0); // MS 0x00 UNIX 0xFFFFFF
- public static final KeyID ESCAPE = new KeyID(1); // MS 0x01 UNIX 0xFF1B
- public static final KeyID _1 = new KeyID(2); // MS 0x02 UNIX 0x031 EXCLAM 0x021
- public static final KeyID _2 = new KeyID(3); // MS 0x03 UNIX 0x032 AT 0x040
- public static final KeyID _3 = new KeyID(4); // MS 0x04 UNIX 0x033 NUMBERSIGN 0x023
- public static final KeyID _4 = new KeyID(5); // MS 0x05 UNIX 0x034 DOLLAR 0x024
- public static final KeyID _5 = new KeyID(6); // MS 0x06 UNIX 0x035 PERCENT 0x025
- public static final KeyID _6 = new KeyID(7); // MS 0x07 UNIX 0x036 CIRCUMFLEX 0x05e
- public static final KeyID _7 = new KeyID(8); // MS 0x08 UNIX 0x037 AMPERSAND 0x026
- public static final KeyID _8 = new KeyID(9); // MS 0x09 UNIX 0x038 ASTERISK 0x02a
- public static final KeyID _9 = new KeyID(10); // MS 0x0A UNIX 0x039 PARENLEFT 0x028
- public static final KeyID _0 = new KeyID(11); // MS 0x0B UNIX 0x030 PARENRIGHT 0x029
- public static final KeyID MINUS = new KeyID(12); // MS 0x0C UNIX 0x02d UNDERSCORE 0x05f
- public static final KeyID EQUALS = new KeyID(13); // MS 0x0D UNIX 0x03d PLUS 0x02b
- public static final KeyID BACK = new KeyID(14); // MS 0x0E UNIX 0xFF08
- public static final KeyID TAB = new KeyID(15); // MS 0x0F UNIX 0xFF09
- public static final KeyID Q = new KeyID(16); // MS 0x10 UNIX 0x071 UPPER 0x051
- public static final KeyID W = new KeyID(17); // MS 0x11 UNIX 0x077 UPPER 0x057
- public static final KeyID E = new KeyID(18); // MS 0x12 UNIX 0x065 UPPER 0x045
- public static final KeyID R = new KeyID(19); // MS 0x13 UNIX 0x072 UPPER 0x052
- public static final KeyID T = new KeyID(20); // MS 0x14 UNIX 0x074 UPPER 0x054
- public static final KeyID Y = new KeyID(21); // MS 0x15 UNIX 0x079 UPPER 0x059
- public static final KeyID U = new KeyID(22); // MS 0x16 UNIX 0x075 UPPER 0x055
- public static final KeyID I = new KeyID(23); // MS 0x17 UNIX 0x069 UPPER 0x049
- public static final KeyID O = new KeyID(24); // MS 0x18 UNIX 0x06F UPPER 0x04F
- public static final KeyID P = new KeyID(25); // MS 0x19 UNIX 0x070 UPPER 0x050
- public static final KeyID LBRACKET = new KeyID(26); // MS 0x1A UNIX 0x05b BRACE 0x07b
- public static final KeyID RBRACKET = new KeyID(27); // MS 0x1B UNIX 0x05d BRACE 0x07d
- public static final KeyID RETURN = new KeyID(28); // MS 0x1C UNIX 0xFF0D
- public static final KeyID LCONTROL = new KeyID(29); // MS 0x1D UNIX 0xFFE3
- public static final KeyID A = new KeyID(30); // MS 0x1E UNIX 0x061 UPPER 0x041
- public static final KeyID S = new KeyID(31); // MS 0x1F UNIX 0x073 UPPER 0x053
- public static final KeyID D = new KeyID(32); // MS 0x20 UNIX 0x064 UPPER 0x044
- public static final KeyID F = new KeyID(33); // MS 0x21 UNIX 0x066 UPPER 0x046
- public static final KeyID G = new KeyID(34); // MS 0x22 UNIX 0x067 UPPER 0x047
- public static final KeyID H = new KeyID(35); // MS 0x23 UNIX 0x068 UPPER 0x048
- public static final KeyID J = new KeyID(36); // MS 0x24 UNIX 0x06A UPPER 0x04A
- public static final KeyID K = new KeyID(37); // MS 0x25 UNIX 0x06B UPPER 0x04B
- public static final KeyID L = new KeyID(38); // MS 0x26 UNIX 0x06C UPPER 0x04C
- public static final KeyID SEMICOLON = new KeyID(39); // MS 0x27 UNIX 0x03b COLON 0x03a
- public static final KeyID APOSTROPHE = new KeyID(40); // MS 0x28 UNIX 0x027 QUOTEDBL 0x022
- public static final KeyID GRAVE = new KeyID(41); // MS 0x29 UNIX 0x060 TILDE 0x07e
- public static final KeyID LSHIFT = new KeyID(42); // MS 0x2A UNIX 0xFFE1
- public static final KeyID BACKSLASH = new KeyID(43); // MS 0x2B UNIX 0x05c BAR 0x07c
- public static final KeyID Z = new KeyID(44); // MS 0x2C UNIX 0x07A UPPER 0x05A
- public static final KeyID X = new KeyID(45); // MS 0x2D UNIX 0x078 UPPER 0x058
- public static final KeyID C = new KeyID(46); // MS 0x2E UNIX 0x063 UPPER 0x043
- public static final KeyID V = new KeyID(47); // MS 0x2F UNIX 0x076 UPPER 0x056
- public static final KeyID B = new KeyID(48); // MS 0x30 UNIX 0x062 UPPER 0x042
- public static final KeyID N = new KeyID(49); // MS 0x31 UNIX 0x06E UPPER 0x04E
- public static final KeyID M = new KeyID(50); // MS 0x32 UNIX 0x06D UPPER 0x04D
- public static final KeyID COMMA = new KeyID(51); // MS 0x33 UNIX 0x02c LESS 0x03c
- public static final KeyID PERIOD = new KeyID(52); // MS 0x34 UNIX 0x02e GREATER 0x03e
- public static final KeyID SLASH = new KeyID(53); // MS 0x35 UNIX 0x02f QUESTION 0x03f
- public static final KeyID RSHIFT = new KeyID(54); // MS 0x36 UNIX 0xFFE2
- public static final KeyID MULTIPLY = new KeyID(55); // MS 0x37 UNIX 0xFFAA
- public static final KeyID LALT = new KeyID(56); // MS 0x38 UNIX 0xFFE9
- public static final KeyID SPACE = new KeyID(57); // MS 0x39 UNIX 0x020
- public static final KeyID CAPITAL = new KeyID(58); // MS 0x3A UNIX 0xFFE5 SHIFTLOCK 0xFFE6
- public static final KeyID F1 = new KeyID(59); // MS 0x3B UNIX 0xFFBE
- public static final KeyID F2 = new KeyID(60); // MS 0x3C UNIX 0xFFBF
- public static final KeyID F3 = new KeyID(61); // MS 0x3D UNIX 0xFFC0
- public static final KeyID F4 = new KeyID(62); // MS 0x3E UNIX 0xFFC1
- public static final KeyID F5 = new KeyID(63); // MS 0x3F UNIX 0xFFC2
- public static final KeyID F6 = new KeyID(64); // MS 0x40 UNIX 0xFFC3
- public static final KeyID F7 = new KeyID(65); // MS 0x41 UNIX 0xFFC4
- public static final KeyID F8 = new KeyID(66); // MS 0x42 UNIX 0xFFC5
- public static final KeyID F9 = new KeyID(67); // MS 0x43 UNIX 0xFFC6
- public static final KeyID F10 = new KeyID(68); // MS 0x44 UNIX 0xFFC7
- public static final KeyID NUMLOCK = new KeyID(69); // MS 0x45 UNIX 0xFF7F
- public static final KeyID SCROLL = new KeyID(70); // MS 0x46 UNIX 0xFF14
- public static final KeyID NUMPAD7 = new KeyID(71); // MS 0x47 UNIX 0xFFB7 HOME 0xFF95
- public static final KeyID NUMPAD8 = new KeyID(72); // MS 0x48 UNIX 0xFFB8 UP 0xFF97
- public static final KeyID NUMPAD9 = new KeyID(73); // MS 0x49 UNIX 0xFFB9 PRIOR 0xFF9A
- public static final KeyID SUBTRACT = new KeyID(74); // MS 0x4A UNIX 0xFFAD
- public static final KeyID NUMPAD4 = new KeyID(75); // MS 0x4B UNIX 0xFFB4 LEFT 0xFF96
- public static final KeyID NUMPAD5 = new KeyID(76); // MS 0x4C UNIX 0xFFB5
- public static final KeyID NUMPAD6 = new KeyID(77); // MS 0x4D UNIX 0xFFB6 RIGHT 0xFF98
- public static final KeyID ADD = new KeyID(78); // MS 0x4E UNIX 0xFFAB
- public static final KeyID NUMPAD1 = new KeyID(79); // MS 0x4F UNIX 0xFFB1 END 0xFF9C
- public static final KeyID NUMPAD2 = new KeyID(80); // MS 0x50 UNIX 0xFFB2 DOWN 0xFF99
- public static final KeyID NUMPAD3 = new KeyID(81); // MS 0x51 UNIX 0xFFB3 NEXT 0xFF9B
- public static final KeyID NUMPAD0 = new KeyID(82); // MS 0x52 UNIX 0xFFB0 INSERT 0xFF9E
- public static final KeyID DECIMAL = new KeyID(83); // MS 0x53 UNIX 0xFFAE DELETE 0xFF9F
- public static final KeyID F11 = new KeyID(84); // MS 0x57 UNIX 0xFFC8
- public static final KeyID F12 = new KeyID(85); // MS 0x58 UNIX 0xFFC9
- public static final KeyID F13 = new KeyID(86); // MS 0x64 UNIX 0xFFCA
- public static final KeyID F14 = new KeyID(87); // MS 0x65 UNIX 0xFFCB
- public static final KeyID F15 = new KeyID(88); // MS 0x66 UNIX 0xFFCC
- public static final KeyID KANA = new KeyID(89); // MS 0x70 UNIX 0xFF2D
- public static final KeyID CONVERT = new KeyID(90); // MS 0x79 Japanese keyboard
- public static final KeyID NOCONVERT = new KeyID(91); // MS 0x7B Japanese keyboard
- public static final KeyID YEN = new KeyID(92); // MS 0x7D UNIX 0x0a5
- public static final KeyID NUMPADEQUAL = new KeyID(93); // MS 0x8D UNIX 0xFFBD
- public static final KeyID CIRCUMFLEX = new KeyID(94); // MS 0x90 Japanese keyboard
- public static final KeyID AT = new KeyID(95); // MS 0x91 UNIX 0x040
- public static final KeyID COLON = new KeyID(96); // MS 0x92 UNIX 0x03a
- public static final KeyID UNDERLINE = new KeyID(97); // MS 0x93 NEC PC98
- public static final KeyID KANJI = new KeyID(98); // MS 0x94 UNIX 0xFF21
- public static final KeyID STOP = new KeyID(99); // MS 0x95 UNIX 0xFF69
- public static final KeyID AX = new KeyID(100); // MS 0x96 Japan AX
- public static final KeyID UNLABELED = new KeyID(101); // MS 0x97 J3100
- public static final KeyID NUMPADENTER = new KeyID(102); // MS 0x9C UNIX 0xFF8D
- public static final KeyID RCONTROL = new KeyID(103); // MS 0x9D UNIX 0xFFE4
- public static final KeyID NUMPADCOMMA = new KeyID(104); // MS 0xB3 UNIX 0xFFAC
- public static final KeyID DIVIDE = new KeyID(105); // MS 0xB5 UNIX 0xFFAF
- public static final KeyID SYSRQ = new KeyID(106); // MS 0xB7 UNIX 0xFF15 PRINT 0xFF61
- public static final KeyID RALT = new KeyID(107); // MS 0xB8 UNIX 0xFFEA
- public static final KeyID PAUSE = new KeyID(108); // MS 0xC5 UNIX 0xFF13 BREAK 0xFF6B
- public static final KeyID HOME = new KeyID(109); // MS 0xC7 UNIX 0xFF50
- public static final KeyID UP = new KeyID(110); // MS 0xC8 UNIX 0xFF52
- public static final KeyID PRIOR = new KeyID(111); // MS 0xC9 UNIX 0xFF55
- public static final KeyID LEFT = new KeyID(112); // MS 0xCB UNIX 0xFF51
- public static final KeyID RIGHT = new KeyID(113); // MS 0xCD UNIX 0xFF53
- public static final KeyID END = new KeyID(114); // MS 0xCF UNIX 0xFF57
- public static final KeyID DOWN = new KeyID(115); // MS 0xD0 UNIX 0xFF54
- public static final KeyID NEXT = new KeyID(116); // MS 0xD1 UNIX 0xFF56
- public static final KeyID INSERT = new KeyID(117); // MS 0xD2 UNIX 0xFF63
- public static final KeyID DELETE = new KeyID(118); // MS 0xD3 UNIX 0xFFFF
- public static final KeyID LWIN = new KeyID(119); // MS 0xDB UNIX META 0xFFE7 SUPER 0xFFEB HYPER 0xFFED
- public static final KeyID RWIN = new KeyID(120); // MS 0xDC UNIX META 0xFFE8 SUPER 0xFFEC HYPER 0xFFEE
- public static final KeyID APPS = new KeyID(121); // MS 0xDD UNIX 0xFF67
- public static final KeyID POWER = new KeyID(122); // MS 0xDE Sun 0x1005FF76 SHIFT 0x1005FF7D
- public static final KeyID SLEEP = new KeyID(123); // MS 0xDF No UNIX keysym
- protected static final KeyID FIRST = VOID;
- protected static final KeyID LAST = SLEEP;
- } // class StandardKeyboard.KeyID
} // class StandardKeyboard
diff --git a/coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java b/coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java
index 9e6d56f..0a41d54 100644
--- a/coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java
+++ b/coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java
@@ -42,17 +42,28 @@ package net.java.games.input.test;
* @author administrator
*/
-import net.java.games.input.*;
-import javax.swing.*;
-import java.util.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.GridLayout;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
-import java.awt.*;
+
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import net.java.games.input.Component;
+import net.java.games.input.Controller;
+import net.java.games.input.ControllerEnvironment;
abstract class AxisPanel extends JPanel{
- Axis axis;
+ Component axis;
float data;
- public AxisPanel(Axis ax){
+ public AxisPanel(Component ax){
axis = ax;
setLayout(new BorderLayout());
add(new JLabel(ax.getName()+"("+ax.getIdentifier()+")"),
@@ -70,7 +81,7 @@ abstract class AxisPanel extends JPanel{
class DigitalAxisPanel extends AxisPanel {
JLabel digitalState = new JLabel("<unread>");
- public DigitalAxisPanel(Axis ax) {
+ public DigitalAxisPanel(Component ax) {
super(ax);
add(digitalState,BorderLayout.CENTER);
}
@@ -93,37 +104,37 @@ class DigitalAxisPanel extends AxisPanel {
class DigitalHatPanel extends AxisPanel {
JLabel digitalState = new JLabel("<unread>");
- public DigitalHatPanel(Axis ax) {
+ public DigitalHatPanel(Component ax) {
super(ax);
add(digitalState,BorderLayout.CENTER);
}
protected void renderData(){
- if (data == Axis.POV.OFF){
+ if (data == Component.POV.OFF){
digitalState.setBackground(getBackground());
digitalState.setText("OFF");
- } else if ( data == Axis.POV.UP) {
+ } else if ( data == Component.POV.UP) {
digitalState.setBackground(Color.green);
digitalState.setText("UP");
- } else if ( data == Axis.POV.UP_RIGHT) {
+ } else if ( data == Component.POV.UP_RIGHT) {
digitalState.setBackground(Color.green);
digitalState.setText("UP+RIGHT");
- } else if ( data == Axis.POV.RIGHT) {
+ } else if ( data == Component.POV.RIGHT) {
digitalState.setBackground(Color.green);
digitalState.setText("RIGHT");
- } else if ( data == Axis.POV.DOWN_RIGHT) {
+ } else if ( data == Component.POV.DOWN_RIGHT) {
digitalState.setBackground(Color.green);
digitalState.setText("DOWN+RIGHT");
- } else if ( data == Axis.POV.DOWN) {
+ } else if ( data == Component.POV.DOWN) {
digitalState.setBackground(Color.green);
digitalState.setText("DOWN");
- } else if ( data == Axis.POV.DOWN_LEFT) {
+ } else if ( data == Component.POV.DOWN_LEFT) {
digitalState.setBackground(Color.green);
digitalState.setText("DOWN+LEFT");
- } else if ( data == Axis.POV.LEFT) {
+ } else if ( data == Component.POV.LEFT) {
digitalState.setBackground(Color.green);
digitalState.setText("LEFT");
- } else if ( data == Axis.POV.UP_LEFT) {
+ } else if ( data == Component.POV.UP_LEFT) {
digitalState.setBackground(Color.green);
digitalState.setText("UP+LEFT");
}else { // shoudl never happen
@@ -136,7 +147,7 @@ class DigitalHatPanel extends AxisPanel {
class AnalogAxisPanel extends AxisPanel {
JLabel analogState = new JLabel("<unread>");
- public AnalogAxisPanel(Axis ax) {
+ public AnalogAxisPanel(Component ax) {
super(ax);
add(analogState,BorderLayout.CENTER);
}
@@ -160,14 +171,14 @@ class ControllerWindow extends JFrame {
this.ca = ca;
Container c = this.getContentPane();
c.setLayout(new BorderLayout());
- Axis[] axis = ca.getAxes();
- System.out.println("Axis count = "+axis.length);
- if (axis.length>0) {
- int width = (int)Math.ceil(Math.sqrt(axis.length));
+ Component[] components = ca.getComponents();
+ System.out.println("Component count = "+components.length);
+ if (components.length>0) {
+ int width = (int)Math.ceil(Math.sqrt(components.length));
JPanel p = new JPanel();
p.setLayout(new GridLayout(width,0));
- for(int j=0;j<axis.length;j++){
- addAxis(p,axis[j]);
+ for(int j=0;j<components.length;j++){
+ addAxis(p,components[j]);
}
c.add(new JScrollPane(p),BorderLayout.CENTER);
}
@@ -192,12 +203,12 @@ class ControllerWindow extends JFrame {
repaint();
}
- private void addAxis(JPanel p, Axis ax){
+ private void addAxis(JPanel p, Component ax){
JPanel p2;
if (ax.isAnalog()) {
p2 = new AnalogAxisPanel(ax);
} else {
- if (ax.getIdentifier() == Axis.Identifier.POV) {
+ if (ax.getIdentifier() == Component.Identifier.Axis.POV) {
p2 = new DigitalHatPanel(ax);
} else {
p2 = new DigitalAxisPanel(ax);
diff --git a/coreAPI/src/java/net/java/games/input/test/ControllerTextTest.java b/coreAPI/src/java/net/java/games/input/test/ControllerTextTest.java
index 8b59c8f..64aa8b9 100644
--- a/coreAPI/src/java/net/java/games/input/test/ControllerTextTest.java
+++ b/coreAPI/src/java/net/java/games/input/test/ControllerTextTest.java
@@ -55,19 +55,19 @@ public class ControllerTextTest {
for(int i =0;i<ca.length;i++){
System.out.println(ca[i].getName());
System.out.println("Type: "+ca[i].getType().toString());
- Axis[] axis = ca[i].getAxes();
- System.out.println("Axis Count: "+axis.length);
- for(int j=0;j<axis.length;j++){
- System.out.println("Axis "+j+": "+axis[j].getName());
+ Component[] components = ca[i].getComponents();
+ System.out.println("Component Count: "+components.length);
+ for(int j=0;j<components.length;j++){
+ System.out.println("Component "+j+": "+components[j].getName());
System.out.println(" Identifier: "+
- axis[j].getIdentifier().getName());
- System.out.print(" AxisType: ");
- if (axis[j].isRelative()) {
+ components[j].getIdentifier().getName());
+ System.out.print(" ComponentType: ");
+ if (components[j].isRelative()) {
System.out.print("Relative");
} else {
System.out.print("Absolute");
}
- if (axis[j].isAnalog()) {
+ if (components[j].isAnalog()) {
System.out.print(" Analog");
} else {
System.out.print(" Digital");