diff options
30 files changed, 1295 insertions, 1347 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"); diff --git a/plugins/DX8/build.xml b/plugins/DX8/build.xml index 0a4759b..ef20e6f 100644 --- a/plugins/DX8/build.xml +++ b/plugins/DX8/build.xml @@ -96,7 +96,7 @@ <delete file="bin/dxinput.jar" failonerror="no"/> <delete file="bin/dxinput.dll" failonerror="no"/> <delete file="../../coreAPI/src/tests/controller/dxinput.jar" failonerror="no" /> - <delete file="../../coreAPI/src/test/controller/dxinput.dll" failonerror="no"/> + <delete file="../../coreAPI/src/tests/controller/dxinput.dll" failonerror="no"/> <delete dir="../../docs/input/win32/apidoc" failonerror="no"/> </target> diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java b/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java index e9cfc6e..a09267d 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java @@ -38,15 +38,15 @@ *****************************************************************************/ package net.java.games.input; -import net.java.games.input.AbstractAxis; -import net.java.games.input.Axis; +import net.java.games.input.AbstractComponent; +import net.java.games.input.Component; /** * * @author martak * @version */ -class DirectInputAxis extends AbstractAxis { +class DirectInputAxis extends AbstractComponent { /** * DIDFT_ constants and macros defined in dinput.h @@ -106,31 +106,31 @@ class DirectInputAxis extends AbstractAxis { private int bitmask = 0xffffffff; private int bitshift = 0; - private DirectInputAxis(DirectInputDevice device, Axis.Identifier id, + private DirectInputAxis(DirectInputDevice device, Component.Identifier id, int didft, String name) { super(name, id); this.device = device; this.type = DIDFT_GETTYPE(didft); this.instance = DIDFT_GETINSTANCE(didft); - if (id == Axis.Identifier.X) { + if (id == Component.Identifier.Axis.X) { offset = 0; - } else if (id == Axis.Identifier.Y) { + } else if (id == Component.Identifier.Axis.Y) { offset = 1; - } else if (id == Axis.Identifier.Z) { + } else if (id == Component.Identifier.Axis.Z) { offset = 2; - } else if (id == Axis.Identifier.RX) { + } else if (id == Component.Identifier.Axis.RX) { offset = 3; - } else if (id == Axis.Identifier.RY) { + } else if (id == Component.Identifier.Axis.RY) { offset = 4; - } else if (id == Axis.Identifier.RZ) { + } else if (id == Component.Identifier.Axis.RZ) { offset = 5; - } else if (id == Axis.Identifier.SLIDER) { + } else if (id == Component.Identifier.Axis.SLIDER) { //System.out.println("Slider on "+name+" instance = "+instance); offset = 6 + (instance>>2); - } else if (id == Axis.Identifier.POV) { + } else if (id == Component.Identifier.Axis.POV) { //System.out.println("POV on "+name+" instance = "+instance); offset = 8 + instance; - } else if (id == Axis.Identifier.BUTTON) { + } else if (id instanceof Component.Identifier.Button) { //System.out.println("Button on "+name+" instance = "+instance); offset = 12 + (instance/4); bitshift = (instance%4)*8; @@ -152,26 +152,26 @@ class DirectInputAxis extends AbstractAxis { return ((float)data)/32768; } else if ((type&DIDFT_POV)!=0) { if (data == -1) { - return Axis.POV.OFF; + return Component.POV.OFF; } else if (data == 0.0) { - return Axis.POV.UP; + return Component.POV.UP; } else if (data == 4500) { - return Axis.POV.UP_RIGHT; + return Component.POV.UP_RIGHT; } else if (data == 9000) { - return Axis.POV.RIGHT; + return Component.POV.RIGHT; } else if (data == 13500) { - return Axis.POV.DOWN_RIGHT; + return Component.POV.DOWN_RIGHT; } else if (data == 18000) { - return Axis.POV.DOWN; + return Component.POV.DOWN; } else if (data == 22500) { - return Axis.POV.DOWN_LEFT; + return Component.POV.DOWN_LEFT; } else if (data == 27000) { - return Axis.POV.LEFT; + return Component.POV.LEFT; } else if (data == 31500) { - return Axis.POV.UP_LEFT; + return Component.POV.UP_LEFT; } else { System.err.print("Unexpected value for DX8 HAT: "+data); - return Axis.POV.OFF; + return Component.POV.OFF; } } else { // return raw value return (float)data; @@ -213,7 +213,7 @@ class DirectInputAxis extends AbstractAxis { * @param id The identifier for the device */ public static DirectInputAxis createAxis(DirectInputDevice device, - Axis.Identifier id, int didft, String name) { + Component.Identifier id, int didft, String name) { return new DirectInputAxis(device, id, didft, name); } } diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java b/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java index d269961..849a5f1 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java @@ -39,8 +39,7 @@ package net.java.games.input; import net.java.games.input.AbstractController; -import net.java.games.input.Axis; -import net.java.games.input.Controller; +import net.java.games.input.Component; import java.util.ArrayList; import java.util.Iterator; @@ -120,21 +119,21 @@ class DirectInputDevice extends AbstractController { default: type = Type.STICK; break; } - axes = initDirectInputAxes(); + components = initDirectInputAxes(); } /** * Used instead of overriding initAxes because it needs the * pointer to the IDirectInputDevice */ - private Axis[] initDirectInputAxes() { + private Component[] initDirectInputAxes() { ArrayList list = new ArrayList(); enumObjects(lpDevice, list); - Axis[] ret = new Axis[list.size()]; + Component[] ret = new Component[list.size()]; Iterator it = list.iterator(); int i = 0; while (it.hasNext()) { - ret[i] = (Axis)it.next(); + ret[i] = (Component)it.next(); i++; } return ret; @@ -148,7 +147,7 @@ class DirectInputDevice extends AbstractController { * instance number of the axis. * @param name The name to call the axis. */ - private void addAxis(ArrayList list, Axis.Identifier id, int didft, + private void addAxis(ArrayList list, Component.Identifier id, int didft, String name) { list.add(DirectInputAxis.createAxis(this, id, didft, name)); } @@ -159,7 +158,7 @@ class DirectInputDevice extends AbstractController { * @param effect the natie effect id * @param axisID The axis ID */ - private void addRumbler(long effect, Axis.Identifier axisID, String axisName) { + private void addRumbler(long effect, Component.Identifier axisID, String axisName) { rumblerList.add(new DirectInputRumbler(this, effect, axisID, axisName)); } diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java b/plugins/DX8/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java index fcaa278..4b3c95d 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputEnvironmentPlugin.java @@ -38,7 +38,6 @@ *****************************************************************************/ package net.java.games.input; -import java.security.AccessController; import java.util.ArrayList; import java.util.Iterator; import net.java.games.input.Controller; @@ -59,7 +58,9 @@ public class DirectInputEnvironmentPlugin extends ControllerEnvironment java.security.AccessController.doPrivileged( new LoadLibraryAction("jinput")); */ - System.loadLibrary("dxinput"); + if(isSupported()) { + System.loadLibrary("dxinput"); + } } /** @@ -109,8 +110,22 @@ public class DirectInputEnvironmentPlugin extends ControllerEnvironment /** Creates new DirectInputEnvironment */ public DirectInputEnvironmentPlugin() { - lpDirectInput = directInputCreate(); - enumControllers(); + if(isSupported()) { + lpDirectInput = directInputCreate(); + enumControllers(); + } else { + controllers = new Controller[0]; + } + } + + public static boolean isSupported() { + System.out.println("OS name is: " + System.getProperty("os.name")); + if(System.getProperty("os.name").indexOf("Windows")!=-1) { + System.out.println("DX8 plugin is supported"); + return true; + } + System.out.println("DX8 plugin is not supported"); + return false; } /** Returns a list of all controllers available to this environment, diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputKeyboard.java b/plugins/DX8/src/java/net/java/games/input/DirectInputKeyboard.java index 6faf163..9b5833c 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputKeyboard.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputKeyboard.java @@ -38,8 +38,8 @@ *****************************************************************************/ package net.java.games.input; -import net.java.games.input.AbstractAxis; -import net.java.games.input.Axis; +import net.java.games.input.AbstractComponent; +import net.java.games.input.Component; import net.java.games.input.StandardKeyboard; /** @@ -143,8 +143,8 @@ class DirectInputKeyboard extends StandardKeyboard { for (; CROSSTABLE[keyIndex] > index; keyIndex--) ; if (CROSSTABLE[keyIndex] == index) { - Axis[] axes = getAxes(); - AbstractAxis key = (AbstractAxis)axes[index]; + Component[] components = getComponents(); + AbstractComponent key = (AbstractComponent)components[index]; if (name != null && name.length() > 0) { //System.out.println("Renaming key " + key.getName() + // " to " + name + " index=" + @@ -173,7 +173,7 @@ class DirectInputKeyboard extends StandardKeyboard { * @return true if this key has changed state since last read of its state, false otherwise. */ protected boolean isKeyPressed(Key key) { - KeyID id = (KeyID)key.getIdentifier(); + Component.Identifier.Key id = (Component.Identifier.Key)key.getIdentifier(); int keyIndex = id.getKeyIndex(); int crossIndex = CROSSTABLE[keyIndex]; return ((keyData[crossIndex] & 0x80) != 0); diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputMouse.java b/plugins/DX8/src/java/net/java/games/input/DirectInputMouse.java index 7241414..4d9e257 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputMouse.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputMouse.java @@ -38,8 +38,8 @@ *****************************************************************************/ package net.java.games.input; -import net.java.games.input.AbstractAxis; -import net.java.games.input.Axis; +import net.java.games.input.AbstractComponent; +import net.java.games.input.Component; import net.java.games.input.Mouse; /** @@ -105,12 +105,12 @@ class DirectInputMouse extends Mouse { /** * Callback to rename a given axis by type, name */ - private void renameAxis(Axis.Identifier id, String name) { - AbstractAxis axis; - if (id instanceof ButtonID) { - axis = (AbstractAxis)getButtons().getAxis(id); + private void renameAxis(Component.Identifier id, String name) { + AbstractComponent axis; + if (id instanceof Component.Identifier.Button) { + axis = (AbstractComponent)getButtons().getComponent(id); } else { - axis = (AbstractAxis)getBall().getAxis(id); + axis = (AbstractComponent)getBall().getComponent(id); } axis.setName(name); //System.out.println("Renaming " + name); @@ -160,10 +160,10 @@ class DirectInputMouse extends Mouse { public BallImpl() { super(DirectInputMouse.this.getName() + " ball"); numAxes = getNumAxes(lpDevice); - x = new BallAxis(Axis.Identifier.X); - y = new BallAxis(Axis.Identifier.Y); + x = new BallAxis(Component.Identifier.Axis.X); + y = new BallAxis(Component.Identifier.Axis.Y); if(numAxes > 2) { - wheel = new BallAxis(Axis.Identifier.SLIDER); + wheel = new BallAxis(Component.Identifier.Axis.SLIDER); } } } // class DirectInputMouse.BallImpl @@ -181,22 +181,22 @@ class DirectInputMouse extends Mouse { public ButtonsImpl() { super(DirectInputMouse.this.getName() + " buttons"); numButtons = getNumButtons(lpDevice); - left = new ButtonImpl(ButtonID.LEFT); - right = new ButtonImpl(ButtonID.RIGHT); + left = new ButtonImpl(Component.Identifier.Button.LEFT); + right = new ButtonImpl(Component.Identifier.Button.RIGHT); if(numButtons>2) { - middle = new ButtonImpl(ButtonID.MIDDLE); + middle = new ButtonImpl(Component.Identifier.Button.MIDDLE); } if(numButtons>3) { - side = new ButtonImpl(ButtonID.SIDE); + side = new ButtonImpl(Component.Identifier.Button.SIDE); } if(numButtons>4) { - extra = new ButtonImpl(ButtonID.EXTRA); + extra = new ButtonImpl(Component.Identifier.Button.EXTRA); } if(numButtons>5) { - forward = new ButtonImpl(ButtonID.FORWARD); + forward = new ButtonImpl(Component.Identifier.Button.FORWARD); } if(numButtons>6) { - back = new ButtonImpl(ButtonID.BACK); + back = new ButtonImpl(Component.Identifier.Button.BACK); } } } // class DirectInputMouse.ButtonsImpl @@ -235,21 +235,21 @@ class DirectInputMouse extends Mouse { * @param id An ID of a button to create an obejct to represent. * */ - public ButtonImpl(ButtonID id) { + public ButtonImpl(Component.Identifier.Button id) { super(id.getName(), id); - if (id == ButtonID.LEFT) { + if (id == Component.Identifier.Button.LEFT) { index = 12; - } else if (id == ButtonID.RIGHT) { + } else if (id == Component.Identifier.Button.RIGHT) { index = 13; - } else if (id == ButtonID.MIDDLE) { + } else if (id == Component.Identifier.Button.MIDDLE) { index = 14; - } else if (id == ButtonID.SIDE) { + } else if (id == Component.Identifier.Button.SIDE) { index = 15; - } else if (id == ButtonID.EXTRA) { + } else if (id == Component.Identifier.Button.EXTRA) { index = 16; - } else if (id == ButtonID.FORWARD) { + } else if (id == Component.Identifier.Button.FORWARD) { index = 17; - } else if (id == ButtonID.BACK) { + } else if (id == Component.Identifier.Button.BACK) { index = 18; } else { throw new RuntimeException("Unknown button"); @@ -287,7 +287,7 @@ class DirectInputMouse extends Mouse { /** * Mouse ball axis implementation */ - class BallAxis extends AbstractAxis { + class BallAxis extends AbstractComponent { /** * Starting index into the mouseData array @@ -299,11 +299,11 @@ class DirectInputMouse extends Mouse { */ public BallAxis(Identifier id) { super(id.getName(), id); - if (id == Identifier.X) { + if (id == Identifier.Axis.X) { index = 0; - } else if (id == Identifier.Y) { + } else if (id == Identifier.Axis.Y) { index = 4; - } else if (id == Identifier.SLIDER) { + } else if (id == Identifier.Axis.SLIDER) { index = 8; } else { throw new RuntimeException("Unknown mouse axis"); diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java b/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java index 444bf02..5c02b24 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java @@ -37,7 +37,7 @@ public class DirectInputRumbler implements Rumbler { /** The native effect */ private long effect; /** The identifier of the axis we are attached too */ - private Axis.Identifier axisID; + private Component.Identifier axisID; /** The name of the axis this rumbler is attached too */ private String axisName; @@ -49,7 +49,7 @@ public class DirectInputRumbler implements Rumbler { * @param axisID The id of the axis this rumbler is attached too * @param axisName The name of the axis this rumbler is attached too */ - public DirectInputRumbler(DirectInputDevice device, long effect, Axis.Identifier axisID, String axisName) { + public DirectInputRumbler(DirectInputDevice device, long effect, Component.Identifier axisID, String axisName) { this.device = device; this.effect = effect; this.axisID = axisID; @@ -61,7 +61,7 @@ public class DirectInputRumbler implements Rumbler { * * @return The axis id */ - public Axis.Identifier getAxisIdentifier() { + public Component.Identifier getAxisIdentifier() { return axisID; } diff --git a/plugins/DX8/src/native/input.cpp b/plugins/DX8/src/native/input.cpp index c4eb7af..188c439 100644 --- a/plugins/DX8/src/native/input.cpp +++ b/plugins/DX8/src/native/input.cpp @@ -49,8 +49,8 @@ jfieldID FID_Side = NULL; jfieldID FID_Forward = NULL; jfieldID FID_Back = NULL; -const char* FD_AxisIdentifier = "Lnet/java/games/input/Axis$Identifier;"; -const char* FD_ButtonIdentifier = "Lnet/java/games/input/Mouse$ButtonID;"; +const char* FD_AxisIdentifier = "Lnet/java/games/input/Component$Identifier$Axis;"; +const char* FD_ButtonIdentifier = "Lnet/java/games/input/Component$Identifier$Button;"; // Dummy input window. This is needed because DirectX evidently needs a window // to do anything, such as setting the cooperative level for a device. const TCHAR* DUMMY_WINDOW_NAME = "InputControllerWindow"; @@ -151,7 +151,7 @@ break; */ BOOL InitIDs(JNIEnv* env) { CLASS_AxisIdentifier = - env->FindClass("net/java/games/input/Axis$Identifier"); + env->FindClass("net/java/games/input/Component$Identifier$Axis"); if (CLASS_AxisIdentifier == NULL) { return FALSE; } @@ -190,18 +190,18 @@ BOOL InitIDs(JNIEnv* env) { if (FID_Slider == NULL) { return FALSE; } - FID_Button = env->GetStaticFieldID(CLASS_AxisIdentifier, "BUTTON", +/* FID_Button = env->GetStaticFieldID(CLASS_AxisIdentifier, "BUTTON", FD_AxisIdentifier); if (FID_Button == NULL) { return FALSE; - } + }*/ FID_POV = env->GetStaticFieldID(CLASS_AxisIdentifier, "POV", FD_AxisIdentifier); if (FID_POV == NULL) { return FALSE; } CLASS_ButtonIdentifier = - env->FindClass("net/java/games/input/Mouse$ButtonID"); + env->FindClass("net/java/games/input/Component$Identifier$Button"); if (CLASS_ButtonIdentifier == NULL) { return FALSE; } @@ -258,12 +258,12 @@ BOOL InitIDs(JNIEnv* env) { return FALSE; } MID_AddAxis = env->GetMethodID(CLASS_DirectInputDevice, "addAxis", - "(Ljava/util/ArrayList;Lnet/java/games/input/Axis$Identifier;ILjava/lang/String;)V"); + "(Ljava/util/ArrayList;Lnet/java/games/input/Component$Identifier;ILjava/lang/String;)V"); if (MID_AddAxis == NULL) { return FALSE; } MID_AddRumbler = env->GetMethodID(CLASS_DirectInputDevice, "addRumbler", - "(JLnet/java/games/input/Axis$Identifier;Ljava/lang/String;)V"); + "(JLnet/java/games/input/Component$Identifier;Ljava/lang/String;)V"); if (MID_AddRumbler == NULL) { return FALSE; } @@ -283,7 +283,7 @@ BOOL InitIDs(JNIEnv* env) { return FALSE; } MID_RenameAxis = env->GetMethodID(CLASS_DirectInputMouse, "renameAxis", - "(Lnet/java/games/input/Axis$Identifier;Ljava/lang/String;)V"); + "(Lnet/java/games/input/Component$Identifier;Ljava/lang/String;)V"); if (MID_RenameAxis == NULL) { return FALSE; } diff --git a/plugins/awt/src/net/java/games/input/AWTAxis.java b/plugins/awt/src/net/java/games/input/AWTAxis.java index 62b049b..daa2e12 100644 --- a/plugins/awt/src/net/java/games/input/AWTAxis.java +++ b/plugins/awt/src/net/java/games/input/AWTAxis.java @@ -25,8 +25,6 @@ */ package net.java.games.input; -import net.java.games.input.Component.Identifier; - /** * @author Jeremy * diff --git a/plugins/awt/src/net/java/games/input/AWTButton.java b/plugins/awt/src/net/java/games/input/AWTButton.java index 8ccf984..6e36d16 100644 --- a/plugins/awt/src/net/java/games/input/AWTButton.java +++ b/plugins/awt/src/net/java/games/input/AWTButton.java @@ -25,8 +25,6 @@ */ package net.java.games.input; -import net.java.games.input.Component.Identifier; - /** * @author Jeremy * diff --git a/plugins/awt/src/net/java/games/input/AWTEnvironmentPlugin.java b/plugins/awt/src/net/java/games/input/AWTEnvironmentPlugin.java index 8faac5c..a155db5 100644 --- a/plugins/awt/src/net/java/games/input/AWTEnvironmentPlugin.java +++ b/plugins/awt/src/net/java/games/input/AWTEnvironmentPlugin.java @@ -25,9 +25,6 @@ */ package net.java.games.input; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - import net.java.games.input.Controller; import net.java.games.input.ControllerEnvironment; import net.java.games.util.plugins.Plugin; diff --git a/plugins/awt/src/net/java/games/input/AWTKeyboard.java b/plugins/awt/src/net/java/games/input/AWTKeyboard.java index d98c90d..dba9b0e 100644 --- a/plugins/awt/src/net/java/games/input/AWTKeyboard.java +++ b/plugins/awt/src/net/java/games/input/AWTKeyboard.java @@ -30,8 +30,6 @@ import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.KeyEvent; -import net.java.games.input.Keyboard.Key; - /** * @author Jeremy * @@ -50,7 +48,7 @@ public class AWTKeyboard extends StandardKeyboard implements AWTEventListener { protected AWTKeyboard(String name) { super(name); - buttonValues = new boolean[getAxes().length]; + buttonValues = new boolean[getComponents().length]; buttonMap = new int[65535]; //has to be this big, as the values of KeyEvent keys are large buttonMap[KeyEvent.VK_0] = Component.Identifier.Key._0.getKeyIndex(); diff --git a/plugins/awt/src/net/java/games/input/AWTMouse.java b/plugins/awt/src/net/java/games/input/AWTMouse.java index bbae94b..ed76ed6 100644 --- a/plugins/awt/src/net/java/games/input/AWTMouse.java +++ b/plugins/awt/src/net/java/games/input/AWTMouse.java @@ -31,7 +31,6 @@ import java.awt.Point; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; -import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseWheelEvent; /** diff --git a/plugins/linux/src/java/net/java/games/input/LinuxAxis.java b/plugins/linux/src/java/net/java/games/input/LinuxAxis.java index 28cb9d9..21f3bc5 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxAxis.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxAxis.java @@ -26,14 +26,14 @@ package net.java.games.input; -import net.java.games.input.AbstractAxis; +import net.java.games.input.AbstractComponent; import net.java.games.input.LinuxDevice; /** Represents an Axis absolute or relative * * @author Jeremy Booth ([email protected]) */ -public class LinuxAxis extends AbstractAxis { +public class LinuxAxis extends AbstractComponent { /** The controller this axis is part of */ private LinuxDevice controller; diff --git a/plugins/linux/src/java/net/java/games/input/LinuxDevice.java b/plugins/linux/src/java/net/java/games/input/LinuxDevice.java index 5e4be01..6ccd4e7 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxDevice.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxDevice.java @@ -173,7 +173,7 @@ public class LinuxDevice extends AbstractController { axesArray.add(buttons[i]); } } - axes = (Axis[]) axesArray.toArray(axes); + components = (Component[]) axesArray.toArray(components); guessType(); } @@ -417,11 +417,11 @@ public class LinuxDevice extends AbstractController { * @return The new button */ private LinuxAxis createButton(int buttonNumber, int nativeButtonType) { - Axis.Identifier id = LinuxNativeTypesMap.getButtonID(nativeButtonType); + Component.Identifier id = LinuxNativeTypesMap.getButtonID(nativeButtonType); String name = LinuxNativeTypesMap.getButtonName(nativeButtonType); if(name == null) { name = "Uknown button"; - id = new ButtonID(name); + id = Component.Identifier.Button.UNKNOWN; } return new LinuxAxis(this, buttonNumber, name, id, 0, false, true, false); @@ -433,7 +433,7 @@ public class LinuxDevice extends AbstractController { * @return The new axis */ private LinuxAxis createRelAxis(int axisNumber, int nativeType) { - Axis.Identifier id = LinuxNativeTypesMap.getRelAxisID(nativeType); + Component.Identifier id = LinuxNativeTypesMap.getRelAxisID(nativeType); String name = LinuxNativeTypesMap.getRelAxisName(nativeType); // This is done to be like the windows version @@ -449,15 +449,15 @@ public class LinuxDevice extends AbstractController { * @return The new axis */ private LinuxAxis createAbsAxis(int axisNumber, int nativeType) { - Axis.Identifier id = LinuxNativeTypesMap.getAbsAxisID(nativeType); + Component.Identifier id = LinuxNativeTypesMap.getAbsAxisID(nativeType); String name = LinuxNativeTypesMap.getAbsAxisName(nativeType); // Work around for a kernel level (I think) bug that incorrectly reports // the third axis as a rudder not a throttle on analog (gameport) 3 axis // 4 button sticks if((getName().equals("Analog 3-axis 4-button joystick")) && (portType == Controller.PortType.GAME)) { - if((id == Axis.Identifier.RZ) && (name.equals("Rudder"))) { - id = Axis.Identifier.SLIDER; + if((id == Component.Identifier.Axis.RZ) && (name.equals("Rudder"))) { + id = Component.Identifier.Axis.SLIDER; name = "Throttle"; } } @@ -616,7 +616,7 @@ public class LinuxDevice extends AbstractController { * A device that represents a joystick coolie hat. * @author Jeremy Booth ([email protected]) */ - public static class LinuxHat extends AbstractAxis { + public static class LinuxHat extends AbstractComponent { /** The parent controller */ @@ -644,7 +644,7 @@ public class LinuxDevice extends AbstractController { * @param yAxisID The Y axis native axis ID */ public LinuxHat(LinuxDevice controller, String name, int xAxisID, int yAxisID) { - super(name, Axis.Identifier.POV); + super(name, Component.Identifier.Axis.POV); System.out.println("Creating a Hat for device " + controller.getName() + " named " + name + " from axis " + xAxisID + " and " + yAxisID); @@ -729,211 +729,4 @@ public class LinuxDevice extends AbstractController { } - /** Some button ID's specific to linux devices - * @author Jeremy Booth ([email protected]) - */ - public static class ButtonID extends Axis.Identifier { - - /** First device button - */ - public static final ButtonID BTN_0 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_0)); - - /** Second device button - */ - public static final ButtonID BTN_1 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_1)); - - /** Thrid device button - */ - public static final ButtonID BTN_2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_2)); - - /** Fourth device button - */ - public static final ButtonID BTN_3 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_3)); - - /** Fifth device button - */ - public static final ButtonID BTN_4 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_4)); - - /** Sixth device button - */ - public static final ButtonID BTN_5 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_5)); - - /** Seventh device button - */ - public static final ButtonID BTN_6 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_6)); - - /** Eighth (had to check that spelling on dictionary.com) device button - */ - public static final ButtonID BTN_7 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_7)); - - /** Ninth device button - */ - public static final ButtonID BTN_8 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_8)); - - /** 10th device button - */ - public static final ButtonID BTN_9 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_9)); - - /** Joystick trigger button - */ - public static final ButtonID BTN_TRIGGER = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TRIGGER)); - - /** Joystick thumb button - */ - public static final ButtonID BTN_THUMB = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_THUMB)); - - /** Second joystick thumb button - */ - public static final ButtonID BTN_THUMB2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_THUMB2)); - - /** Joystick top button - */ - public static final ButtonID BTN_TOP = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOP)); - - /** Second joystick top button - */ - public static final ButtonID BTN_TOP2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOP2)); - - /** The joystick button you play with with you little finger (Pinkie on *that* side - * of the pond :P) - */ - public static final ButtonID BTN_PINKIE = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_PINKIE)); - - /** Joystick button on the base of the device - */ - public static final ButtonID BTN_BASE = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE)); - - /** Second joystick button on the base of the device - */ - public static final ButtonID BTN_BASE2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE2)); - - /** Thrid joystick button on the base of the device - */ - public static final ButtonID BTN_BASE3 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE3)); - - /** Fourth joystick button on the base of the device - */ - public static final ButtonID BTN_BASE4 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE4)); - - /** Fifth joystick button on the base of the device - */ - public static final ButtonID BTN_BASE5 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE5)); - - /** Sixth joystick button on the base of the device - */ - public static final ButtonID BTN_BASE6 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_BASE6)); - - /** erm, dunno, but it's in the defines so it might exist. - */ - public static final ButtonID BTN_DEAD = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_DEAD)); - - /** 'A' button on a gamepad - */ - public static final ButtonID BTN_A = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_A)); - - /** 'B' button on a gamepad - */ - public static final ButtonID BTN_B = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_B)); - - /** 'C' button on a gamepad - */ - public static final ButtonID BTN_C = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_C)); - - /** 'X' button on a gamepad - */ - public static final ButtonID BTN_X = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_X)); - - /** 'Y' button on a gamepad - */ - public static final ButtonID BTN_Y = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_Y)); - - /** 'Z' button on a gamepad - */ - public static final ButtonID BTN_Z = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_Z)); - - /** Left thumb button on a gamepad - */ - public static final ButtonID BTN_TL = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TL)); - - /** Right thumb button on a gamepad - */ - public static final ButtonID BTN_TR = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TR)); - - /** Second left thumb button on a gamepad - */ - public static final ButtonID BTN_TL2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TL2)); - - /** Second right thumb button on a gamepad - */ - public static final ButtonID BTN_TR2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TR2)); - - /** 'Select' button on a gamepad - */ - public static final ButtonID BTN_SELECT = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_SELECT)); - - /** 'Mode' button on a gamepad - */ - public static final ButtonID BTN_MODE = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_MODE)); - - /** Another left thumb button on a gamepad (how many thumbs do you have??) - */ - public static final ButtonID BTN_THUMBL = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_THUMBL)); - - /** Another right thumb button on a gamepad - */ - public static final ButtonID BTN_THUMBR = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_THUMBR)); - - /** Digitiser pen tool button - */ - public static final ButtonID BTN_TOOL_PEN = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_PEN)); - - /** Digitiser rubber (eraser) tool button - */ - public static final ButtonID BTN_TOOL_RUBBER = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_RUBBER)); - - /** Digitiser brush tool button - */ - public static final ButtonID BTN_TOOL_BRUSH = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_BRUSH)); - - /** Digitiser pencil tool button - */ - public static final ButtonID BTN_TOOL_PENCIL = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_PENCIL)); - - /** Digitiser airbrush tool button - */ - public static final ButtonID BTN_TOOL_AIRBRUSH = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_AIRBRUSH)); - - /** Digitiser finger tool button - */ - public static final ButtonID BTN_TOOL_FINGER = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_FINGER)); - - /** Digitiser mouse tool button - */ - public static final ButtonID BTN_TOOL_MOUSE = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_MOUSE)); - - /** Digitiser lens tool button - */ - public static final ButtonID BTN_TOOL_LENS = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOOL_LENS)); - - /** Digitiser touch button - */ - public static final ButtonID BTN_TOUCH = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_TOUCH)); - - /** Digitiser stylus button - */ - public static final ButtonID BTN_STYLUS = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_STYLUS)); - - /** Second digitiser stylus button - */ - public static final ButtonID BTN_STYLUS2 = new ButtonID(LinuxNativeTypesMap.getButtonName(NativeDefinitions.BTN_STYLUS2)); - - /** Create a new Button.Identidier with the passed name - * @param name The name for the new identifier - */ - private ButtonID(String name) { - super(name); - } - - } - } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java index da60789..1747ca3 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java @@ -33,8 +33,10 @@ import net.java.games.util.plugins.Plugin; public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plugin { static { - System.loadLibrary("jinput"); - } + if(isSupported()) { + System.loadLibrary("jinput"); + } + } /** List of controllers */ @@ -42,9 +44,23 @@ public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plu /** Creates a new instance of LinuxEnvironmentPlugin */ public LinuxEnvironmentPlugin() { - LinuxNativeTypesMap.init(); - init(); - createControllers(); + if(isSupported()) { + LinuxNativeTypesMap.init(); + init(); + createControllers(); + } else { + controllers = new Controller[0]; + } + } + + public static boolean isSupported() { + System.out.println("OS name is: " + System.getProperty("os.name")); + if(System.getProperty("os.name").indexOf("Linux")!=-1) { + System.out.println("Linux plugin is supported"); + return true; + } + System.out.println("Linux plugin is not supported"); + return false; } /** Returns a list of all controllers available to this environment, @@ -61,10 +77,24 @@ public class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plu private void createControllers() { int numDevices = getNumberOfDevices(); - controllers = new Controller[numDevices]; + Controller[] tempControllers = new Controller[numDevices]; + int numRealDevices = 0; + Controller tempController; for(int i=0;i<numDevices;i++) { - controllers[i] = createDevice(i); + tempController = createDevice(i); + if(tempController!=null) { + if(tempController.getComponents().length>0 || tempController.getControllers().length>0) { + tempControllers[numRealDevices] = tempController; + numRealDevices++; + } + } + } + + controllers = new Controller[numRealDevices]; + + for(int i=0;i<numRealDevices;i++) { + controllers[i] = tempControllers[i]; } } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java b/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java index 9fbb2d6..f6533bd 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxKeyboard.java @@ -104,7 +104,7 @@ public class LinuxKeyboard extends StandardKeyboard { System.out.println("id for supportedKeys index is " + LinuxNativeTypesMap.getButtonID(supportedKeys[keyMap[((Keyboard.KeyID) key.getIdentifier()).getKeyIndex()]])); System.out.flush(); }*/ - if(keyData[keyMap[((Keyboard.KeyID) key.getIdentifier()).getKeyIndex()]] > 0) { + if(keyData[keyMap[((Component.Identifier.Key) key.getIdentifier()).getKeyIndex()]] > 0) { return true; } return false; @@ -123,14 +123,14 @@ public class LinuxKeyboard extends StandardKeyboard { /** Goes through every key to initialise the key map */ private void setupKeyMap() { - for(int i=0;i<KeyID.LAST.getKeyIndex();i++) { + for(int i=0;i<Component.Identifier.Key.LAST.getKeyIndex();i++) { keyMap[i] = numKeys; } for(int i=0;i<numKeys;i++) { int tempNativeID = supportedKeys[i]; - Keyboard.KeyID tempKeyID = StandardKeyboard.KeyID.VOID; + Component.Identifier.Key tempKeyID = Component.Identifier.Key.VOID; try { - tempKeyID = (Keyboard.KeyID)LinuxNativeTypesMap.getButtonID(tempNativeID); + tempKeyID = (Component.Identifier.Key)LinuxNativeTypesMap.getButtonID(tempNativeID); } catch (ClassCastException e) { System.out.println("LinuxNativeTypesMap.getButtonID() returned " + LinuxNativeTypesMap.getButtonID(tempNativeID).getClass().toString()); } @@ -146,16 +146,16 @@ public class LinuxKeyboard extends StandardKeyboard { /** Renames all the keys based on what information we have about them (number/name) */ private void renameKeys() { - Axis tempAxes[] = getAxes(); + Component tempAxes[] = getComponents(); // Do this one by hand as it's a special case //((AbstractAxis)tempAxes[0]).setName("Unknown"); for(int i=0;i<tempAxes.length;i++) { - Axis tempAxis = tempAxes[i]; - int nativeKeyID = supportedKeys[keyMap[((Keyboard.KeyID) tempAxis.getIdentifier()).getKeyIndex()]]; + Component tempAxis = tempAxes[i]; + int nativeKeyID = supportedKeys[keyMap[((Component.Identifier.Key) tempAxis.getIdentifier()).getKeyIndex()]]; //System.out.println("key " + tempAxis + " map: " + nativeKeyID); if(nativeKeyID != NativeDefinitions.KEY_UNKNOWN) { String tempName = LinuxNativeTypesMap.getButtonName(nativeKeyID); - ((AbstractAxis)tempAxis).setName(tempName); + ((AbstractComponent)tempAxis).setName(tempName); /*System.out.println("axis id is " + (Keyboard.KeyID) tempAxis.getIdentifier()); System.out.println("keyMap[id] is " + keyMap[((Keyboard.KeyID) tempAxis.getIdentifier()).getKeyIndex()]); @@ -189,41 +189,5 @@ public class LinuxKeyboard extends StandardKeyboard { * @param deviceID The keybaord id * @return native port ype */ - private native int getNativePortType(int deviceID); - - /** Linux specific key ID's - * @author Jeremy Booth ([email protected]) - */ - public static class KeyID extends StandardKeyboard.KeyID { - - /** The Page up key id - */ - public static final KeyID PAGEUP = new KeyID(StandardKeyboard.KeyID.LAST.getKeyIndex()+1, "Page up"); - /** Page down key id - */ - public static final KeyID PAGEDOWN = new KeyID(StandardKeyboard.KeyID.LAST.getKeyIndex()+1, "Page down"); - /** The last defined key ID - */ - protected static final KeyID LAST = PAGEDOWN; - - /** The name of this key ID - */ - String name; - - /** Construct a new key ID from the passed arguments - * @param keyid The native ID of the key - * @param name The name fo the key - */ - public KeyID(int keyid, String name) { - super(keyid); - this.name = name; - } - - /** Returns a string representing this key ID - * @return String representing this key id - */ - public String toString() { - return super.toString() + " (" + name + ")"; - } - } + private native int getNativePortType(int deviceID); } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxMouse.java b/plugins/linux/src/java/net/java/games/input/LinuxMouse.java index 3336905..b345b5e 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxMouse.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxMouse.java @@ -42,10 +42,10 @@ public class LinuxMouse extends Mouse { super(device.getName()); this.device = device; - Axis[] axes = device.getAxes(); - Axis x = null; - Axis y = null; - Axis wheel = null; + Component[] components = device.getComponents(); + Component x = null; + Component y = null; + Component wheel = null; Button left = null; Button right = null; Button middle = null; @@ -55,30 +55,30 @@ public class LinuxMouse extends Mouse { Button back = null; // start from the back, that way the first one is it - for(int i = (axes.length -1);i>=0;i--) { - Axis tempAxis = axes[i]; + for(int i = (components.length -1);i>=0;i--) { + Component tempAxis = components[i]; if(tempAxis.isRelative()) { - if(tempAxis.getIdentifier() == Axis.Identifier.X) { + if(tempAxis.getIdentifier() == Component.Identifier.Axis.X) { x = tempAxis; - } else if(tempAxis.getIdentifier() == Axis.Identifier.Y) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Axis.Y) { y = tempAxis; - } else if(tempAxis.getIdentifier() == Axis.Identifier.SLIDER) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Axis.SLIDER) { wheel = tempAxis; } } else if(!(tempAxis.isAnalog())) { - if(tempAxis.getIdentifier() == Mouse.ButtonID.LEFT) { + if(tempAxis.getIdentifier() == Component.Identifier.Button.LEFT) { left = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.RIGHT) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.RIGHT) { right = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.MIDDLE) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.MIDDLE) { middle = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.SIDE) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.SIDE) { side = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.EXTRA) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.EXTRA) { extra = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.FORWARD) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.FORWARD) { forward = new LinuxMouseButton(tempAxis); - } else if(tempAxis.getIdentifier() == Mouse.ButtonID.BACK) { + } else if(tempAxis.getIdentifier() == Component.Identifier.Button.BACK) { back = new LinuxMouseButton(tempAxis); } } @@ -104,7 +104,7 @@ public class LinuxMouse extends Mouse { * @param y The y axis * @param wheel The mouse wheel axis */ - public LinuxMouseBall(Axis x, Axis y, Axis wheel) { + public LinuxMouseBall(Component x, Component y, Component wheel) { super(LinuxMouse.this.getName() + " ball"); this.x = x; this.y = y; @@ -141,13 +141,13 @@ public class LinuxMouse extends Mouse { private class LinuxMouseButton extends Mouse.Button { /** The real Axis */ - private Axis realAxis; + private Component realAxis; /** Construct a linux mouse button fro mthe given axis * @param axis The axis that holds the data */ - public LinuxMouseButton(Axis axis) { - super(axis.getName(), (Mouse.ButtonID)axis.getIdentifier()); + public LinuxMouseButton(Component axis) { + super(axis.getName(), (Component.Identifier.Button)axis.getIdentifier()); this.realAxis = axis; } diff --git a/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java b/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java index 96a11e3..6fcf06b 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java @@ -47,13 +47,13 @@ public class LinuxNativeTypesMap { private String absAxesNames[]; /** Indexed array of relative axis ID's */ - private Axis.Identifier relAxesIDs[]; + private Component.Identifier relAxesIDs[]; /** Indexed array of absoulte axis ID's */ - private Axis.Identifier absAxesIDs[]; + private Component.Identifier absAxesIDs[]; /** Indexed array of button axis ID's */ - private Axis.Identifier buttonIDs[]; + private Component.Identifier buttonIDs[]; /** create an empty, uninitialsed map */ @@ -338,125 +338,125 @@ public class LinuxNativeTypesMap { keyNames[NativeDefinitions.BTN_STYLUS] = "Digitiser Stylus Button "; keyNames[NativeDefinitions.BTN_STYLUS2] = "Second Digitiser Stylus Button "; - buttonIDs = new Axis.Identifier[NativeDefinitions.KEY_MAX]; - buttonIDs[NativeDefinitions.KEY_ESC] = StandardKeyboard.KeyID.ESCAPE; - buttonIDs[NativeDefinitions.KEY_1] = StandardKeyboard.KeyID._1; - buttonIDs[NativeDefinitions.KEY_2] = StandardKeyboard.KeyID._2; - buttonIDs[NativeDefinitions.KEY_3] = StandardKeyboard.KeyID._3; - buttonIDs[NativeDefinitions.KEY_4] = StandardKeyboard.KeyID._4; - buttonIDs[NativeDefinitions.KEY_5] = StandardKeyboard.KeyID._5; - buttonIDs[NativeDefinitions.KEY_6] = StandardKeyboard.KeyID._6; - buttonIDs[NativeDefinitions.KEY_7] = StandardKeyboard.KeyID._7; - buttonIDs[NativeDefinitions.KEY_8] = StandardKeyboard.KeyID._8; - buttonIDs[NativeDefinitions.KEY_9] = StandardKeyboard.KeyID._9; - buttonIDs[NativeDefinitions.KEY_0] = StandardKeyboard.KeyID._0; - buttonIDs[NativeDefinitions.KEY_MINUS] = StandardKeyboard.KeyID.MINUS; - buttonIDs[NativeDefinitions.KEY_EQUAL] = StandardKeyboard.KeyID.EQUALS; - buttonIDs[NativeDefinitions.KEY_BACKSPACE] = StandardKeyboard.KeyID.BACK; - buttonIDs[NativeDefinitions.KEY_TAB] = StandardKeyboard.KeyID.TAB; - buttonIDs[NativeDefinitions.KEY_Q] = StandardKeyboard.KeyID.Q; - buttonIDs[NativeDefinitions.KEY_W] = StandardKeyboard.KeyID.W; - buttonIDs[NativeDefinitions.KEY_E] = StandardKeyboard.KeyID.E; - buttonIDs[NativeDefinitions.KEY_R] = StandardKeyboard.KeyID.R; - buttonIDs[NativeDefinitions.KEY_T] = StandardKeyboard.KeyID.T; - buttonIDs[NativeDefinitions.KEY_Y] = StandardKeyboard.KeyID.Y; - buttonIDs[NativeDefinitions.KEY_U] = StandardKeyboard.KeyID.U; - buttonIDs[NativeDefinitions.KEY_I] = StandardKeyboard.KeyID.I; - buttonIDs[NativeDefinitions.KEY_O] = StandardKeyboard.KeyID.O; - buttonIDs[NativeDefinitions.KEY_P] = StandardKeyboard.KeyID.P; - buttonIDs[NativeDefinitions.KEY_LEFTBRACE] = StandardKeyboard.KeyID.LBRACKET; - buttonIDs[NativeDefinitions.KEY_RIGHTBRACE] = StandardKeyboard.KeyID.RBRACKET; - buttonIDs[NativeDefinitions.KEY_ENTER] = StandardKeyboard.KeyID.RETURN; - buttonIDs[NativeDefinitions.KEY_LEFTCTRL] = StandardKeyboard.KeyID.LCONTROL; - buttonIDs[NativeDefinitions.KEY_A] = StandardKeyboard.KeyID.A; - buttonIDs[NativeDefinitions.KEY_S] = StandardKeyboard.KeyID.S; - buttonIDs[NativeDefinitions.KEY_D] = StandardKeyboard.KeyID.D; - buttonIDs[NativeDefinitions.KEY_F] = StandardKeyboard.KeyID.F; - buttonIDs[NativeDefinitions.KEY_G] = StandardKeyboard.KeyID.G; - buttonIDs[NativeDefinitions.KEY_H] = StandardKeyboard.KeyID.H; - buttonIDs[NativeDefinitions.KEY_J] = StandardKeyboard.KeyID.J; - buttonIDs[NativeDefinitions.KEY_K] = StandardKeyboard.KeyID.K; - buttonIDs[NativeDefinitions.KEY_L] = StandardKeyboard.KeyID.L; - buttonIDs[NativeDefinitions.KEY_SEMICOLON] = StandardKeyboard.KeyID.SEMICOLON; - buttonIDs[NativeDefinitions.KEY_APOSTROPHE] = StandardKeyboard.KeyID.APOSTROPHE; - buttonIDs[NativeDefinitions.KEY_GRAVE] = StandardKeyboard.KeyID.GRAVE; - buttonIDs[NativeDefinitions.KEY_LEFTSHIFT] = StandardKeyboard.KeyID.LSHIFT; - buttonIDs[NativeDefinitions.KEY_BACKSLASH] = StandardKeyboard.KeyID.BACKSLASH; - buttonIDs[NativeDefinitions.KEY_Z] = StandardKeyboard.KeyID.Z; - buttonIDs[NativeDefinitions.KEY_X] = StandardKeyboard.KeyID.X; - buttonIDs[NativeDefinitions.KEY_C] = StandardKeyboard.KeyID.C; - buttonIDs[NativeDefinitions.KEY_V] = StandardKeyboard.KeyID.V; - buttonIDs[NativeDefinitions.KEY_B] = StandardKeyboard.KeyID.B; - buttonIDs[NativeDefinitions.KEY_N] = StandardKeyboard.KeyID.N; - buttonIDs[NativeDefinitions.KEY_M] = StandardKeyboard.KeyID.M; - buttonIDs[NativeDefinitions.KEY_COMMA] = StandardKeyboard.KeyID.COMMA; - buttonIDs[NativeDefinitions.KEY_DOT] = StandardKeyboard.KeyID.PERIOD; - buttonIDs[NativeDefinitions.KEY_SLASH] = StandardKeyboard.KeyID.SLASH; - buttonIDs[NativeDefinitions.KEY_RIGHTSHIFT] = StandardKeyboard.KeyID.RSHIFT; - buttonIDs[NativeDefinitions.KEY_KPASTERISK] = StandardKeyboard.KeyID.MULTIPLY; - buttonIDs[NativeDefinitions.KEY_LEFTALT] = StandardKeyboard.KeyID.LALT; - buttonIDs[NativeDefinitions.KEY_SPACE] = StandardKeyboard.KeyID.SPACE; - buttonIDs[NativeDefinitions.KEY_CAPSLOCK] = StandardKeyboard.KeyID.CAPITAL; - buttonIDs[NativeDefinitions.KEY_F1] = StandardKeyboard.KeyID.F1; - buttonIDs[NativeDefinitions.KEY_F2] = StandardKeyboard.KeyID.F2; - buttonIDs[NativeDefinitions.KEY_F3] = StandardKeyboard.KeyID.F3; - buttonIDs[NativeDefinitions.KEY_F4] = StandardKeyboard.KeyID.F4; - buttonIDs[NativeDefinitions.KEY_F5] = StandardKeyboard.KeyID.F5; - buttonIDs[NativeDefinitions.KEY_F6] = StandardKeyboard.KeyID.F6; - buttonIDs[NativeDefinitions.KEY_F7] = StandardKeyboard.KeyID.F7; - buttonIDs[NativeDefinitions.KEY_F8] = StandardKeyboard.KeyID.F8; - buttonIDs[NativeDefinitions.KEY_F9] = StandardKeyboard.KeyID.F9; - buttonIDs[NativeDefinitions.KEY_F10] = StandardKeyboard.KeyID.F10; - buttonIDs[NativeDefinitions.KEY_NUMLOCK] = StandardKeyboard.KeyID.NUMLOCK; - buttonIDs[NativeDefinitions.KEY_SCROLLLOCK] = StandardKeyboard.KeyID.SCROLL; - buttonIDs[NativeDefinitions.KEY_KP7] = StandardKeyboard.KeyID.NUMPAD7; - buttonIDs[NativeDefinitions.KEY_KP8] = StandardKeyboard.KeyID.NUMPAD8; - buttonIDs[NativeDefinitions.KEY_KP9] = StandardKeyboard.KeyID.NUMPAD9; - buttonIDs[NativeDefinitions.KEY_KPMINUS] = StandardKeyboard.KeyID.SUBTRACT; - buttonIDs[NativeDefinitions.KEY_KP4] = StandardKeyboard.KeyID.NUMPAD4; - buttonIDs[NativeDefinitions.KEY_KP5] = StandardKeyboard.KeyID.NUMPAD5; - buttonIDs[NativeDefinitions.KEY_KP6] = StandardKeyboard.KeyID.NUMPAD6; - buttonIDs[NativeDefinitions.KEY_KPPLUS] = StandardKeyboard.KeyID.ADD; - buttonIDs[NativeDefinitions.KEY_KP1] = StandardKeyboard.KeyID.NUMPAD1; - buttonIDs[NativeDefinitions.KEY_KP2] = StandardKeyboard.KeyID.NUMPAD2; - buttonIDs[NativeDefinitions.KEY_KP3] = StandardKeyboard.KeyID.NUMPAD3; - buttonIDs[NativeDefinitions.KEY_KP0] = StandardKeyboard.KeyID.NUMPAD0; - buttonIDs[NativeDefinitions.KEY_KPDOT] = StandardKeyboard.KeyID.DECIMAL; + buttonIDs = new Component.Identifier[NativeDefinitions.KEY_MAX]; + buttonIDs[NativeDefinitions.KEY_ESC] = Component.Identifier.Key.ESCAPE; + buttonIDs[NativeDefinitions.KEY_1] = Component.Identifier.Key._1; + buttonIDs[NativeDefinitions.KEY_2] = Component.Identifier.Key._2; + buttonIDs[NativeDefinitions.KEY_3] = Component.Identifier.Key._3; + buttonIDs[NativeDefinitions.KEY_4] = Component.Identifier.Key._4; + buttonIDs[NativeDefinitions.KEY_5] = Component.Identifier.Key._5; + buttonIDs[NativeDefinitions.KEY_6] = Component.Identifier.Key._6; + buttonIDs[NativeDefinitions.KEY_7] = Component.Identifier.Key._7; + buttonIDs[NativeDefinitions.KEY_8] = Component.Identifier.Key._8; + buttonIDs[NativeDefinitions.KEY_9] = Component.Identifier.Key._9; + buttonIDs[NativeDefinitions.KEY_0] = Component.Identifier.Key._0; + buttonIDs[NativeDefinitions.KEY_MINUS] = Component.Identifier.Key.MINUS; + buttonIDs[NativeDefinitions.KEY_EQUAL] = Component.Identifier.Key.EQUALS; + buttonIDs[NativeDefinitions.KEY_BACKSPACE] = Component.Identifier.Key.BACK; + buttonIDs[NativeDefinitions.KEY_TAB] = Component.Identifier.Key.TAB; + buttonIDs[NativeDefinitions.KEY_Q] = Component.Identifier.Key.Q; + buttonIDs[NativeDefinitions.KEY_W] = Component.Identifier.Key.W; + buttonIDs[NativeDefinitions.KEY_E] = Component.Identifier.Key.E; + buttonIDs[NativeDefinitions.KEY_R] = Component.Identifier.Key.R; + buttonIDs[NativeDefinitions.KEY_T] = Component.Identifier.Key.T; + buttonIDs[NativeDefinitions.KEY_Y] = Component.Identifier.Key.Y; + buttonIDs[NativeDefinitions.KEY_U] = Component.Identifier.Key.U; + buttonIDs[NativeDefinitions.KEY_I] = Component.Identifier.Key.I; + buttonIDs[NativeDefinitions.KEY_O] = Component.Identifier.Key.O; + buttonIDs[NativeDefinitions.KEY_P] = Component.Identifier.Key.P; + buttonIDs[NativeDefinitions.KEY_LEFTBRACE] = Component.Identifier.Key.LBRACKET; + buttonIDs[NativeDefinitions.KEY_RIGHTBRACE] = Component.Identifier.Key.RBRACKET; + buttonIDs[NativeDefinitions.KEY_ENTER] = Component.Identifier.Key.RETURN; + buttonIDs[NativeDefinitions.KEY_LEFTCTRL] = Component.Identifier.Key.LCONTROL; + buttonIDs[NativeDefinitions.KEY_A] = Component.Identifier.Key.A; + buttonIDs[NativeDefinitions.KEY_S] = Component.Identifier.Key.S; + buttonIDs[NativeDefinitions.KEY_D] = Component.Identifier.Key.D; + buttonIDs[NativeDefinitions.KEY_F] = Component.Identifier.Key.F; + buttonIDs[NativeDefinitions.KEY_G] = Component.Identifier.Key.G; + buttonIDs[NativeDefinitions.KEY_H] = Component.Identifier.Key.H; + buttonIDs[NativeDefinitions.KEY_J] = Component.Identifier.Key.J; + buttonIDs[NativeDefinitions.KEY_K] = Component.Identifier.Key.K; + buttonIDs[NativeDefinitions.KEY_L] = Component.Identifier.Key.L; + buttonIDs[NativeDefinitions.KEY_SEMICOLON] = Component.Identifier.Key.SEMICOLON; + buttonIDs[NativeDefinitions.KEY_APOSTROPHE] = Component.Identifier.Key.APOSTROPHE; + buttonIDs[NativeDefinitions.KEY_GRAVE] = Component.Identifier.Key.GRAVE; + buttonIDs[NativeDefinitions.KEY_LEFTSHIFT] = Component.Identifier.Key.LSHIFT; + buttonIDs[NativeDefinitions.KEY_BACKSLASH] = Component.Identifier.Key.BACKSLASH; + buttonIDs[NativeDefinitions.KEY_Z] = Component.Identifier.Key.Z; + buttonIDs[NativeDefinitions.KEY_X] = Component.Identifier.Key.X; + buttonIDs[NativeDefinitions.KEY_C] = Component.Identifier.Key.C; + buttonIDs[NativeDefinitions.KEY_V] = Component.Identifier.Key.V; + buttonIDs[NativeDefinitions.KEY_B] = Component.Identifier.Key.B; + buttonIDs[NativeDefinitions.KEY_N] = Component.Identifier.Key.N; + buttonIDs[NativeDefinitions.KEY_M] = Component.Identifier.Key.M; + buttonIDs[NativeDefinitions.KEY_COMMA] = Component.Identifier.Key.COMMA; + buttonIDs[NativeDefinitions.KEY_DOT] = Component.Identifier.Key.PERIOD; + buttonIDs[NativeDefinitions.KEY_SLASH] = Component.Identifier.Key.SLASH; + buttonIDs[NativeDefinitions.KEY_RIGHTSHIFT] = Component.Identifier.Key.RSHIFT; + buttonIDs[NativeDefinitions.KEY_KPASTERISK] = Component.Identifier.Key.MULTIPLY; + buttonIDs[NativeDefinitions.KEY_LEFTALT] = Component.Identifier.Key.LALT; + buttonIDs[NativeDefinitions.KEY_SPACE] = Component.Identifier.Key.SPACE; + buttonIDs[NativeDefinitions.KEY_CAPSLOCK] = Component.Identifier.Key.CAPITAL; + buttonIDs[NativeDefinitions.KEY_F1] = Component.Identifier.Key.F1; + buttonIDs[NativeDefinitions.KEY_F2] = Component.Identifier.Key.F2; + buttonIDs[NativeDefinitions.KEY_F3] = Component.Identifier.Key.F3; + buttonIDs[NativeDefinitions.KEY_F4] = Component.Identifier.Key.F4; + buttonIDs[NativeDefinitions.KEY_F5] = Component.Identifier.Key.F5; + buttonIDs[NativeDefinitions.KEY_F6] = Component.Identifier.Key.F6; + buttonIDs[NativeDefinitions.KEY_F7] = Component.Identifier.Key.F7; + buttonIDs[NativeDefinitions.KEY_F8] = Component.Identifier.Key.F8; + buttonIDs[NativeDefinitions.KEY_F9] = Component.Identifier.Key.F9; + buttonIDs[NativeDefinitions.KEY_F10] = Component.Identifier.Key.F10; + buttonIDs[NativeDefinitions.KEY_NUMLOCK] = Component.Identifier.Key.NUMLOCK; + buttonIDs[NativeDefinitions.KEY_SCROLLLOCK] = Component.Identifier.Key.SCROLL; + buttonIDs[NativeDefinitions.KEY_KP7] = Component.Identifier.Key.NUMPAD7; + buttonIDs[NativeDefinitions.KEY_KP8] = Component.Identifier.Key.NUMPAD8; + buttonIDs[NativeDefinitions.KEY_KP9] = Component.Identifier.Key.NUMPAD9; + buttonIDs[NativeDefinitions.KEY_KPMINUS] = Component.Identifier.Key.SUBTRACT; + buttonIDs[NativeDefinitions.KEY_KP4] = Component.Identifier.Key.NUMPAD4; + buttonIDs[NativeDefinitions.KEY_KP5] = Component.Identifier.Key.NUMPAD5; + buttonIDs[NativeDefinitions.KEY_KP6] = Component.Identifier.Key.NUMPAD6; + buttonIDs[NativeDefinitions.KEY_KPPLUS] = Component.Identifier.Key.ADD; + buttonIDs[NativeDefinitions.KEY_KP1] = Component.Identifier.Key.NUMPAD1; + buttonIDs[NativeDefinitions.KEY_KP2] = Component.Identifier.Key.NUMPAD2; + buttonIDs[NativeDefinitions.KEY_KP3] = Component.Identifier.Key.NUMPAD3; + buttonIDs[NativeDefinitions.KEY_KP0] = Component.Identifier.Key.NUMPAD0; + buttonIDs[NativeDefinitions.KEY_KPDOT] = Component.Identifier.Key.DECIMAL; buttonIDs[NativeDefinitions.KEY_103RD] = null; - buttonIDs[NativeDefinitions.KEY_F13] = StandardKeyboard.KeyID.F13; + buttonIDs[NativeDefinitions.KEY_F13] = Component.Identifier.Key.F13; buttonIDs[NativeDefinitions.KEY_102ND] = null; - buttonIDs[NativeDefinitions.KEY_F11] = StandardKeyboard.KeyID.F11; - buttonIDs[NativeDefinitions.KEY_F12] = StandardKeyboard.KeyID.F12; - buttonIDs[NativeDefinitions.KEY_F14] = StandardKeyboard.KeyID.F14; - buttonIDs[NativeDefinitions.KEY_F15] = StandardKeyboard.KeyID.F15; + buttonIDs[NativeDefinitions.KEY_F11] = Component.Identifier.Key.F11; + buttonIDs[NativeDefinitions.KEY_F12] = Component.Identifier.Key.F12; + buttonIDs[NativeDefinitions.KEY_F14] = Component.Identifier.Key.F14; + buttonIDs[NativeDefinitions.KEY_F15] = Component.Identifier.Key.F15; buttonIDs[NativeDefinitions.KEY_F16] = null; buttonIDs[NativeDefinitions.KEY_F17] = null; buttonIDs[NativeDefinitions.KEY_F18] = null; buttonIDs[NativeDefinitions.KEY_F19] = null; buttonIDs[NativeDefinitions.KEY_F20] = null; - buttonIDs[NativeDefinitions.KEY_KPENTER] = StandardKeyboard.KeyID.NUMPADENTER; - buttonIDs[NativeDefinitions.KEY_RIGHTCTRL] = StandardKeyboard.KeyID.RCONTROL; - buttonIDs[NativeDefinitions.KEY_KPSLASH] = StandardKeyboard.KeyID.DIVIDE; - buttonIDs[NativeDefinitions.KEY_SYSRQ] = StandardKeyboard.KeyID.SYSRQ; - buttonIDs[NativeDefinitions.KEY_RIGHTALT] = StandardKeyboard.KeyID.RALT; + buttonIDs[NativeDefinitions.KEY_KPENTER] = Component.Identifier.Key.NUMPADENTER; + buttonIDs[NativeDefinitions.KEY_RIGHTCTRL] = Component.Identifier.Key.RCONTROL; + buttonIDs[NativeDefinitions.KEY_KPSLASH] = Component.Identifier.Key.DIVIDE; + buttonIDs[NativeDefinitions.KEY_SYSRQ] = Component.Identifier.Key.SYSRQ; + buttonIDs[NativeDefinitions.KEY_RIGHTALT] = Component.Identifier.Key.RALT; buttonIDs[NativeDefinitions.KEY_LINEFEED] = null; - buttonIDs[NativeDefinitions.KEY_HOME] = StandardKeyboard.KeyID.HOME; - buttonIDs[NativeDefinitions.KEY_UP] = StandardKeyboard.KeyID.UP; - buttonIDs[NativeDefinitions.KEY_PAGEUP] = LinuxKeyboard.KeyID.PAGEUP; - buttonIDs[NativeDefinitions.KEY_LEFT] = StandardKeyboard.KeyID.LEFT; - buttonIDs[NativeDefinitions.KEY_RIGHT] = StandardKeyboard.KeyID.RIGHT; - buttonIDs[NativeDefinitions.KEY_END] = StandardKeyboard.KeyID.END; - buttonIDs[NativeDefinitions.KEY_DOWN] = StandardKeyboard.KeyID.DOWN; - buttonIDs[NativeDefinitions.KEY_PAGEDOWN] = LinuxKeyboard.KeyID.PAGEDOWN; - buttonIDs[NativeDefinitions.KEY_INSERT] = StandardKeyboard.KeyID.INSERT; - buttonIDs[NativeDefinitions.KEY_DELETE] = StandardKeyboard.KeyID.DELETE; - buttonIDs[NativeDefinitions.KEY_PAUSE] = StandardKeyboard.KeyID.PAUSE; + buttonIDs[NativeDefinitions.KEY_HOME] = Component.Identifier.Key.HOME; + buttonIDs[NativeDefinitions.KEY_UP] = Component.Identifier.Key.UP; + buttonIDs[NativeDefinitions.KEY_PAGEUP] = Component.Identifier.Key.PAGEUP; + buttonIDs[NativeDefinitions.KEY_LEFT] = Component.Identifier.Key.LEFT; + buttonIDs[NativeDefinitions.KEY_RIGHT] = Component.Identifier.Key.RIGHT; + buttonIDs[NativeDefinitions.KEY_END] = Component.Identifier.Key.END; + buttonIDs[NativeDefinitions.KEY_DOWN] = Component.Identifier.Key.DOWN; + buttonIDs[NativeDefinitions.KEY_PAGEDOWN] = Component.Identifier.Key.PAGEDOWN; + buttonIDs[NativeDefinitions.KEY_INSERT] = Component.Identifier.Key.INSERT; + buttonIDs[NativeDefinitions.KEY_DELETE] = Component.Identifier.Key.DELETE; + buttonIDs[NativeDefinitions.KEY_PAUSE] = Component.Identifier.Key.PAUSE; /* buttonIDs[NativeDefinitions.KEY_MACRO] = "Macro"; buttonIDs[NativeDefinitions.KEY_MUTE] = "Mute"; buttonIDs[NativeDefinitions.KEY_VOLUMEDOWN] = "Volume Down"; buttonIDs[NativeDefinitions.KEY_VOLUMEUP] = "Volume Up"; buttonIDs[NativeDefinitions.KEY_POWER] = "Power";*/ - buttonIDs[NativeDefinitions.KEY_KPEQUAL] = StandardKeyboard.KeyID.NUMPADEQUAL; + buttonIDs[NativeDefinitions.KEY_KPEQUAL] = Component.Identifier.Key.NUMPADEQUAL; //buttonIDs[NativeDefinitions.KEY_KPPLUSMINUS] = "KeyPad +/-"; /* buttonIDs[NativeDefinitions.KEY_F21] = "F21"; buttonIDs[NativeDefinitions.KEY_F22] = "F22"; @@ -480,7 +480,7 @@ public class LinuxNativeTypesMap { buttonIDs[NativeDefinitions.KEY_MENU] = "Menu"; buttonIDs[NativeDefinitions.KEY_CALC] = "Calculator"; buttonIDs[NativeDefinitions.KEY_SETUP] = "Setup";*/ - buttonIDs[NativeDefinitions.KEY_SLEEP] = StandardKeyboard.KeyID.SLEEP; + buttonIDs[NativeDefinitions.KEY_SLEEP] = Component.Identifier.Key.SLEEP; /*buttonIDs[NativeDefinitions.KEY_WAKEUP] = "Wakeup"; buttonIDs[NativeDefinitions.KEY_FILE] = "File"; buttonIDs[NativeDefinitions.KEY_SENDFILE] = "Send File"; @@ -543,74 +543,74 @@ public class LinuxNativeTypesMap { buttonIDs[NativeDefinitions.KEY_PROG4] = "Program 4"; buttonIDs[NativeDefinitions.KEY_SUSPEND] = "Suspend"; buttonIDs[NativeDefinitions.KEY_CLOSE] = "Close";*/ - buttonIDs[NativeDefinitions.KEY_UNKNOWN] = StandardKeyboard.KeyID.UNLABELED; + buttonIDs[NativeDefinitions.KEY_UNKNOWN] = Component.Identifier.Key.UNLABELED; /*buttonIDs[NativeDefinitions.KEY_BRIGHTNESSDOWN] = "Brightness Down"; buttonIDs[NativeDefinitions.KEY_BRIGHTNESSUP] = "Brightness Up";*/ //Msic keys - buttonIDs[NativeDefinitions.BTN_0] = LinuxDevice.ButtonID.BTN_0; - buttonIDs[NativeDefinitions.BTN_1] = LinuxDevice.ButtonID.BTN_1; - buttonIDs[NativeDefinitions.BTN_2] = LinuxDevice.ButtonID.BTN_2; - buttonIDs[NativeDefinitions.BTN_3] = LinuxDevice.ButtonID.BTN_3; - buttonIDs[NativeDefinitions.BTN_4] = LinuxDevice.ButtonID.BTN_4; - buttonIDs[NativeDefinitions.BTN_5] = LinuxDevice.ButtonID.BTN_5; - buttonIDs[NativeDefinitions.BTN_6] = LinuxDevice.ButtonID.BTN_6; - buttonIDs[NativeDefinitions.BTN_7] = LinuxDevice.ButtonID.BTN_7; - buttonIDs[NativeDefinitions.BTN_8] = LinuxDevice.ButtonID.BTN_8; - buttonIDs[NativeDefinitions.BTN_9] = LinuxDevice.ButtonID.BTN_9; + buttonIDs[NativeDefinitions.BTN_0] = Component.Identifier.Button._0; + buttonIDs[NativeDefinitions.BTN_1] = Component.Identifier.Button._1; + buttonIDs[NativeDefinitions.BTN_2] = Component.Identifier.Button._2; + buttonIDs[NativeDefinitions.BTN_3] = Component.Identifier.Button._3; + buttonIDs[NativeDefinitions.BTN_4] = Component.Identifier.Button._4; + buttonIDs[NativeDefinitions.BTN_5] = Component.Identifier.Button._5; + buttonIDs[NativeDefinitions.BTN_6] = Component.Identifier.Button._6; + buttonIDs[NativeDefinitions.BTN_7] = Component.Identifier.Button._7; + buttonIDs[NativeDefinitions.BTN_8] = Component.Identifier.Button._8; + buttonIDs[NativeDefinitions.BTN_9] = Component.Identifier.Button._9; // Mouse - buttonIDs[NativeDefinitions.BTN_LEFT] = Mouse.ButtonID.LEFT; - buttonIDs[NativeDefinitions.BTN_RIGHT] = Mouse.ButtonID.RIGHT; - buttonIDs[NativeDefinitions.BTN_MIDDLE] = Mouse.ButtonID.MIDDLE; - buttonIDs[NativeDefinitions.BTN_SIDE] = Mouse.ButtonID.SIDE; - buttonIDs[NativeDefinitions.BTN_EXTRA] = Mouse.ButtonID.EXTRA; - buttonIDs[NativeDefinitions.BTN_FORWARD] = Mouse.ButtonID.FORWARD; - buttonIDs[NativeDefinitions.BTN_BACK] = Mouse.ButtonID.BACK; + buttonIDs[NativeDefinitions.BTN_LEFT] = Component.Identifier.Button.LEFT; + buttonIDs[NativeDefinitions.BTN_RIGHT] = Component.Identifier.Button.RIGHT; + buttonIDs[NativeDefinitions.BTN_MIDDLE] = Component.Identifier.Button.MIDDLE; + buttonIDs[NativeDefinitions.BTN_SIDE] = Component.Identifier.Button.SIDE; + buttonIDs[NativeDefinitions.BTN_EXTRA] = Component.Identifier.Button.EXTRA; + buttonIDs[NativeDefinitions.BTN_FORWARD] = Component.Identifier.Button.FORWARD; + buttonIDs[NativeDefinitions.BTN_BACK] = Component.Identifier.Button.BACK; // Joystick - buttonIDs[NativeDefinitions.BTN_TRIGGER] = LinuxDevice.ButtonID.BTN_TRIGGER; - buttonIDs[NativeDefinitions.BTN_THUMB] = LinuxDevice.ButtonID.BTN_THUMB; - buttonIDs[NativeDefinitions.BTN_THUMB2] = LinuxDevice.ButtonID.BTN_THUMB2; - buttonIDs[NativeDefinitions.BTN_TOP] = LinuxDevice.ButtonID.BTN_TOP; - buttonIDs[NativeDefinitions.BTN_TOP2] = LinuxDevice.ButtonID.BTN_TOP2; - buttonIDs[NativeDefinitions.BTN_PINKIE] = LinuxDevice.ButtonID.BTN_PINKIE; - buttonIDs[NativeDefinitions.BTN_BASE] = LinuxDevice.ButtonID.BTN_BASE; - buttonIDs[NativeDefinitions.BTN_BASE2] = LinuxDevice.ButtonID.BTN_BASE2; - buttonIDs[NativeDefinitions.BTN_BASE3] = LinuxDevice.ButtonID.BTN_BASE3; - buttonIDs[NativeDefinitions.BTN_BASE4] = LinuxDevice.ButtonID.BTN_BASE4; - buttonIDs[NativeDefinitions.BTN_BASE5] = LinuxDevice.ButtonID.BTN_BASE5; - buttonIDs[NativeDefinitions.BTN_BASE6] = LinuxDevice.ButtonID.BTN_BASE6; - buttonIDs[NativeDefinitions.BTN_DEAD] = LinuxDevice.ButtonID.BTN_DEAD; + buttonIDs[NativeDefinitions.BTN_TRIGGER] = Component.Identifier.Button.TRIGGER; + buttonIDs[NativeDefinitions.BTN_THUMB] = Component.Identifier.Button.THUMB; + buttonIDs[NativeDefinitions.BTN_THUMB2] = Component.Identifier.Button.THUMB2; + buttonIDs[NativeDefinitions.BTN_TOP] = Component.Identifier.Button.TOP; + buttonIDs[NativeDefinitions.BTN_TOP2] = Component.Identifier.Button.TOP2; + buttonIDs[NativeDefinitions.BTN_PINKIE] = Component.Identifier.Button.PINKIE; + buttonIDs[NativeDefinitions.BTN_BASE] = Component.Identifier.Button.BASE; + buttonIDs[NativeDefinitions.BTN_BASE2] = Component.Identifier.Button.BASE2; + buttonIDs[NativeDefinitions.BTN_BASE3] = Component.Identifier.Button.BASE3; + buttonIDs[NativeDefinitions.BTN_BASE4] = Component.Identifier.Button.BASE4; + buttonIDs[NativeDefinitions.BTN_BASE5] = Component.Identifier.Button.BASE5; + buttonIDs[NativeDefinitions.BTN_BASE6] = Component.Identifier.Button.BASE6; + buttonIDs[NativeDefinitions.BTN_DEAD] = Component.Identifier.Button.DEAD; // Gamepad - buttonIDs[NativeDefinitions.BTN_A] = LinuxDevice.ButtonID.BTN_A; - buttonIDs[NativeDefinitions.BTN_B] = LinuxDevice.ButtonID.BTN_B; - buttonIDs[NativeDefinitions.BTN_C] = LinuxDevice.ButtonID.BTN_C; - buttonIDs[NativeDefinitions.BTN_X] = LinuxDevice.ButtonID.BTN_X; - buttonIDs[NativeDefinitions.BTN_Y] = LinuxDevice.ButtonID.BTN_Y; - buttonIDs[NativeDefinitions.BTN_Z] = LinuxDevice.ButtonID.BTN_Z; - buttonIDs[NativeDefinitions.BTN_TL] = LinuxDevice.ButtonID.BTN_TL; - buttonIDs[NativeDefinitions.BTN_TR] = LinuxDevice.ButtonID.BTN_TR; - buttonIDs[NativeDefinitions.BTN_TL2] = LinuxDevice.ButtonID.BTN_TL2; - buttonIDs[NativeDefinitions.BTN_TR2] = LinuxDevice.ButtonID.BTN_TR2; - buttonIDs[NativeDefinitions.BTN_SELECT] = LinuxDevice.ButtonID.BTN_SELECT; - buttonIDs[NativeDefinitions.BTN_MODE] = LinuxDevice.ButtonID.BTN_MODE; - buttonIDs[NativeDefinitions.BTN_THUMBL] = LinuxDevice.ButtonID.BTN_THUMBL; - buttonIDs[NativeDefinitions.BTN_THUMBR] = LinuxDevice.ButtonID.BTN_THUMBR; + buttonIDs[NativeDefinitions.BTN_A] = Component.Identifier.Button.A; + buttonIDs[NativeDefinitions.BTN_B] = Component.Identifier.Button.B; + buttonIDs[NativeDefinitions.BTN_C] = Component.Identifier.Button.C; + buttonIDs[NativeDefinitions.BTN_X] = Component.Identifier.Button.X; + buttonIDs[NativeDefinitions.BTN_Y] = Component.Identifier.Button.Y; + buttonIDs[NativeDefinitions.BTN_Z] = Component.Identifier.Button.Z; + buttonIDs[NativeDefinitions.BTN_TL] = Component.Identifier.Button.LEFT_THUMB; + buttonIDs[NativeDefinitions.BTN_TR] = Component.Identifier.Button.RIGHT_THUMB; + buttonIDs[NativeDefinitions.BTN_TL2] = Component.Identifier.Button.LEFT_THUMB2; + buttonIDs[NativeDefinitions.BTN_TR2] = Component.Identifier.Button.RIGHT_THUMB2; + buttonIDs[NativeDefinitions.BTN_SELECT] = Component.Identifier.Button.SELECT; + buttonIDs[NativeDefinitions.BTN_MODE] = Component.Identifier.Button.MODE; + buttonIDs[NativeDefinitions.BTN_THUMBL] = Component.Identifier.Button.LEFT_THUMB3; + buttonIDs[NativeDefinitions.BTN_THUMBR] = Component.Identifier.Button.RIGHT_THUMB3; // Digitiser - buttonIDs[NativeDefinitions.BTN_TOOL_PEN] = LinuxDevice.ButtonID.BTN_TOOL_PEN; - buttonIDs[NativeDefinitions.BTN_TOOL_RUBBER] = LinuxDevice.ButtonID.BTN_TOOL_RUBBER; - buttonIDs[NativeDefinitions.BTN_TOOL_BRUSH] = LinuxDevice.ButtonID.BTN_TOOL_BRUSH; - buttonIDs[NativeDefinitions.BTN_TOOL_PENCIL] = LinuxDevice.ButtonID.BTN_TOOL_PENCIL; - buttonIDs[NativeDefinitions.BTN_TOOL_AIRBRUSH] = LinuxDevice.ButtonID.BTN_TOOL_AIRBRUSH; - buttonIDs[NativeDefinitions.BTN_TOOL_FINGER] = LinuxDevice.ButtonID.BTN_TOOL_FINGER; - buttonIDs[NativeDefinitions.BTN_TOOL_MOUSE] = LinuxDevice.ButtonID.BTN_TOOL_MOUSE; - buttonIDs[NativeDefinitions.BTN_TOOL_LENS] = LinuxDevice.ButtonID.BTN_TOOL_LENS; - buttonIDs[NativeDefinitions.BTN_TOUCH] = LinuxDevice.ButtonID.BTN_TOUCH; - buttonIDs[NativeDefinitions.BTN_STYLUS] = LinuxDevice.ButtonID.BTN_STYLUS; - buttonIDs[NativeDefinitions.BTN_STYLUS2] = LinuxDevice.ButtonID.BTN_STYLUS2; + buttonIDs[NativeDefinitions.BTN_TOOL_PEN] = Component.Identifier.Button.TOOL_PEN; + buttonIDs[NativeDefinitions.BTN_TOOL_RUBBER] = Component.Identifier.Button.TOOL_RUBBER; + buttonIDs[NativeDefinitions.BTN_TOOL_BRUSH] = Component.Identifier.Button.TOOL_BRUSH; + buttonIDs[NativeDefinitions.BTN_TOOL_PENCIL] = Component.Identifier.Button.TOOL_PENCIL; + buttonIDs[NativeDefinitions.BTN_TOOL_AIRBRUSH] = Component.Identifier.Button.TOOL_AIRBRUSH; + buttonIDs[NativeDefinitions.BTN_TOOL_FINGER] = Component.Identifier.Button.TOOL_FINGER; + buttonIDs[NativeDefinitions.BTN_TOOL_MOUSE] = Component.Identifier.Button.TOOL_MOUSE; + buttonIDs[NativeDefinitions.BTN_TOOL_LENS] = Component.Identifier.Button.TOOL_LENS; + buttonIDs[NativeDefinitions.BTN_TOUCH] = Component.Identifier.Button.TOUCH; + buttonIDs[NativeDefinitions.BTN_STYLUS] = Component.Identifier.Button.STYLUS; + buttonIDs[NativeDefinitions.BTN_STYLUS2] = Component.Identifier.Button.STYLUS2; relAxesNames = new String[NativeDefinitions.REL_MAX]; relAxesNames[NativeDefinitions.REL_X] = "X axis"; @@ -621,15 +621,15 @@ public class LinuxNativeTypesMap { relAxesNames[NativeDefinitions.REL_WHEEL] = "Vertical wheel"; relAxesNames[NativeDefinitions.REL_MISC] = "Miscellaneous"; - relAxesIDs = new Axis.Identifier[NativeDefinitions.REL_MAX]; - relAxesIDs[NativeDefinitions.REL_X] = Axis.Identifier.X; - relAxesIDs[NativeDefinitions.REL_Y] = Axis.Identifier.Y; - relAxesIDs[NativeDefinitions.REL_Z] = Axis.Identifier.Z; - relAxesIDs[NativeDefinitions.REL_WHEEL] = Axis.Identifier.SLIDER; + relAxesIDs = new Component.Identifier[NativeDefinitions.REL_MAX]; + relAxesIDs[NativeDefinitions.REL_X] = Component.Identifier.Axis.X; + relAxesIDs[NativeDefinitions.REL_Y] = Component.Identifier.Axis.Y; + relAxesIDs[NativeDefinitions.REL_Z] = Component.Identifier.Axis.Z; + relAxesIDs[NativeDefinitions.REL_WHEEL] = Component.Identifier.Axis.SLIDER; // There are guesses as I have no idea what they would be used for - relAxesIDs[NativeDefinitions.REL_HWHEEL] = Axis.Identifier.SLIDER; - relAxesIDs[NativeDefinitions.REL_DIAL] = Axis.Identifier.SLIDER; - relAxesIDs[NativeDefinitions.REL_MISC] = Axis.Identifier.SLIDER; + relAxesIDs[NativeDefinitions.REL_HWHEEL] = Component.Identifier.Axis.SLIDER; + relAxesIDs[NativeDefinitions.REL_DIAL] = Component.Identifier.Axis.SLIDER; + relAxesIDs[NativeDefinitions.REL_MISC] = Component.Identifier.Axis.SLIDER; absAxesNames = new String[NativeDefinitions.ABS_MAX]; absAxesNames[NativeDefinitions.ABS_X] = "X axis"; @@ -658,27 +658,27 @@ public class LinuxNativeTypesMap { absAxesNames[NativeDefinitions.ABS_TILT_Y] = "Y axis tilt"; absAxesNames[NativeDefinitions.ABS_MISC] = "Miscellaneous"; - absAxesIDs = new Axis.Identifier[NativeDefinitions.ABS_MAX]; - absAxesIDs[NativeDefinitions.ABS_X] = Axis.Identifier.X; - absAxesIDs[NativeDefinitions.ABS_Y] = Axis.Identifier.Y; - absAxesIDs[NativeDefinitions.ABS_Z] = Axis.Identifier.Z; - absAxesIDs[NativeDefinitions.ABS_RX] = Axis.Identifier.RX; - absAxesIDs[NativeDefinitions.ABS_RY] = Axis.Identifier.RY; - absAxesIDs[NativeDefinitions.ABS_RZ] = Axis.Identifier.RZ; - absAxesIDs[NativeDefinitions.ABS_THROTTLE] = Axis.Identifier.SLIDER; - absAxesIDs[NativeDefinitions.ABS_RUDDER] = Axis.Identifier.RZ; - absAxesIDs[NativeDefinitions.ABS_WHEEL] = Axis.Identifier.Y; - absAxesIDs[NativeDefinitions.ABS_GAS] = Axis.Identifier.SLIDER; - absAxesIDs[NativeDefinitions.ABS_BRAKE] = Axis.Identifier.SLIDER; + absAxesIDs = new Component.Identifier[NativeDefinitions.ABS_MAX]; + absAxesIDs[NativeDefinitions.ABS_X] = Component.Identifier.Axis.X; + absAxesIDs[NativeDefinitions.ABS_Y] = Component.Identifier.Axis.Y; + absAxesIDs[NativeDefinitions.ABS_Z] = Component.Identifier.Axis.Z; + absAxesIDs[NativeDefinitions.ABS_RX] = Component.Identifier.Axis.RX; + absAxesIDs[NativeDefinitions.ABS_RY] = Component.Identifier.Axis.RY; + absAxesIDs[NativeDefinitions.ABS_RZ] = Component.Identifier.Axis.RZ; + absAxesIDs[NativeDefinitions.ABS_THROTTLE] = Component.Identifier.Axis.SLIDER; + absAxesIDs[NativeDefinitions.ABS_RUDDER] = Component.Identifier.Axis.RZ; + absAxesIDs[NativeDefinitions.ABS_WHEEL] = Component.Identifier.Axis.Y; + absAxesIDs[NativeDefinitions.ABS_GAS] = Component.Identifier.Axis.SLIDER; + absAxesIDs[NativeDefinitions.ABS_BRAKE] = Component.Identifier.Axis.SLIDER; // Hats are done this way as they are mapped from two axis down to one - absAxesIDs[NativeDefinitions.ABS_HAT0X] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT0Y] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT1X] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT1Y] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT2X] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT2Y] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT3X] = Axis.Identifier.POV; - absAxesIDs[NativeDefinitions.ABS_HAT3Y] = Axis.Identifier.POV; + absAxesIDs[NativeDefinitions.ABS_HAT0X] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT0Y] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT1X] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT1Y] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT2X] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT2Y] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT3X] = Component.Identifier.Axis.POV; + absAxesIDs[NativeDefinitions.ABS_HAT3Y] = Component.Identifier.Axis.POV; // erm, yeah absAxesIDs[NativeDefinitions.ABS_PRESSURE] = null; absAxesIDs[NativeDefinitions.ABS_DISTANCE] = null; @@ -753,10 +753,10 @@ public class LinuxNativeTypesMap { * @param nativeID The axis type ID * @return The jinput id */ - public static Axis.Identifier getRelAxisID(int nativeID) { - Axis.Identifier retval = INSTANCE.relAxesIDs[nativeID]; + public static Component.Identifier getRelAxisID(int nativeID) { + Component.Identifier retval = INSTANCE.relAxesIDs[nativeID]; if(retval == null) { - retval = Axis.Identifier.SLIDER_VELOCITY; + retval = Component.Identifier.Axis.SLIDER_VELOCITY; INSTANCE.relAxesIDs[nativeID] = retval; } return retval; @@ -766,10 +766,10 @@ public class LinuxNativeTypesMap { * @param nativeID The native axis type id * @return The jinput id */ - public static Axis.Identifier getAbsAxisID(int nativeID) { - Axis.Identifier retval = INSTANCE.absAxesIDs[nativeID]; + public static Component.Identifier getAbsAxisID(int nativeID) { + Component.Identifier retval = INSTANCE.absAxesIDs[nativeID]; if(retval == null) { - retval = Axis.Identifier.SLIDER; + retval = Component.Identifier.Axis.SLIDER; INSTANCE.absAxesIDs[nativeID] = retval; } return retval; @@ -779,10 +779,10 @@ public class LinuxNativeTypesMap { * @param nativeID The native button type id * @return The jinput id */ - public static Axis.Identifier getButtonID(int nativeID) { - Axis.Identifier retval = INSTANCE.buttonIDs[nativeID]; + public static Component.Identifier getButtonID(int nativeID) { + Component.Identifier retval = INSTANCE.buttonIDs[nativeID]; if(retval == null) { - retval = new LinuxKeyboard.KeyID(nativeID, getButtonName(nativeID)); + retval = Component.Identifier.Key.UNKNOWN; INSTANCE.buttonIDs[nativeID] = retval; } return retval; |