diff --git a/etc/build.xml b/etc/build.xml deleted file mode 100644 index 509822e..0000000 --- a/etc/build.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/etc/nb5/.cvsignore b/etc/nb5/.cvsignore deleted file mode 100644 index 9d0b71a..0000000 --- a/etc/nb5/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -build -dist diff --git a/etc/nb5/build.xml b/etc/nb5/build.xml deleted file mode 100644 index 80ab72e..0000000 --- a/etc/nb5/build.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - Builds, tests, and runs the project jxinput. - - - diff --git a/etc/nb5/manifest.mf b/etc/nb5/manifest.mf deleted file mode 100644 index 328e8e5..0000000 --- a/etc/nb5/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/etc/nb5/nbproject/.cvsignore b/etc/nb5/nbproject/.cvsignore deleted file mode 100644 index 3e18ebf..0000000 --- a/etc/nb5/nbproject/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -private diff --git a/etc/nb5/nbproject/build-impl.xml b/etc/nb5/nbproject/build-impl.xml deleted file mode 100644 index 08b7cd7..0000000 --- a/etc/nb5/nbproject/build-impl.xml +++ /dev/null @@ -1,532 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - - - - - - java -cp "${run.classpath.with.dist.jar}" ${main.class} - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - diff --git a/etc/nb5/nbproject/genfiles.properties b/etc/nb5/nbproject/genfiles.properties deleted file mode 100644 index a6c84f7..0000000 --- a/etc/nb5/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=3ba4020f -build.xml.script.CRC32=654a06bb -build.xml.stylesheet.CRC32=d5b6853a -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=3ba4020f -nbproject/build-impl.xml.script.CRC32=00e7e9f7 -nbproject/build-impl.xml.stylesheet.CRC32=99b91518 diff --git a/etc/nb5/nbproject/project.properties b/etc/nb5/nbproject/project.properties deleted file mode 100644 index a0f0bc5..0000000 --- a/etc/nb5/nbproject/project.properties +++ /dev/null @@ -1,57 +0,0 @@ -application.args= -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/jxinput.jar -dist.javadoc.dir=${dist.dir}/javadoc -file.reference.jxinput-java=../../java -jar.compress=false -javac.classpath=\ - ${libs.Java3D.classpath} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.source=1.5 -javac.target=1.5 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir}:\ - ${libs.junit.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding= -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=de.hardcode.jxinput.test.JXInputTestDialog -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value -# or test-sys-prop.name=value to set system properties for unit tests): -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -src.dir=${file.reference.jxinput-java} diff --git a/etc/nb5/nbproject/project.xml b/etc/nb5/nbproject/project.xml deleted file mode 100644 index 9f941d5..0000000 --- a/etc/nb5/nbproject/project.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - jxinput - 1.6.5 - - - - - - - diff --git a/java/de/hardcode/jxinput/j3d/test/HelloUniverse.java b/java/de/hardcode/jxinput/j3d/test/HelloUniverse.java deleted file mode 100644 index fde34bc..0000000 --- a/java/de/hardcode/jxinput/j3d/test/HelloUniverse.java +++ /dev/null @@ -1,205 +0,0 @@ - -/* - * @(#)HelloUniverse.java 1.15 02/02/07 14:48:36 - * - * Copyright (c) 1996-2002 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: - * - * - Redistributions 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 materials provided with the - * distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * 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 WARRANTY OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY - * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES - * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THE 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 OR INABILITY TO USE SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that Software is not designed,licensed or intended - * for use in the design, construction, operation or maintenance of - * any nuclear facility. - */ - -package de.hardcode.jxinput.j3d.test; - - -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import com.sun.j3d.utils.applet.MainFrame; -import com.sun.j3d.utils.geometry.ColorCube; -import com.sun.j3d.utils.universe.*; -import javax.media.j3d.*; -import javax.vecmath.*; -import de.hardcode.jxinput.j3d.DeviceConfiguration; -import de.hardcode.jxinput.Axis; -import de.hardcode.jxinput.JXInputManager; -import de.hardcode.jxinput.j3d.IsActiveCondition; -import de.hardcode.jxinput.j3d.J3DInputDevice; -import de.hardcode.jxinput.j3d.IsActiveOnButtonCondition; - - -public class HelloUniverse extends Applet -{ - - private SimpleUniverse u = null; - TransformGroup objTrans; - - public BranchGroup createSceneGraph() - { - BranchGroup objRoot = new BranchGroup(); - objTrans = new TransformGroup(); - objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); - objRoot.addChild(objTrans); - objTrans.addChild(new ColorCube(0.4)); - -// Transform3D yAxis = new Transform3D(); -// Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, -// 0, 0, -// 4000, 0, 0, -// 0, 0, 0); -// RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, -// 0.0f, (float) Math.PI*2.0f); -// BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0); -// rotator.setSchedulingBounds(bounds); -// objTrans.addChild(rotator); - return objRoot; - } - - - public HelloUniverse() - { - - } - - public void init() - { - // These are the string arguments given to the VirtualInputDevice - // constructor. These are settable parameters. Look in the - // VirtualInputDevice constructor for a complete list. - String[] args = new String[10]; - args[0] = "printvalues"; - args[1] = "true"; - args[2] = "yscreeninitloc"; - args[3] = "50"; - args[4] = null; - - - // now create the HelloUniverse Canvas - setLayout(new BorderLayout()); - GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); - - Canvas3D c = new Canvas3D(config); - add("Center", c); - - // Create a simple scene and attach it to the virtual universe - BranchGroup scene = createSceneGraph(); - u = new SimpleUniverse(c); - - // - // Use the inputdevice - // - InputDevice device = createInputDevice(); - - // Register the VirtualInputDevice with Java 3D - u.getViewer().getPhysicalEnvironment().addInputDevice( device ); - -// TransformGroup viewTrans = u.getViewingPlatform().getViewPlatformTransform(); - - // Put the behavoir to teh object - SensorBehavior s = new SensorBehavior( objTrans, device.getSensor(0) ); - s.setSchedulingBounds( new BoundingSphere( new Point3d(0.0,0.0,0.0), Float.MAX_VALUE ) ); - objTrans.addChild( s ); - - u.getViewingPlatform().setNominalViewingTransform(); - u.addBranchGraph(scene); - } - - public void destroy() - { - u.removeAllLocales(); - } - - - /** - * Setup an input device. - */ - private InputDevice createInputDevice() - { - IsActiveCondition button1down = new IsActiveOnButtonCondition(JXInputManager.getJXInputDevice( 0 ).getButton( 0 ), true ); - IsActiveCondition button1up = new IsActiveOnButtonCondition(JXInputManager.getJXInputDevice( 0 ).getButton( 0 ), false ); - - Axis xaxis = JXInputManager.getJXInputDevice( 0 ).getAxis( Axis.ID_X ); - Axis yaxis = JXInputManager.getJXInputDevice( 0 ).getAxis( Axis.ID_Y ); - - DeviceConfiguration cnf = new DeviceConfiguration(); - - // - // Setup the configuration to use joysticks x/y for rotation is not button is pressed - // and for translation if button1 is pressed. - // - cnf.setRotational( - DeviceConfiguration.AXIS_Y, - xaxis, - button1up, - IsActiveCondition.NEVER, - 0.0, Math.PI - ); - - cnf.setRotational( - DeviceConfiguration.AXIS_X, - yaxis, - button1up, - IsActiveCondition.NEVER, - 0.0, Math.PI - ); - - cnf.setTranslational( - DeviceConfiguration.AXIS_Z, - yaxis, - button1down, - IsActiveCondition.NEVER, - -5.0, 4.0 - ); - cnf.setTranslational( - DeviceConfiguration.AXIS_X, - xaxis, - button1down, - IsActiveCondition.NEVER, - 0.0, 4.0 - ); - - // We have the config, create the device... - J3DInputDevice d = new J3DInputDevice( cnf ); - - // The InputDevice must be initialized before registering it - // with the PhysicalEnvironment object. - d.initialize(); - - return d; - } - - - public static void main(String[] args) - { - new MainFrame(new HelloUniverse(), 350, 350); - } -} diff --git a/java/de/hardcode/jxinput/j3d/test/SensorBehavior.java b/java/de/hardcode/jxinput/j3d/test/SensorBehavior.java deleted file mode 100644 index 6836ebb..0000000 --- a/java/de/hardcode/jxinput/j3d/test/SensorBehavior.java +++ /dev/null @@ -1,70 +0,0 @@ -package de.hardcode.jxinput.j3d.test; - -/* - * @(#)SensorBehavior.java 1.8 02/02/07 14:48:34 - * - * Copyright (c) 1996-2002 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: - * - * - Redistributions 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 materials provided with the - * distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * 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 WARRANTY OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY - * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES - * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THE 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 OR INABILITY TO USE SOFTWARE, - * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that Software is not designed,licensed or intended - * for use in the design, construction, operation or maintenance of - * any nuclear facility. - */ - -import javax.media.j3d.*; -import java.util.*; - -public class SensorBehavior extends Behavior -{ - private WakeupOnElapsedFrames conditions = new WakeupOnElapsedFrames(0); - private TransformGroup transformGroup; - private Sensor sensor; - private Transform3D transform = new Transform3D(); - - public SensorBehavior( TransformGroup tg, Sensor sensor ) - { - transformGroup = tg; - this.sensor = sensor; - } - - public void initialize() - { - wakeupOn( conditions ); - } - - public void processStimulus( Enumeration criteria ) - { - sensor.getRead( transform ); - transformGroup.setTransform( transform ); - wakeupOn( conditions ); - } - -} diff --git a/java/de/hardcode/jxinput/package.html b/java/de/hardcode/jxinput/package.html deleted file mode 100644 index c449914..0000000 --- a/java/de/hardcode/jxinput/package.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - -JXInput by HARDCODE Dev., Dipl. Phys. Joerg Plewe. -

-JXInput connects gaming input devices like joysticks or gamepads to the Java -environment. -

-Comments send to jxinput@hardcode.de. - - diff --git a/java/de/hardcode/jxinput/Axis.java b/src/main/java/de/hardcode/jxinput/Axis.java similarity index 100% rename from java/de/hardcode/jxinput/Axis.java rename to src/main/java/de/hardcode/jxinput/Axis.java diff --git a/java/de/hardcode/jxinput/Button.java b/src/main/java/de/hardcode/jxinput/Button.java similarity index 100% rename from java/de/hardcode/jxinput/Button.java rename to src/main/java/de/hardcode/jxinput/Button.java diff --git a/java/de/hardcode/jxinput/Directional.java b/src/main/java/de/hardcode/jxinput/Directional.java similarity index 100% rename from java/de/hardcode/jxinput/Directional.java rename to src/main/java/de/hardcode/jxinput/Directional.java diff --git a/java/de/hardcode/jxinput/Feature.java b/src/main/java/de/hardcode/jxinput/Feature.java similarity index 100% rename from java/de/hardcode/jxinput/Feature.java rename to src/main/java/de/hardcode/jxinput/Feature.java diff --git a/java/de/hardcode/jxinput/JXInputDevice.java b/src/main/java/de/hardcode/jxinput/JXInputDevice.java similarity index 100% rename from java/de/hardcode/jxinput/JXInputDevice.java rename to src/main/java/de/hardcode/jxinput/JXInputDevice.java diff --git a/java/de/hardcode/jxinput/JXInputManager.java b/src/main/java/de/hardcode/jxinput/JXInputManager.java similarity index 100% rename from java/de/hardcode/jxinput/JXInputManager.java rename to src/main/java/de/hardcode/jxinput/JXInputManager.java diff --git a/java/de/hardcode/jxinput/directinput/DIAxis.java b/src/main/java/de/hardcode/jxinput/directinput/DIAxis.java similarity index 100% rename from java/de/hardcode/jxinput/directinput/DIAxis.java rename to src/main/java/de/hardcode/jxinput/directinput/DIAxis.java diff --git a/java/de/hardcode/jxinput/directinput/DIButton.java b/src/main/java/de/hardcode/jxinput/directinput/DIButton.java similarity index 100% rename from java/de/hardcode/jxinput/directinput/DIButton.java rename to src/main/java/de/hardcode/jxinput/directinput/DIButton.java diff --git a/java/de/hardcode/jxinput/directinput/DIDirectional.java b/src/main/java/de/hardcode/jxinput/directinput/DIDirectional.java similarity index 100% rename from java/de/hardcode/jxinput/directinput/DIDirectional.java rename to src/main/java/de/hardcode/jxinput/directinput/DIDirectional.java diff --git a/java/de/hardcode/jxinput/directinput/DirectInputDevice.java b/src/main/java/de/hardcode/jxinput/directinput/DirectInputDevice.java similarity index 100% rename from java/de/hardcode/jxinput/directinput/DirectInputDevice.java rename to src/main/java/de/hardcode/jxinput/directinput/DirectInputDevice.java diff --git a/java/de/hardcode/jxinput/directinput/DirectInputDriver.java b/src/main/java/de/hardcode/jxinput/directinput/DirectInputDriver.java similarity index 100% rename from java/de/hardcode/jxinput/directinput/DirectInputDriver.java rename to src/main/java/de/hardcode/jxinput/directinput/DirectInputDriver.java diff --git a/java/de/hardcode/jxinput/directinput/Log.java b/src/main/java/de/hardcode/jxinput/directinput/Log.java similarity index 100% rename from java/de/hardcode/jxinput/directinput/Log.java rename to src/main/java/de/hardcode/jxinput/directinput/Log.java diff --git a/java/de/hardcode/jxinput/event/JXInputAxisEvent.java b/src/main/java/de/hardcode/jxinput/event/JXInputAxisEvent.java similarity index 100% rename from java/de/hardcode/jxinput/event/JXInputAxisEvent.java rename to src/main/java/de/hardcode/jxinput/event/JXInputAxisEvent.java diff --git a/java/de/hardcode/jxinput/event/JXInputAxisEventListener.java b/src/main/java/de/hardcode/jxinput/event/JXInputAxisEventListener.java similarity index 100% rename from java/de/hardcode/jxinput/event/JXInputAxisEventListener.java rename to src/main/java/de/hardcode/jxinput/event/JXInputAxisEventListener.java diff --git a/java/de/hardcode/jxinput/event/JXInputButtonEvent.java b/src/main/java/de/hardcode/jxinput/event/JXInputButtonEvent.java similarity index 100% rename from java/de/hardcode/jxinput/event/JXInputButtonEvent.java rename to src/main/java/de/hardcode/jxinput/event/JXInputButtonEvent.java diff --git a/java/de/hardcode/jxinput/event/JXInputButtonEventListener.java b/src/main/java/de/hardcode/jxinput/event/JXInputButtonEventListener.java similarity index 100% rename from java/de/hardcode/jxinput/event/JXInputButtonEventListener.java rename to src/main/java/de/hardcode/jxinput/event/JXInputButtonEventListener.java diff --git a/java/de/hardcode/jxinput/event/JXInputDirectionalEvent.java b/src/main/java/de/hardcode/jxinput/event/JXInputDirectionalEvent.java similarity index 100% rename from java/de/hardcode/jxinput/event/JXInputDirectionalEvent.java rename to src/main/java/de/hardcode/jxinput/event/JXInputDirectionalEvent.java diff --git a/java/de/hardcode/jxinput/event/JXInputDirectionalEventListener.java b/src/main/java/de/hardcode/jxinput/event/JXInputDirectionalEventListener.java similarity index 100% rename from java/de/hardcode/jxinput/event/JXInputDirectionalEventListener.java rename to src/main/java/de/hardcode/jxinput/event/JXInputDirectionalEventListener.java diff --git a/java/de/hardcode/jxinput/event/JXInputEventManager.java b/src/main/java/de/hardcode/jxinput/event/JXInputEventManager.java similarity index 100% rename from java/de/hardcode/jxinput/event/JXInputEventManager.java rename to src/main/java/de/hardcode/jxinput/event/JXInputEventManager.java diff --git a/java/de/hardcode/jxinput/j3d/DeviceConfiguration.java b/src/main/java/de/hardcode/jxinput/j3d/DeviceConfiguration.java similarity index 100% rename from java/de/hardcode/jxinput/j3d/DeviceConfiguration.java rename to src/main/java/de/hardcode/jxinput/j3d/DeviceConfiguration.java diff --git a/java/de/hardcode/jxinput/j3d/IsActiveCondition.java b/src/main/java/de/hardcode/jxinput/j3d/IsActiveCondition.java similarity index 100% rename from java/de/hardcode/jxinput/j3d/IsActiveCondition.java rename to src/main/java/de/hardcode/jxinput/j3d/IsActiveCondition.java diff --git a/java/de/hardcode/jxinput/j3d/IsActiveOnButtonCondition.java b/src/main/java/de/hardcode/jxinput/j3d/IsActiveOnButtonCondition.java similarity index 100% rename from java/de/hardcode/jxinput/j3d/IsActiveOnButtonCondition.java rename to src/main/java/de/hardcode/jxinput/j3d/IsActiveOnButtonCondition.java diff --git a/java/de/hardcode/jxinput/j3d/IsAlwaysActiveCondition.java b/src/main/java/de/hardcode/jxinput/j3d/IsAlwaysActiveCondition.java similarity index 100% rename from java/de/hardcode/jxinput/j3d/IsAlwaysActiveCondition.java rename to src/main/java/de/hardcode/jxinput/j3d/IsAlwaysActiveCondition.java diff --git a/java/de/hardcode/jxinput/j3d/J3DInputDevice.java b/src/main/java/de/hardcode/jxinput/j3d/J3DInputDevice.java similarity index 100% rename from java/de/hardcode/jxinput/j3d/J3DInputDevice.java rename to src/main/java/de/hardcode/jxinput/j3d/J3DInputDevice.java diff --git a/java/de/hardcode/jxinput/j3d/package.html b/src/main/java/de/hardcode/jxinput/j3d/package.html similarity index 100% rename from java/de/hardcode/jxinput/j3d/package.html rename to src/main/java/de/hardcode/jxinput/j3d/package.html diff --git a/java/de/hardcode/jxinput/keyboard/InvalidKeyCodeException.java b/src/main/java/de/hardcode/jxinput/keyboard/InvalidKeyCodeException.java similarity index 100% rename from java/de/hardcode/jxinput/keyboard/InvalidKeyCodeException.java rename to src/main/java/de/hardcode/jxinput/keyboard/InvalidKeyCodeException.java diff --git a/java/de/hardcode/jxinput/keyboard/JXKeyboardInputDevice.java b/src/main/java/de/hardcode/jxinput/keyboard/JXKeyboardInputDevice.java similarity index 100% rename from java/de/hardcode/jxinput/keyboard/JXKeyboardInputDevice.java rename to src/main/java/de/hardcode/jxinput/keyboard/JXKeyboardInputDevice.java diff --git a/java/de/hardcode/jxinput/keyboard/KeyButton.java b/src/main/java/de/hardcode/jxinput/keyboard/KeyButton.java similarity index 100% rename from java/de/hardcode/jxinput/keyboard/KeyButton.java rename to src/main/java/de/hardcode/jxinput/keyboard/KeyButton.java diff --git a/java/de/hardcode/jxinput/keyboard/KeyboardDriver.java b/src/main/java/de/hardcode/jxinput/keyboard/KeyboardDriver.java similarity index 100% rename from java/de/hardcode/jxinput/keyboard/KeyboardDriver.java rename to src/main/java/de/hardcode/jxinput/keyboard/KeyboardDriver.java diff --git a/java/de/hardcode/jxinput/keyboard/package.html b/src/main/java/de/hardcode/jxinput/keyboard/package.html similarity index 100% rename from java/de/hardcode/jxinput/keyboard/package.html rename to src/main/java/de/hardcode/jxinput/keyboard/package.html diff --git a/java/de/hardcode/jxinput/test/AxisListener.java b/src/main/java/de/hardcode/jxinput/test/AxisListener.java similarity index 100% rename from java/de/hardcode/jxinput/test/AxisListener.java rename to src/main/java/de/hardcode/jxinput/test/AxisListener.java diff --git a/java/de/hardcode/jxinput/test/ButtonListener.java b/src/main/java/de/hardcode/jxinput/test/ButtonListener.java similarity index 100% rename from java/de/hardcode/jxinput/test/ButtonListener.java rename to src/main/java/de/hardcode/jxinput/test/ButtonListener.java diff --git a/java/de/hardcode/jxinput/test/DirectionalListener.java b/src/main/java/de/hardcode/jxinput/test/DirectionalListener.java similarity index 100% rename from java/de/hardcode/jxinput/test/DirectionalListener.java rename to src/main/java/de/hardcode/jxinput/test/DirectionalListener.java diff --git a/java/de/hardcode/jxinput/test/JXInputDevicePanel.form b/src/main/java/de/hardcode/jxinput/test/JXInputDevicePanel.form similarity index 100% rename from java/de/hardcode/jxinput/test/JXInputDevicePanel.form rename to src/main/java/de/hardcode/jxinput/test/JXInputDevicePanel.form diff --git a/java/de/hardcode/jxinput/test/JXInputDevicePanel.java b/src/main/java/de/hardcode/jxinput/test/JXInputDevicePanel.java similarity index 100% rename from java/de/hardcode/jxinput/test/JXInputDevicePanel.java rename to src/main/java/de/hardcode/jxinput/test/JXInputDevicePanel.java diff --git a/java/de/hardcode/jxinput/test/JXInputTestDialog.form b/src/main/java/de/hardcode/jxinput/test/JXInputTestDialog.form similarity index 100% rename from java/de/hardcode/jxinput/test/JXInputTestDialog.form rename to src/main/java/de/hardcode/jxinput/test/JXInputTestDialog.form diff --git a/java/de/hardcode/jxinput/test/JXInputTestDialog.java b/src/main/java/de/hardcode/jxinput/test/JXInputTestDialog.java similarity index 100% rename from java/de/hardcode/jxinput/test/JXInputTestDialog.java rename to src/main/java/de/hardcode/jxinput/test/JXInputTestDialog.java diff --git a/java/de/hardcode/jxinput/util/LatestChangedValueAxis.java b/src/main/java/de/hardcode/jxinput/util/LatestChangedValueAxis.java similarity index 100% rename from java/de/hardcode/jxinput/util/LatestChangedValueAxis.java rename to src/main/java/de/hardcode/jxinput/util/LatestChangedValueAxis.java diff --git a/java/de/hardcode/jxinput/util/OrButton.java b/src/main/java/de/hardcode/jxinput/util/OrButton.java similarity index 100% rename from java/de/hardcode/jxinput/util/OrButton.java rename to src/main/java/de/hardcode/jxinput/util/OrButton.java diff --git a/java/de/hardcode/jxinput/virtual/JXVirtualInputDevice.java b/src/main/java/de/hardcode/jxinput/virtual/JXVirtualInputDevice.java similarity index 100% rename from java/de/hardcode/jxinput/virtual/JXVirtualInputDevice.java rename to src/main/java/de/hardcode/jxinput/virtual/JXVirtualInputDevice.java diff --git a/java/de/hardcode/jxinput/virtual/VirtualAxis.java b/src/main/java/de/hardcode/jxinput/virtual/VirtualAxis.java similarity index 100% rename from java/de/hardcode/jxinput/virtual/VirtualAxis.java rename to src/main/java/de/hardcode/jxinput/virtual/VirtualAxis.java diff --git a/java/de/hardcode/jxinput/virtual/VirtualDriver.java b/src/main/java/de/hardcode/jxinput/virtual/VirtualDriver.java similarity index 100% rename from java/de/hardcode/jxinput/virtual/VirtualDriver.java rename to src/main/java/de/hardcode/jxinput/virtual/VirtualDriver.java diff --git a/java/de/hardcode/jxinput/virtual/package.html b/src/main/java/de/hardcode/jxinput/virtual/package.html similarity index 100% rename from java/de/hardcode/jxinput/virtual/package.html rename to src/main/java/de/hardcode/jxinput/virtual/package.html diff --git a/win32/.cvsignore b/win32/.cvsignore deleted file mode 100644 index 252078e..0000000 --- a/win32/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.ncb -Release -*.plg -Debug -*~ -jxinput.vcproj.HERKBOOK.Herkules.user -jxinput.suo -*.opt diff --git a/win32/JXInputManager.cpp b/win32/JXInputManager.cpp deleted file mode 100644 index 3718a7f..0000000 --- a/win32/JXInputManager.cpp +++ /dev/null @@ -1,175 +0,0 @@ - -#include "stdafx.h" -#include "JXInputManager.h" -#include "JXInput.h" - -// -// Globals -// -extern HINSTANCE g_hInst; - - -JXInputManager::JXInputManager( HWND hWnd ) : -mhWnd( hWnd ), -mDeviceCounter( 0 ) -{ - - for ( int i = 0; i < MAX_JXINPUTS; ++i ) - { - mDevices[ i ] = NULL; - } - - - if ( FAILED( InitDirectInput( hWnd ) ) ) - { - FreeDirectInput(); - } - -} - -JXInputManager::~JXInputManager() -{ - for ( int i = 0; i < getNumberOfJXInputs(); ++i ) - { - delete mDevices[ i ]; - mDevices[ i ] = NULL; - } - - FreeDirectInput(); -} - -int JXInputManager::getNumberOfJXInputs() const -{ - return mDeviceCounter; -} - -JXInput& JXInputManager::getJXInput( int idx ) const -{ - assert( idx < mDeviceCounter ); - return * mDevices[ idx ]; -} - - -int JXInputManager::getMaxNumberOfAxes() const -{ - return JXINPUT_MAX_AXES; -} - -int JXInputManager::getMaxNumberOfButtons() const -{ - return JXINPUT_MAX_BUTTONS; -} - -int JXInputManager::getMaxNumberOfDirectionals() const -{ - return JXINPUT_MAX_DIRECTIONALS; -} - - - -//----------------------------------------------------------------------------- -// Name: InitDirectInput() -// Desc: Initialize the DirectInput variables. -//----------------------------------------------------------------------------- -HRESULT JXInputManager::InitDirectInput( HWND hWnd ) -{ - HRESULT hr; - - // Register with the DirectInput subsystem and get a pointer - // to a IDirectInput interface we can use. - // Create a DInput object - if( FAILED( hr = DirectInput8Create( g_hInst, DIRECTINPUT_VERSION, - IID_IDirectInput8, (VOID**)&mpDI, NULL ) ) ) - return hr; - - // Look for a simple joystick we can use for this sample program. - if( FAILED( hr = mpDI->EnumDevices( DI8DEVCLASS_GAMECTRL, - EnumJoysticksCallback, - (VOID*)this, DIEDFL_ALLDEVICES /*| DIEDFL_INCLUDEPHANTOMS*/ ) ) ) - return hr; - - // Look for a other devices - if( FAILED( hr = mpDI->EnumDevices( DI8DEVCLASS_DEVICE, - EnumJoysticksCallback, - (VOID*)this, DIEDFL_ALLDEVICES /*| DIEDFL_INCLUDEPHANTOMS*/ ) ) ) - return hr; - - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: FreeDirectInput() -// Desc: Initialize the DirectInput variables. -//----------------------------------------------------------------------------- -HRESULT JXInputManager::FreeDirectInput() -{ - - if ( NULL != mpDI ) - mpDI->Release(); - mpDI = NULL; - return S_OK; -} - - -//----------------------------------------------------------------------------- -// Name: EnumJoysticksCallback() -// Desc: Called once for each enumerated joystick. If we find one, create a -// device interface on it so we can play with it. -//----------------------------------------------------------------------------- -BOOL CALLBACK JXInputManager::EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, - VOID* pContext ) -{ - HRESULT hr; - LPDIRECTINPUTDEVICE8 pJoystick; - - JXInputManager* pThis = (JXInputManager*)pContext; - - // - // if the maximum number of devices is already registered, - // issue a warning and stop enumeration. - // - if( MAX_JXINPUTS == pThis->mDeviceCounter ) - { - OutputDebugString( "Max. number of devices exceeded!" ); - return DIENUM_STOP; - } - - - - // Obtain an interface to the enumerated joystick. - hr = pThis->mpDI->CreateDevice( pdidInstance->guidInstance, &pJoystick, NULL ); - - // If it failed, then we can't use this joystick. (Maybe the user unplugged - // it while we were in the middle of enumerating it.) - if( FAILED(hr) ) - return DIENUM_CONTINUE; - - JXInput* pJ = new JXInput( pJoystick, pThis->mhWnd ); - - // - // only register useful devices - // - if( pJ->getNumberOfAxes() + pJ->getNumberOfButtons() + pJ->getNumberOfDirectionals() > 0 ) - { - pThis->addJXInput( pJ ); - } - else - { - delete pJ; - } - - return DIENUM_CONTINUE; -} - - -/** - * Register a JXInput device. - */ -void JXInputManager::addJXInput( JXInput* pJ ) -{ - assert( mDeviceCounter < MAX_JXINPUTS ); - - if( mDeviceCounter < MAX_JXINPUTS ) - mDevices[ mDeviceCounter++ ] = pJ; -} diff --git a/win32/JXInputManager.h b/win32/JXInputManager.h deleted file mode 100644 index 41b9da4..0000000 --- a/win32/JXInputManager.h +++ /dev/null @@ -1,47 +0,0 @@ -// JXInputManager.h: Schnittstelle für die Klasse JXInputManager. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_JXINPUTMANAGER_H__24862402_14C9_407D_8532_A16A6E3A7D64__INCLUDED_) -#define AFX_JXINPUTMANAGER_H__24862402_14C9_407D_8532_A16A6E3A7D64__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - -#define MAX_JXINPUTS 10 - -class JXInput; - -class JXINPUT_API JXInputManager -{ -public: - JXInputManager( HWND hWnd ); - virtual ~JXInputManager(); - - int getNumberOfJXInputs() const; - JXInput& getJXInput( int idx ) const; - - // - // Numbering methods - // - int getMaxNumberOfAxes() const; - int getMaxNumberOfButtons() const; - int getMaxNumberOfDirectionals() const; - -private: - LPDIRECTINPUT8 mpDI; - HWND mhWnd; - JXInput* mDevices[ MAX_JXINPUTS ]; - int mDeviceCounter; - - HRESULT InitDirectInput( HWND hWnd = NULL ); - HRESULT FreeDirectInput(); - - static BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, - VOID* pContext ); - void addJXInput( JXInput* pJ ); -}; - -#endif // !defined(AFX_JXINPUTMANAGER_H__24862402_14C9_407D_8532_A16A6E3A7D64__INCLUDED_) diff --git a/win32/ReadMe.txt b/win32/ReadMe.txt deleted file mode 100644 index 755cd4c..0000000 --- a/win32/ReadMe.txt +++ /dev/null @@ -1,37 +0,0 @@ -======================================================================== - DYNAMIC LINK LIBRARY : jxinput -======================================================================== - - -Diese jxinput-DLL hat der Anwendungs-Assistent für Sie erstellt. - -Diese Datei enthält eine Zusammenfassung dessen, was Sie in jeder der Dateien -finden, die Ihre jxinput-Anwendung bilden. - -jxinput.dsp - Diese Datei (Projektdatei) enthält Informationen auf Projektebene und wird zur - Erstellung eines einzelnen Projekts oder Teilprojekts verwendet. Andere Benutzer können - die Projektdatei (.dsp) gemeinsam nutzen, sollten aber die Makefiles lokal exportieren. - -jxinput.cpp - Dies ist die Hauptquellcodedatei für die DLL. - -jxinput.h - Diese Datei enthält Ihre DLL-Exporte. - -///////////////////////////////////////////////////////////////////////////// -Weitere Standarddateien: - -StdAfx.h, StdAfx.cpp - Diese Dateien werden zum Erstellen einer vorkompilierten Header-Datei (PCH) namens - jxinput.pch und einer vorkompilierten Typdatei namens StdAfx.obj verwendet. - - -///////////////////////////////////////////////////////////////////////////// -Weitere Hinweise: - -Der Anwendungs-Assistent verwendet "ZU ERLEDIGEN:", um Bereiche des Quellcodes zu -kennzeichnen, die Sie hinzufügen oder anpassen sollten. - - -///////////////////////////////////////////////////////////////////////////// diff --git a/win32/StdAfx.cpp b/win32/StdAfx.cpp deleted file mode 100644 index a144a09..0000000 --- a/win32/StdAfx.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// stdafx.cpp : Quelltextdatei, die nur die Standard-Includes einbindet -// jxinput.pch ist die vorkompilierte Header-Datei -// stdafx.obj enthält die vorkompilierte Typinformation - -#include "stdafx.h" - -// ZU ERLEDIGEN: Verweis auf alle zusätzlichen Header-Dateien, die Sie in STDAFX.H -// und nicht in dieser Datei benötigen - diff --git a/win32/StdAfx.h b/win32/StdAfx.h deleted file mode 100644 index e139c4c..0000000 --- a/win32/StdAfx.h +++ /dev/null @@ -1,32 +0,0 @@ -// stdafx.h : Include-Datei für Standard-System-Include-Dateien, -// oder projektspezifische Include-Dateien, die häufig benutzt, aber -// in unregelmäßigen Abständen geändert werden. -// - -#if !defined(AFX_STDAFX_H__68E14C76_098F_47ED_932B_4C01E8E9EFFB__INCLUDED_) -#define AFX_STDAFX_H__68E14C76_098F_47ED_932B_4C01E8E9EFFB__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - -// Fügen Sie hier Ihre Header-Dateien ein -#define WIN32_LEAN_AND_MEAN // Selten benutzte Teile der Windows-Header nicht einbinden -#define STRICT -#include - -// ZU ERLEDIGEN: Verweisen Sie hier auf zusätzliche Header-Dateien, die Ihr Programm benötigt -#ifdef JXINPUT_EXPORTS -#define JXINPUT_API __declspec(dllexport) -#else -#define JXINPUT_API __declspec(dllimport) -#endif - -#include -#include - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ fügt zusätzliche Deklarationen unmittelbar vor der vorherigen Zeile ein. - -#endif // !defined(AFX_STDAFX_H__68E14C76_098F_47ED_932B_4C01E8E9EFFB__INCLUDED_) diff --git a/win32/de_hardcode_jxinput_directinput_DirectInputDriver.cpp b/win32/de_hardcode_jxinput_directinput_DirectInputDriver.cpp deleted file mode 100644 index 077afe8..0000000 --- a/win32/de_hardcode_jxinput_directinput_DirectInputDriver.cpp +++ /dev/null @@ -1,279 +0,0 @@ -#include "stdafx.h" - -#include "de_hardcode_jxinput_directinput_DirectInputDriver.h" -#include "jxinput.h" -#include "JXInputManager.h" - - -// -// Globals -// -extern HINSTANCE g_hInst; - -static JXInputManager* pJXInputManager = NULL; -static JXInput* apJXInput[ MAX_JXINPUTS ]; -static HWND hWndJava; - -// -// IDs of the static Java arrays. -// -static jfieldID sAxesFieldID; -static jfieldID sButtonsFieldID; -static jfieldID sDirectionsFieldID; - - - -/** - * Remove all resources allocated by the Java binding. - */ -void shutdownJavaResources() -{ - if ( NULL != pJXInputManager ) - delete pJXInputManager; - - if ( NULL != hWndJava ) - DestroyWindow( hWndJava ); - - pJXInputManager = NULL; - - for( int i = 0; i < MAX_JXINPUTS; ++i ) - apJXInput[ i ] = NULL; - - hWndJava = NULL; -} - - - -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) -{ - return JNI_VERSION_1_2; -} - - -JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) -{ - shutdownJavaResources(); -} - - -JNIEXPORT jboolean JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_nativeinit - (JNIEnv * penv, jclass pClazz ) -{ - - // - // Create a non-visible window as 'owner' of the DI device. - // - hWndJava = CreateWindowEx( - 0/*WS_EX_APPWINDOW*/, // DWORD dwExStyle, // extended window style - "STATIC", // LPCTSTR lpClassName, // pointer to registered class name - NULL, // LPCTSTR lpWindowName, // pointer to window name - 0/*WS_CAPTION*/, // DWORD dwStyle, // window style - 0, // int x, // horizontal position of window - 0, // int y, // vertical position of window - 0, // int nWidth, // window width - 0, // int nHeight, // window height - NULL, // HWND hWndParent, // handle to parent or owner window - NULL, // HMENU hMenu, // handle to menu, or child-window identifier - g_hInst, // HINSTANCE hInstance, // handle to application instance - NULL // LPVOID lpParam // pointer to window-creation data - ); - - - if ( NULL == pJXInputManager ) - { - pJXInputManager = new JXInputManager( hWndJava ); - - for( int i = 0; i < MAX_JXINPUTS; ++i ) - apJXInput[ i ] = NULL; - - for ( int i = 0; i < pJXInputManager->getNumberOfJXInputs(); ++i ) - { - apJXInput[ i ] = & pJXInputManager->getJXInput( i ); - } - } - - return true; -} - - - -JNIEXPORT void JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_nativeexit - (JNIEnv *, jclass ) -{ - shutdownJavaResources(); -} - - -/** - * Bind my field IDs to the Java variables. - */ -JNIEXPORT void JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_bind - (JNIEnv * penv, jclass pClazz) -{ - // - // All fields are static. - // - sAxesFieldID = penv->GetStaticFieldID( pClazz, "sAxisValues", "[[D" ); - sButtonsFieldID = penv->GetStaticFieldID( pClazz, "sButtonStates", "[[Z" ); - sDirectionsFieldID = penv->GetStaticFieldID( pClazz, "sDirectionalValues", "[[I" ); -} - - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getNumberOfDevices - (JNIEnv *penv, jclass) -{ - return pJXInputManager->getNumberOfJXInputs(); -} - - -JNIEXPORT jstring JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getName - (JNIEnv *penv, jclass, jint dev) -{ - return penv->NewStringUTF( apJXInput[ dev ]->getName() ); -} - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getNumberOfAxes - (JNIEnv *, jclass, jint dev) -{ - return apJXInput[ dev ]->getNumberOfAxes(); -} - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getNumberOfButtons - (JNIEnv *, jclass, jint dev) -{ - return apJXInput[ dev ]->getNumberOfButtons(); -} - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getNumberOfDirectionals - (JNIEnv *, jclass, jint dev) -{ - return apJXInput[ dev ]->getNumberOfDirectionals(); -} - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getMaxNumberOfAxes - (JNIEnv *, jclass) -{ - return pJXInputManager->getMaxNumberOfAxes(); -} - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getMaxNumberOfButtons - (JNIEnv *, jclass) -{ - return pJXInputManager->getMaxNumberOfButtons(); -} - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getMaxNumberOfDirectionals - (JNIEnv *, jclass) -{ - return pJXInputManager->getMaxNumberOfDirectionals(); -} - -JNIEXPORT jboolean JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_isAxisAvailable - (JNIEnv *, jclass, jint dev, jint idx ) -{ - return apJXInput[ dev ]->isAxisAvailable( idx ); -} - -JNIEXPORT jstring JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getAxisName - (JNIEnv *penv, jclass, jint dev, jint idx ) -{ - return penv->NewStringUTF( apJXInput[ dev ]->getAxisName( idx ) ); -} - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getAxisType - (JNIEnv *, jclass, jint dev, jint idx ) -{ - return apJXInput[ dev ]->getAxisType( idx ); -} - - -JNIEXPORT jboolean JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_isButtonAvailable - (JNIEnv *, jclass, jint dev, jint idx ) -{ - return apJXInput[ dev ]->isButtonAvailable( idx ); -} - -JNIEXPORT jstring JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getButtonName - (JNIEnv *penv, jclass, jint dev, jint idx ) -{ - return penv->NewStringUTF( apJXInput[ dev ]->getButtonName( idx ) ); -} - -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getButtonType - (JNIEnv *, jclass, jint dev, jint idx ) -{ - return apJXInput[ dev ]->getButtonType( idx ); -} - -JNIEXPORT jboolean JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_isDirectionalAvailable - (JNIEnv *, jclass, jint dev, jint idx ) -{ - return apJXInput[ dev ]->isDirectionalAvailable( idx ); -} - -JNIEXPORT jstring JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getDirectionalName - (JNIEnv *penv, jclass, jint dev, jint idx ) -{ - return penv->NewStringUTF( apJXInput[ dev ]->getDirectionalName( idx ) ); -} - - - -/** - * The main update method. - * Here, the actual work is done. - */ -JNIEXPORT void JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_nativeupdate - (JNIEnv * penv, jclass pClazz ) -{ - - static jdouble axes [ MAX_JXINPUTS ][ JXINPUT_MAX_AXES ]; - static jboolean buttons [ MAX_JXINPUTS ][ JXINPUT_MAX_BUTTONS ]; - static jint directions [ MAX_JXINPUTS ][ JXINPUT_MAX_DIRECTIONALS ]; - - static jobjectArray axisarrayarray; - static jobjectArray buttonarrayarray; - static jobjectArray directionarrayarray; - - static jdoubleArray axisarray; - static jbooleanArray buttonarray; - static jintArray directionarray; - - axisarrayarray = (jobjectArray)penv->GetStaticObjectField( pClazz, sAxesFieldID ); - buttonarrayarray = (jobjectArray)penv->GetStaticObjectField( pClazz, sButtonsFieldID ); - directionarrayarray = (jobjectArray)penv->GetStaticObjectField( pClazz, sDirectionsFieldID ); - - // - // For each device.... - // - for ( int dev = 0; dev < pJXInputManager->getNumberOfJXInputs(); ++dev ) - { - // Do the update of the device. - apJXInput[ dev ]->update(); - - // - // Copy all values into my arrays. - // - for ( int i = 0; i < JXINPUT_MAX_AXES; ++i ) - axes[ dev ][ i ] = apJXInput[ dev ]->getAxisValue( i ); - for ( int i = 0; i < JXINPUT_MAX_BUTTONS; ++i ) - buttons[ dev ][ i ] = apJXInput[ dev ]->isButtonDown( i ); - for ( int i = 0; i < JXINPUT_MAX_DIRECTIONALS; ++i ) - directions[ dev ][ i ] = apJXInput[ dev ]->getDirection( i ); - - - // - // Move my arrays to the Java arrays. - // - axisarray = (jdoubleArray)penv->GetObjectArrayElement( axisarrayarray, dev ); - penv->SetDoubleArrayRegion( axisarray, 0, JXINPUT_MAX_AXES, axes[ dev ] ); - - buttonarray = (jbooleanArray)penv->GetObjectArrayElement( buttonarrayarray, dev ); - penv->SetBooleanArrayRegion( buttonarray, 0, JXINPUT_MAX_BUTTONS, buttons[ dev ] ); - - directionarray = (jintArray)penv->GetObjectArrayElement( directionarrayarray, dev ); - penv->SetIntArrayRegion( directionarray, 0, JXINPUT_MAX_DIRECTIONALS, directions[ dev ] ); - } - -} - diff --git a/win32/de_hardcode_jxinput_directinput_DirectInputDriver.h b/win32/de_hardcode_jxinput_directinput_DirectInputDriver.h deleted file mode 100644 index bb93548..0000000 --- a/win32/de_hardcode_jxinput_directinput_DirectInputDriver.h +++ /dev/null @@ -1,183 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include - -/* Header for class de_hardcode_jxinput_directinput_DirectInputDriver */ - -#ifndef _Included_de_hardcode_jxinput_directinput_DirectInputDriver -#define _Included_de_hardcode_jxinput_directinput_DirectInputDriver - -#ifdef __cplusplus -extern "C" { -#endif - -/* Inaccessible static: sIsOperational */ -/* Inaccessible static: sAxisValues */ -/* Inaccessible static: sButtonStates */ -/* Inaccessible static: sDirectionalValues */ -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: nativeinit - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_nativeinit - (JNIEnv *, jclass); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: nativeexit - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_nativeexit - (JNIEnv *, jclass); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: bind - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_bind - (JNIEnv *, jclass); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getNumberOfDevices - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getNumberOfDevices - (JNIEnv *, jclass); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getName - * Signature: (I)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getName - (JNIEnv *, jclass, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getNumberOfAxes - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getNumberOfAxes - - (JNIEnv *, jclass, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getNumberOfButtons - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getNumberOfButtons - (JNIEnv *, jclass, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getNumberOfDirectionals - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getNumberOfDirectionals - (JNIEnv *, jclass, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getMaxNumberOfAxes - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getMaxNumberOfAxes - (JNIEnv *, jclass); - - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getMaxNumberOfButtons - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getMaxNumberOfButtons - (JNIEnv *, jclass); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getMaxNumberOfDirectionals - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getMaxNumberOfDirectionals - (JNIEnv *, jclass); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: isAxisAvailable - * Signature: (II)Z - */ -JNIEXPORT jboolean JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_isAxisAvailable - (JNIEnv *, jclass, jint, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getAxisName - * Signature: (II)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getAxisName - (JNIEnv *, jclass, jint, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getAxisType - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getAxisType - (JNIEnv *, jclass, jint, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: isButtonAvailable - * Signature: (II)Z - */ -JNIEXPORT jboolean JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_isButtonAvailable - (JNIEnv *, jclass, jint, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getButtonName - * Signature: (II)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getButtonName - (JNIEnv *, jclass, jint, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getButtonType - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getButtonType - (JNIEnv *, jclass, jint, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: isDirectionalAvailable - * Signature: (II)Z - */ -JNIEXPORT jboolean JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_isDirectionalAvailable - (JNIEnv *, jclass, jint, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: getDirectionalName - * Signature: (II)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_getDirectionalName - (JNIEnv *, jclass, jint, jint); - -/* - * Class: de_hardcode_jxinput_directinput_DirectInputDriver - * Method: nativeupdate - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_de_hardcode_jxinput_directinput_DirectInputDriver_nativeupdate - (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/win32/dllmain.cpp b/win32/dllmain.cpp deleted file mode 100644 index 567e8d4..0000000 --- a/win32/dllmain.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "stdafx.h" - -HINSTANCE g_hInst; - - -BOOL APIENTRY DllMain( HANDLE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - g_hInst = (HINSTANCE)hModule; - break; - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - break; - case DLL_PROCESS_DETACH: - g_hInst = NULL; - break; - } - return TRUE; -} diff --git a/win32/jxinput.cpp b/win32/jxinput.cpp deleted file mode 100644 index 890805b..0000000 --- a/win32/jxinput.cpp +++ /dev/null @@ -1,600 +0,0 @@ -// -// jxinput.cpp -// -#include "stdafx.h" -#include "jxinput.h" - - -// -// Globals -// -extern HINSTANCE g_hInst; - - -/** - * Ctor: Connect with DI - */ -JXInput::JXInput( LPDIRECTINPUTDEVICE8 pJoystick, HWND hWnd ) : - mpJoystick( pJoystick ), - mSliderCount( 0 ), - mPOVCount( 0 ), - mButtonCount( 0 ) -{ - initAxisConfig(); - initButtonsConfig(); - initDirectionalsConfig(); - - if ( FAILED( InitDirectInput( hWnd ) ) ) - { - FreeDirectInput(); - } -} - - - -/** - * Destructor: - * Free DirectInput. - */ -JXInput::~JXInput() -{ - FreeDirectInput(); -} - - -void JXInput::update() -{ - UpdateInputState(); -} - - -TCHAR * const JXInput::getName() const -{ - return (TCHAR*)mdiDevInfo.tszInstanceName; -} - - - -int JXInput::getNumberOfAxes() const -{ - return mdiDevCaps.dwAxes; -} - -int JXInput::getNumberOfButtons() const -{ - return mButtonCount; -} - -int JXInput::getNumberOfDirectionals() const -{ - return mPOVCount; -} - - -double JXInput::getAxisValueHelper( LONG val, int idx ) const -{ - const AxisConfig& cfg = mAxisConfig[ idx ]; - - double span = (double)( cfg.mMaxValue - cfg.mMinValue ); - double ret = (double)(val - cfg.mMinValue) / span; - - if ( TYPE_SLIDER != cfg.mType ) - return ret*2.0 - 1.0; - return ret; -} - -double JXInput::getX() const -{ - return getAxisValueHelper( mJS.lX, ID_X ); -} -double JXInput::getY() const -{ - return getAxisValueHelper( mJS.lY, ID_Y ); -} -double JXInput::getZ() const -{ - return getAxisValueHelper( mJS.lZ, ID_Z ); -} -double JXInput::getRotX() const -{ - return getAxisValueHelper( mJS.lRx, ID_ROTX ); -} -double JXInput::getRotY() const -{ - return getAxisValueHelper( mJS.lRy, ID_ROTY ); -} -double JXInput::getRotZ() const -{ - return getAxisValueHelper( mJS.lRz, ID_ROTZ ); -} -double JXInput::getSlider0() const -{ - return getAxisValueHelper( mJS.rglSlider[ 0 ], ID_SLIDER0 ); -} -double JXInput::getSlider1() const -{ - return getAxisValueHelper( mJS.rglSlider[ 1 ], ID_SLIDER1 ); -} - - - -bool JXInput::isAxisAvailable( int idx ) const -{ - assert( idx < JXINPUT_MAX_AXES ); - return mAxisConfig[ idx ].mIsAvailable; -} - -TCHAR * const JXInput::getAxisName( int idx ) const -{ - assert( idx < JXINPUT_MAX_AXES ); - return (char*const)mAxisConfig[ idx ].mName; -} - -int JXInput::getAxisType( int idx ) const -{ - assert( idx < JXINPUT_MAX_AXES ); - return mAxisConfig[ idx ].mType; -} - -double JXInput::getAxisValue( int idx ) const -{ - assert( idx < JXINPUT_MAX_AXES ); - - // Failsafe if called accidentally - if ( ! mAxisConfig[ idx ].mIsAvailable ) - return 0.0; - - return (this->*mAxisConfig[ idx ].mGetValueMethod)(); -} - - - - - -bool JXInput::isButtonAvailable( int idx ) const -{ - assert( idx < JXINPUT_MAX_BUTTONS ); - return mButtonConfig[ idx ].mIsAvailable; -} - -TCHAR * const JXInput::getButtonName( int idx ) const -{ - assert( idx < JXINPUT_MAX_BUTTONS ); - return (char*const)mButtonConfig[ idx ].mName; -} - -int JXInput::getButtonType( int idx ) const -{ - assert( idx < JXINPUT_MAX_BUTTONS ); - return mButtonConfig[ idx ].mType; -} - -bool JXInput::isButtonDown( int idx ) const -{ - assert( idx < JXINPUT_MAX_BUTTONS ); - return 0 != mJS.rgbButtons[ idx ] ; -} - - -bool JXInput::isDirectionalAvailable( int idx ) const -{ - assert( idx < JXINPUT_MAX_DIRECTIONALS ); - return mDirectionalConfig[ idx ].mIsAvailable; -} - -TCHAR * const JXInput::getDirectionalName( int idx ) const -{ - assert( idx < JXINPUT_MAX_DIRECTIONALS ); - return (char*const)mDirectionalConfig[ idx ].mName; -} - -int JXInput::getDirection( int idx ) const -{ - assert( idx < JXINPUT_MAX_DIRECTIONALS ); - return mJS.rgdwPOV[ idx ] ; -} - - -/** - * Initialize axis configuration array. - */ -void JXInput::initAxisConfig() -{ - mAxisConfig[ ID_X ].mIsAvailable = false; - mAxisConfig[ ID_X ].mType = TYPE_TRANSLATION; - mAxisConfig[ ID_X ].mGetValueMethod = &JXInput::getX; - - mAxisConfig[ ID_Y ].mIsAvailable = false; - mAxisConfig[ ID_Y ].mType = TYPE_TRANSLATION; - mAxisConfig[ ID_Y ].mGetValueMethod = &JXInput::getY; - - mAxisConfig[ ID_Z ].mIsAvailable = false; - mAxisConfig[ ID_Z ].mType = TYPE_TRANSLATION; - mAxisConfig[ ID_Z ].mGetValueMethod = &JXInput::getZ; - - mAxisConfig[ ID_ROTX ].mIsAvailable = false; - mAxisConfig[ ID_ROTX ].mType = TYPE_ROTATION; - mAxisConfig[ ID_ROTX ].mGetValueMethod = &JXInput::getRotX; - - mAxisConfig[ ID_ROTY ].mIsAvailable = false; - mAxisConfig[ ID_ROTY ].mType = TYPE_ROTATION; - mAxisConfig[ ID_ROTY ].mGetValueMethod = &JXInput::getRotY; - - mAxisConfig[ ID_ROTZ ].mIsAvailable = false; - mAxisConfig[ ID_ROTZ ].mType = TYPE_ROTATION; - mAxisConfig[ ID_ROTZ ].mGetValueMethod = &JXInput::getRotZ; - - mAxisConfig[ ID_SLIDER0 ].mIsAvailable = false; - mAxisConfig[ ID_SLIDER0 ].mType = TYPE_SLIDER; - mAxisConfig[ ID_SLIDER0 ].mGetValueMethod = &JXInput::getSlider0; - - mAxisConfig[ ID_SLIDER1 ].mIsAvailable = false; - mAxisConfig[ ID_SLIDER1 ].mType = TYPE_SLIDER; - mAxisConfig[ ID_SLIDER1 ].mGetValueMethod = &JXInput::getSlider1; -} - - -/** - * Initialize buttons configuration array. - */ -void JXInput::initButtonsConfig() -{ - for ( int i = 0; i < JXINPUT_MAX_BUTTONS; ++i ) - { - mButtonConfig[ i ].mIsAvailable = false; - mButtonConfig[ i ].mName[ 0 ] = '\0'; - mButtonConfig[ i ].mType = TYPE_PUSHBUTTON; - } - -} - - -/** - * Initialize directionals configuration array. - */ -void JXInput::initDirectionalsConfig() -{ - for ( int i = 0; i < JXINPUT_MAX_DIRECTIONALS; ++i ) - { - mDirectionalConfig[ i ].mIsAvailable = false; - mDirectionalConfig[ i ].mName[ 0 ] = '\0'; - } - -} - - - -//----------------------------------------------------------------------------- -// Name: EnumAxesCallback() -// Desc: Callback function for enumerating the axes on a joystick -//----------------------------------------------------------------------------- -BOOL CALLBACK JXInput::EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, - VOID* pContext ) -{ - JXInput* pThis = (JXInput*)pContext; - - AxisConfig* pAxCfg = NULL; - - // Set the UI to reflect what objects the joystick supports - // Code derived from M$ samples, really sucks, eh? - if (pdidoi->guidType == GUID_XAxis) - { - pAxCfg = & pThis->mAxisConfig[ ID_X ]; - } - if (pdidoi->guidType == GUID_YAxis) - { - pAxCfg = & pThis->mAxisConfig[ ID_Y ]; - } - if (pdidoi->guidType == GUID_ZAxis) - { - pAxCfg = & pThis->mAxisConfig[ ID_Z ]; - } - if (pdidoi->guidType == GUID_RxAxis) - { - pAxCfg = & pThis->mAxisConfig[ ID_ROTX ]; - } - if (pdidoi->guidType == GUID_RyAxis) - { - pAxCfg = & pThis->mAxisConfig[ ID_ROTY ]; - } - if (pdidoi->guidType == GUID_RzAxis) - { - pAxCfg = & pThis->mAxisConfig[ ID_ROTZ ]; - } - if (pdidoi->guidType == GUID_Slider) - { - switch( pThis->mSliderCount++ ) - { - case 0 : - pAxCfg = & pThis->mAxisConfig[ ID_SLIDER0 ]; - break; - - case 1 : - pAxCfg = & pThis->mAxisConfig[ ID_SLIDER1 ]; - break; - } - } - - // fail-safe - if( NULL == pAxCfg ) // e.g. GUID_Unknown - return DIENUM_CONTINUE; - - - // - // Perform config. - // - - DIPROPRANGE diprg; - diprg.diph.dwSize = sizeof(DIPROPRANGE); - diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER); - diprg.diph.dwHow = DIPH_BYID; - diprg.diph.dwObj = pdidoi->dwType; // Specify the enumerated axis - - // Get the range for the axis - if( FAILED( pThis->mpJoystick->GetProperty( DIPROP_RANGE, &diprg.diph ) ) ) - return DIENUM_CONTINUE; - - pAxCfg->mMinValue = diprg.lMin; - pAxCfg->mMaxValue = diprg.lMax; - - strcpy( (char*)pAxCfg->mName, (char*)pdidoi->tszName ); - pAxCfg->mIsAvailable = true; - - return DIENUM_CONTINUE; -} - - - -//----------------------------------------------------------------------------- -// Name: EnumButtonsCallback() -// Desc: Callback function for enumerating the axes on a joystick -//----------------------------------------------------------------------------- -BOOL CALLBACK JXInput::EnumButtonsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, - VOID* pContext ) -{ - JXInput* pThis = (JXInput*)pContext; - - // - // if the maximum number of buttons is already registered, - // issue a warning and stop enumeration. - // - if( JXINPUT_MAX_BUTTONS == pThis->mButtonCount ) - { - OutputDebugString( "Max. number of buttons exceeded!" ); - return DIENUM_STOP; - } - - - ButtonConfig* pBtCfg = NULL; - - if ( pdidoi->guidType == GUID_Button ) - { - assert( JXINPUT_MAX_BUTTONS > pThis->mButtonCount ); - pBtCfg = & pThis->mButtonConfig[ pThis->mButtonCount++ ]; - } - - - // fail-safe - if( NULL == pBtCfg ) // e.g. unknown stuff - return DIENUM_CONTINUE; - assert( NULL != pBtCfg ); - - // - // Perform config. - // - - strcpy( (char*)pBtCfg->mName, (char*)pdidoi->tszName ); - pBtCfg->mIsAvailable = true; - - return DIENUM_CONTINUE; -} - - -//----------------------------------------------------------------------------- -// Name: EnumPOVsCallback() -// Desc: Callback function for enumerating the axes on a joystick -//----------------------------------------------------------------------------- -BOOL CALLBACK JXInput::EnumPOVsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, - VOID* pContext ) -{ - JXInput* pThis = (JXInput*)pContext; - - // - // if the maximum number of buttons is already registered, - // issue a warning and stop enumeration. - // - if( JXINPUT_MAX_DIRECTIONALS == pThis->mPOVCount ) - { - OutputDebugString( "Max. number of POVs exceeded!" ); - return DIENUM_STOP; - } - - DirectionalConfig* pDirCfg = NULL; - - - if (pdidoi->guidType == GUID_POV) - { - assert( JXINPUT_MAX_DIRECTIONALS > pThis->mPOVCount ); - pDirCfg = & pThis->mDirectionalConfig[ pThis->mPOVCount++ ]; - } - - // fail-safe - if( NULL == pDirCfg ) // e.g. unknown stuff - return DIENUM_CONTINUE; - assert( NULL != pDirCfg ); - - // - // Perform config. - // - - strcpy( (char*)pDirCfg->mName, (char*)pdidoi->tszName ); - pDirCfg->mIsAvailable = true; - - return DIENUM_CONTINUE; -} - - - -//----------------------------------------------------------------------------- -// Name: EnumEffectsCallback() -// Desc: Callback function for enumerating the effects of a joystick -//----------------------------------------------------------------------------- -BOOL CALLBACK JXInput::EnumEffectsCallback( const DIEFFECTINFO* pdidoi, - VOID* pContext ) -{ - JXInput* pThis = (JXInput*)pContext; - - // - // Work on that!! - // - - return DIENUM_CONTINUE; -} - - - -//----------------------------------------------------------------------------- -// Name: InitDirectInput() -// Desc: Initialize the DirectInput variables. -//----------------------------------------------------------------------------- -HRESULT JXInput::InitDirectInput( HWND hWnd ) -{ - HRESULT hr; - - // Make sure we got a joystick - if( NULL == mpJoystick ) - { - return E_FAIL; - } - - - // - // Ask the device for some useful information. - // - mdiDevInfo.dwSize = sizeof( DIDEVICEINSTANCE ); - hr = mpJoystick->GetDeviceInfo( &mdiDevInfo ); - if( FAILED(hr) ) - return hr; - - // Set the data format to "simple joystick" - a predefined data format - // - // A data format specifies which controls on a device we are interested in, - // and how they should be reported. This tells DInput that we will be - // passing a DIJOYSTATE structure to IDirectInputDevice::GetDeviceState(). - hr = mpJoystick->SetDataFormat( &c_dfDIJoystick2 ); - if( FAILED(hr) ) - return hr; - - // Set the cooperative level to let DInput know how this device should - // interact with the system and with other DInput applications. -// hr = g_pJoystick->SetCooperativeLevel( hDlg, DISCL_EXCLUSIVE|DISCL_FOREGROUND ); - DWORD mode = ( NULL == hWnd ? DISCL_NONEXCLUSIVE|DISCL_BACKGROUND : DISCL_EXCLUSIVE|DISCL_BACKGROUND ); - hr = mpJoystick->SetCooperativeLevel( hWnd, mode ); - if( FAILED(hr) ) - return hr; - - // Determine how many axis the joystick has (so we don't error out setting - // properties for unavailable axis) - mdiDevCaps.dwSize = sizeof(DIDEVCAPS); - hr = mpJoystick->GetCapabilities(&mdiDevCaps); - if ( FAILED(hr) ) - return hr; - - - // Enumerate the axes of the joyctick and set the range of each axis. Note: - // we could just use the defaults, but we're just trying to show an example - // of enumerating device objects (axes, buttons, etc.). - mpJoystick->EnumObjects( EnumAxesCallback, (VOID*)this, DIDFT_AXIS ); - mpJoystick->EnumObjects( EnumButtonsCallback, (VOID*)this, DIDFT_BUTTON ); - mpJoystick->EnumObjects( EnumPOVsCallback, (VOID*)this, DIDFT_POV ); - - mpJoystick->EnumEffects( EnumEffectsCallback, (VOID*)this, DIEFT_ALL ); - - // For FF sticks, switch on autocenter as long as we do not use real FF - SwitchAutoCenter( true ); - - return S_OK; -} - - - - - -//----------------------------------------------------------------------------- -// Name: UpdateInputState() -// Desc: Get the input device's state and display it. -//----------------------------------------------------------------------------- -HRESULT JXInput::UpdateInputState() -{ - HRESULT hr; - - if( mpJoystick ) - { - - // Poll the device to read the current state - hr = mpJoystick->Poll(); - if( FAILED(hr) ) - { - // DInput is telling us that the input stream has been - // interrupted. We aren't tracking any state between polls, so - // we don't have any special reset that needs to be done. We - // just re-acquire and try again. - hr = mpJoystick->Acquire(); - while( hr == DIERR_INPUTLOST ) - hr = mpJoystick->Acquire(); - - // hr may be DIERR_OTHERAPPHASPRIO or other errors. This - // may occur when the app is minimized or in the process of - // switching, so just try again later - return S_OK; - } - - // Get the input's device state - if( FAILED( hr = mpJoystick->GetDeviceState( sizeof(DIJOYSTATE2), &mJS ) ) ) - return hr; // The device should have been acquired during the Poll() - - } - - return S_OK; -} - - - - -//----------------------------------------------------------------------------- -// Name: FreeDirectInput() -// Desc: Initialize the DirectInput variables. -//----------------------------------------------------------------------------- -HRESULT JXInput::FreeDirectInput() -{ - // Unacquire and release any DirectInputDevice objects. - if( NULL != mpJoystick ) - { - // Unacquire the device one last time just in case - // the app tried to exit while the device is still acquired. - mpJoystick->Unacquire(); - - mpJoystick->Release(); - mpJoystick = NULL; - } - - return S_OK; -} - - - -HRESULT JXInput::SwitchAutoCenter( bool onoff ) -{ - HRESULT hr; - - DIPROPDWORD DIPropAutoCenter; - - DIPropAutoCenter.diph.dwSize = sizeof(DIPropAutoCenter); - DIPropAutoCenter.diph.dwHeaderSize = sizeof(DIPROPHEADER); - DIPropAutoCenter.diph.dwObj = 0; - DIPropAutoCenter.diph.dwHow = DIPH_DEVICE; - DIPropAutoCenter.dwData = ( onoff ? DIPROPAUTOCENTER_ON : DIPROPAUTOCENTER_OFF ); - - hr = mpJoystick->SetProperty( DIPROP_AUTOCENTER, &DIPropAutoCenter.diph ); - return hr; -} diff --git a/win32/jxinput.dsp b/win32/jxinput.dsp deleted file mode 100644 index aac15c1..0000000 --- a/win32/jxinput.dsp +++ /dev/null @@ -1,175 +0,0 @@ -# Microsoft Developer Studio Project File - Name="jxinput" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** NICHT BEARBEITEN ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=jxinput - Win32 Debug -!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE -!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl -!MESSAGE -!MESSAGE NMAKE /f "jxinput.mak". -!MESSAGE -!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben -!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: -!MESSAGE -!MESSAGE NMAKE /f "jxinput.mak" CFG="jxinput - Win32 Debug" -!MESSAGE -!MESSAGE Für die Konfiguration stehen zur Auswahl: -!MESSAGE -!MESSAGE "jxinput - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") -!MESSAGE "jxinput - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "jxinput - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JXINPUT_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "C:\j2sdk1.4.2\include" /I "C:\j2sdk1.4.2\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JXINPUT_EXPORTS" /FR /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 dxguid.lib dinput8.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\build\jxinput.dll" - -!ELSEIF "$(CFG)" == "jxinput - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JXINPUT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "C:\j2sdk1.4.2\include" /I "C:\j2sdk1.4.2\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JXINPUT_EXPORTS" /FR /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "_DEBUG" -# ADD RSC /l 0x407 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 dxguid.lib dinput8.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\Classes\jxinput.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "jxinput - Win32 Release" -# Name "jxinput - Win32 Debug" -# Begin Group "Quellcodedateien" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\de_hardcode_jxinput_directinput_DirectInputDriver.cpp -# End Source File -# Begin Source File - -SOURCE=.\dllmain.cpp -# End Source File -# Begin Source File - -SOURCE=.\jxinput.cpp -# End Source File -# Begin Source File - -SOURCE=.\JXInputManager.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header-Dateien" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\de_hardcode_jxinput_directinput_DirectInputDriver.h - -!IF "$(CFG)" == "jxinput - Win32 Release" - -# PROP Ignore_Default_Tool 1 -USERDEP__DE_HA="..\classes\de\hardcode\jxinput\directinput\DirectInputDriver.class" -# Begin Custom Build -InputPath=.\de_hardcode_jxinput_directinput_DirectInputDriver.h - -"de_hardcode_jxinput_directinput_DirectInputDriver.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - cd ..\Classes - C:\j2sdk1.4.2\bin\javah -classpath . -d ..\win32 de.hardcode.jxinput.directinput.DirectInputDriver - cd ..\win32 - -# End Custom Build - -!ELSEIF "$(CFG)" == "jxinput - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -USERDEP__DE_HA="..\classes\de\hardcode\jxinput\directinput\DirectInputDriver.class" -# Begin Custom Build -InputPath=.\de_hardcode_jxinput_directinput_DirectInputDriver.h - -"de_hardcode_jxinput_directinput_DirectInputDriver.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - cd ..\Classes - C:\j2sdk1.4.2\bin\javah -classpath . -d ..\win32 de.hardcode.jxinput.directinput.DirectInputDriver - cd ..\win32 - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\jxinput.h -# End Source File -# Begin Source File - -SOURCE=.\JXInputManager.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Ressourcendateien" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/win32/jxinput.dsw b/win32/jxinput.dsw deleted file mode 100644 index deb2877..0000000 --- a/win32/jxinput.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! - -############################################################################### - -Project: "jxinput"=".\jxinput.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/win32/jxinput.h b/win32/jxinput.h deleted file mode 100644 index 6d47a31..0000000 --- a/win32/jxinput.h +++ /dev/null @@ -1,183 +0,0 @@ - -#define JXINPUT_MAX_AXES 8 -#define JXINPUT_MAX_BUTTONS 256 -#define JXINPUT_MAX_DIRECTIONALS 4 - - -/** - * This class will be exported by jxinput.dll. - */ -class JXINPUT_API JXInput -{ - -public: - - typedef enum AXISTYPE - { - TYPE_TRANSLATION, - TYPE_ROTATION, - TYPE_SLIDER - }; - - typedef enum BUTTONTYPE - { - TYPE_PUSHBUTTON, - TYPE_TOGGLEBUTTON - }; - - typedef enum AXISID - { - ID_X, ID_Y, ID_Z, - ID_ROTX, ID_ROTY, ID_ROTZ, - ID_SLIDER0, ID_SLIDER1 - }; - - - // - // Ctor - // - JXInput( LPDIRECTINPUTDEVICE8 pJoystick, HWND hWnd = NULL ); - - // - // Dtor - // - virtual ~JXInput(); - - // - // Operational methods - // - void update(); - - // Ask for the name - TCHAR * const getName() const; - - // - // Numbering methods - // - int getNumberOfAxes() const; - int getNumberOfButtons() const; - int getNumberOfDirectionals() const; - - - // - // Access axes - // - double getX() const; /** -1.0 .... 1.0 */ - double getY() const; /** -1.0 .... 1.0 */ - double getZ() const; /** -1.0 .... 1.0 */ - double getRotX() const; /** -1.0 .... 1.0 */ - double getRotY() const; /** -1.0 .... 1.0 */ - double getRotZ() const; /** -1.0 .... 1.0 */ - double getSlider0() const; /** 0.0 .... 1.0 */ - double getSlider1() const; /** 0.0 .... 1.0 */ - - - // - // Axis methods - // - bool isAxisAvailable( int idx ) const; - TCHAR* const getAxisName( int idx ) const; - int getAxisType( int idx ) const; - double getAxisValue( int idx ) const; - - // - // Button methods - // - bool isButtonAvailable( int idx ) const; - TCHAR* const getButtonName( int idx ) const; - int getButtonType( int idx ) const; - bool isButtonDown( int idx ) const; - - // - // Directional methods - // - bool isDirectionalAvailable( int idx ) const; - TCHAR* const getDirectionalName( int idx ) const; - int getDirection( int idx ) const; - -private://----------------------------------------------------------------------------------------- - LPDIRECTINPUTDEVICE8 mpJoystick; - - DIDEVICEINSTANCE mdiDevInfo; - DIDEVCAPS mdiDevCaps; - DIJOYSTATE2 mJS; // DInput joystick state - - int mSliderCount; - int mPOVCount; - int mButtonCount; - - double getAxisValueHelper( LONG val, int idx ) const; - - HRESULT SwitchAutoCenter( bool onoff = true ); - - HRESULT InitDirectInput( HWND hWnd = NULL ); - HRESULT FreeDirectInput(); - HRESULT UpdateInputState(); - - - static BOOL CALLBACK EnumAxesCallback - ( - const DIDEVICEOBJECTINSTANCE* pdidoi, - VOID* pContext - ); - - static BOOL CALLBACK EnumButtonsCallback - ( - const DIDEVICEOBJECTINSTANCE* pdidoi, - VOID* pContext - ); - - static BOOL CALLBACK EnumPOVsCallback - ( - const DIDEVICEOBJECTINSTANCE* pdidoi, - VOID* pContext - ); - - static BOOL CALLBACK EnumEffectsCallback - ( - const DIEFFECTINFO* pdidoi, - VOID* pContext - ); - - - class JXINPUT_API AxisConfig - { - - public: - bool mIsAvailable; - CHAR mName[MAX_PATH]; - AXISTYPE mType; - LONG mMinValue; - LONG mMaxValue; - double (JXInput::*mGetValueMethod)() const; - - } mAxisConfig [ JXINPUT_MAX_AXES ]; - - void initAxisConfig(); - - - class JXINPUT_API ButtonConfig - { - - public: - bool mIsAvailable; - CHAR mName[MAX_PATH]; - BUTTONTYPE mType; - - } mButtonConfig[ JXINPUT_MAX_BUTTONS ]; - - void initButtonsConfig(); - - - class JXINPUT_API DirectionalConfig - { - - public: - bool mIsAvailable; - CHAR mName[MAX_PATH]; - - } mDirectionalConfig[ JXINPUT_MAX_DIRECTIONALS ]; - - void initDirectionalsConfig(); -}; - diff --git a/win32/jxinput.sln b/win32/jxinput.sln deleted file mode 100644 index 714fdc7..0000000 --- a/win32/jxinput.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual C++ Express 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jxinput", "jxinput.vcproj", "{8AEA84DC-D8F0-4425-BEBF-A84E91115F76}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8AEA84DC-D8F0-4425-BEBF-A84E91115F76}.Debug|Win32.ActiveCfg = Debug|Win32 - {8AEA84DC-D8F0-4425-BEBF-A84E91115F76}.Debug|Win32.Build.0 = Debug|Win32 - {8AEA84DC-D8F0-4425-BEBF-A84E91115F76}.Release|Win32.ActiveCfg = Release|Win32 - {8AEA84DC-D8F0-4425-BEBF-A84E91115F76}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/win32/jxinput.vcproj b/win32/jxinput.vcproj deleted file mode 100644 index c87fc0f..0000000 --- a/win32/jxinput.vcproj +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -