diff --git a/java/lib/jxinput.jar b/java/lib/jxinput.jar new file mode 100644 index 0000000..dbb035a Binary files /dev/null and b/java/lib/jxinput.jar differ diff --git a/java/src/com/qotsa/exception/InvalidHandle.java b/java/src/com/qotsa/exception/InvalidHandle.java deleted file mode 100644 index dc965f1..0000000 --- a/java/src/com/qotsa/exception/InvalidHandle.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * InvalidHandle.java - * - * Created on 9 de Outubro de 2007, 14:18 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package com.qotsa.exception; - -/** - * Exception to throw when Winamp Handle Fails. - * - * @author Francisco - */ -public class InvalidHandle extends Exception{ - - private static final String defaultMessage = "Invalid Handle. Please Verify if Winamp is running."; - - /** - * Creates a new instance of InvalidHandle - * @param message Message to print in the stack. - */ - public InvalidHandle(String message) { - - super(message); - - } - - /** - * Creates a new instance of InvalidHandle with the default message - */ - public InvalidHandle() { - - super(defaultMessage); - - } - -} diff --git a/java/src/com/qotsa/exception/InvalidParameter.java b/java/src/com/qotsa/exception/InvalidParameter.java deleted file mode 100644 index 0a45a13..0000000 --- a/java/src/com/qotsa/exception/InvalidParameter.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * InvalidParameter.java - * - * Created on 11 de Outubro de 2007, 10:53 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package com.qotsa.exception; - -/** - * Exception to throw when any parameter is invalid. - * - * @author Francisco - */ -public class InvalidParameter extends Exception { - - private static final String defaultMessage = "Invalid Parameter"; - - /** - * Creates a new instance of NegativeValueException - * @param message Message to print in the stack. - */ - public InvalidParameter(String message) { - - super(message); - - } - - /** - * Creates a new instance of NegativeValueException with the default message - */ - public InvalidParameter() { - - super(defaultMessage); - - } - -} diff --git a/java/src/com/qotsa/exception/package.html b/java/src/com/qotsa/exception/package.html deleted file mode 100644 index 07b6ce6..0000000 --- a/java/src/com/qotsa/exception/package.html +++ /dev/null @@ -1,20 +0,0 @@ - - -
- - - - -Package containing the Exception Class used in the WinampController Class. - - -
- * TRANSLATION typed axes denote a translational deviation from a center
- * position. This can be e.g. the common, basic joystick axes.
- * The range of getValue() is [-1.0,1.0].
- *
- * ROTATION typed axes denote a rotational deviation from a center
- * position. Something on the stick is turned or twisted.
- * The range of getValue() is [-1.0,1.0].
- *
- * SLIDER typed axes denote a shifting device without a center position.
- * A good sample is a throttle control.
- * The range of getValue() is [0.0,1.0].
- *
- * @return [ TRANSLATION | ROTATION | SLIDER ]
- */
- int getType();
-
- /**
- * Returns the current value of the axis.
- * The range of the result depends on the axis type.
- *
- * @return value [-1.0,1.0] or [0.0,1.0]
- */
- double getValue();
-
-
- /**
- * Inform about the resolution of the axis.
- *
- * @return resolution, e.g. 2^-16
- */
- double getResolution();
-
-}
-
-
diff --git a/java/src/de/hardcode/jxinput/Button.java b/java/src/de/hardcode/jxinput/Button.java
deleted file mode 100644
index 418e2b6..0000000
--- a/java/src/de/hardcode/jxinput/Button.java
+++ /dev/null
@@ -1,35 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 19. Dezember 2001, 21:58
-//**********************************************************************************************
-package de.hardcode.jxinput;
-
-/**
- *
- * @author Herkules
- */
-public interface Button extends Feature
-{
- // Enumeration of button types
- final static int PUSHBUTTON = 0;
- final static int TOGGLEBUTTON = 1;
-
- /**
- * Retrieve the type of the button.
- * Pushbutton will deliver true==getState() as long as they are pressed down.
- * Togglebuttons will change their state once they are pressed and keep that state
- * until they are pressed again.
- * @return [ PUSHBUTTON | TOGGLEBUTTON ]
- */
- int getType();
-
- /**
- * Tells the state of the button at last update.
- */
- boolean getState();
-}
-
diff --git a/java/src/de/hardcode/jxinput/Directional.java b/java/src/de/hardcode/jxinput/Directional.java
deleted file mode 100644
index ccd27c1..0000000
--- a/java/src/de/hardcode/jxinput/Directional.java
+++ /dev/null
@@ -1,45 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 27. Dezember 2001, 23:33
-//**********************************************************************************************
-package de.hardcode.jxinput;
-
-/**
- *
- * @author Herkules
- */
-public interface Directional extends Feature
-{
- /**
- * If the Directional has a center position where it points to no direction, this
- * flag is true when this position is reached.
- */
- boolean isCentered();
-
- /**
- * Retrieve the direction pointed to.
- * Value is given in 1/100 degree, [0,36000]
- */
- int getDirection();
-
- /**
- * Retrieve the analog value pointing to the angle described by
- * getDirection().
- * For coolie hats this will be either 1,0 for any direction or 0.0
- * when isCentered()==true.
- */
- double getValue();
-
- /**
- * Inform about the resolution of the value returned by getValue().
- *
- * @return resolution, e.g. 1.0 for coolie hats
- */
- double getResolution();
-
-}
-
diff --git a/java/src/de/hardcode/jxinput/Feature.java b/java/src/de/hardcode/jxinput/Feature.java
deleted file mode 100644
index dcaed07..0000000
--- a/java/src/de/hardcode/jxinput/Feature.java
+++ /dev/null
@@ -1,38 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 27. Dezember 2001, 00:19
-//**********************************************************************************************
-package de.hardcode.jxinput;
-
-/**
- * An input device offers a set of features (otherwise it would be pretty useless).
- * Features in this sense can be axes, buttons and a feature callede
- * There are no concrete classes directly derived from Feature - it only
- * provides a basis for other interfaces.
- *
- * @see Axis
- * @see SelectButton
- * @see Directional
- *
- * @author Herkules
- */
-public abstract interface Feature
-{
- /**
- * Features may have a name provided e.g. by the driver.
- */
- String getName();
-
- /**
- * Denote wether this feature has changed beyond it's resolution since it got last
- * updated.
- */
- boolean hasChanged();
-}
-
diff --git a/java/src/de/hardcode/jxinput/JXInputDevice.java b/java/src/de/hardcode/jxinput/JXInputDevice.java
deleted file mode 100644
index d8a8bc8..0000000
--- a/java/src/de/hardcode/jxinput/JXInputDevice.java
+++ /dev/null
@@ -1,71 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 19. Dezember 2001, 21:47
-//**********************************************************************************************
-package de.hardcode.jxinput;
-
-/**
- * The JXInputDevise is the main entrypoint to the jxinput package.
- *
- * A JXInputDevice represents one physical device like a joystick, a gamepad or - * even some emulation (e.g. using keyboard) that implements the interface. - *
- * The basis task of a JXInputDevise is to maintain a consistent state of all its features.
- *
- * It is save to distribute the Feature objects into application without worrying
- * about someone else performing an update method and thereby destructing the consistent state.
- *
- * An additional task is to provide basic device features information like number of axes, buttons - * and directional features. - * - * @see Feature - * @see JXInputManager - * - * @author Herkules - * @version 0.2beta - */ -public interface JXInputDevice -{ - /** - * @directed - */ - /*#Features lnkFeatures;*/ - - /** - *@link aggregationByValue - */ - /*#Feature lnkFeature;*/ - - /** - * Devices may have a name. - * This name might be provided by a system dependant driver. - */ - String getName(); - - /** Actual number of available axes. */ - int getNumberOfAxes(); - - /** Actual number of available buttons. */ - int getNumberOfButtons(); - - /** Actual number of available directional features. */ - int getNumberOfDirectionals(); - - /** Maximum number of axes as an upper bound for index values. */ - int getMaxNumberOfAxes(); - - /** Maximum number of buttons as an upper bound for index values. */ - int getMaxNumberOfButtons(); - - /** Maximum number of directional features as an upper bound for index values. */ - int getMaxNumberOfDirectionals(); - - Axis getAxis( int idx ); - Button getButton( int idx ); - Directional getDirectional( int idx ); -} - diff --git a/java/src/de/hardcode/jxinput/JXInputManager.java b/java/src/de/hardcode/jxinput/JXInputManager.java deleted file mode 100644 index 8c3e050..0000000 --- a/java/src/de/hardcode/jxinput/JXInputManager.java +++ /dev/null @@ -1,233 +0,0 @@ -//********************************************************************************************** -// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development -// All rights reserved. Copying, modification, -// distribution or publication without the prior written -// consent of the author is prohibited. -// -// Created on 29. Dezember 2001, 02:17 -//********************************************************************************************** -package de.hardcode.jxinput; - -// -// Import driver stuff -// -import de.hardcode.jxinput.directinput.DirectInputDevice; -import de.hardcode.jxinput.event.JXInputEventManager; -import de.hardcode.jxinput.keyboard.JXKeyboardInputDevice; -import de.hardcode.jxinput.virtual.JXVirtualInputDevice; - - -import java.util.ArrayList; -import java.util.Iterator; -import java.awt.Component; - - -/** - * Manages the available instances of JXInputDevice. - * It holds the one central update method which synchronizes with the physical device. - * @author Herkules - */ -public class JXInputManager -{ - - /** Remember when the last update took place. */ - private static long mTimeOfLastUpdate; - - /** Maintain a list of devices. */ - private final static ArrayList mDevices = new ArrayList(); - - /** Maintain a list of direct input devices. */ - private final static ArrayList mDIDevices = new ArrayList(); - - /** Maintain a list of virtual devices. */ - private final static ArrayList mVirtualDevices = new ArrayList(); - - /** Maintain a list of keyboard devices. */ - private final static ArrayList mKBDevices = new ArrayList(); - - /** - * Statically retrieve all DirectInputDevices available. - */ - static - { - reset(); - } - - - /** - * @directed - */ - /*#JXInputDevice lnkJXInputDevice;*/ - - /** - * Creates a new instance of JXInputManager. - * This is prohibited - it only has static members. - */ - private JXInputManager() - { - } - - - /** - * Retrieve the number of available input devices. - */ - public static int getNumberOfDevices() - { - return mDevices.size(); - } - - /** - * Delivers the JXInputDevice with the desired index. - *
- * Take care that idx < getNumberOfDevices()!
- */
- public static JXInputDevice getJXInputDevice( int idx )
- {
- //
- // Be well-behaved even if idx is out of range.
- //
- if ( idx >= mDevices.size() )
- return null;
- return (JXInputDevice)mDevices.get( idx );
- }
-
-
- /**
- * Master reset for all devices and events.
- * After calling reset(), better forget all devices created or retrieved.
- * They are no longer valid.
- * Event listeners will no longer be called and should be discarded.
- */
- synchronized public static void reset()
- {
- JXInputEventManager.reset();
-
- mDevices.clear();
-
- mVirtualDevices.clear();
- mDIDevices.clear();
-
- DirectInputDevice.reset();
-
- for ( int i = 0; i < DirectInputDevice.getNumberOfDevices(); ++i )
- {
- DirectInputDevice dev = new DirectInputDevice( i );
- mDevices.add( dev );
- mDIDevices.add( dev );
- }
-
- // I have to call updateFeatures one time here during initialization
- // bc. I experienced difficulties otherwise while running with the
- // J3D sensoring stuff!
-// updateFeatures();
- DirectInputDevice.update();
-
- int n = mKBDevices.size();
- for ( int i = 0; i < n; ++i )
- ((JXKeyboardInputDevice)mKBDevices.get( i )).shutdown();
- mKBDevices.clear();
- }
-
-
- /**
- * Update the (shared) state of all features in one step.
- * This method asks the actual device for a consistant state.
- * After calling this method, all features may have new values.
- * updateFeatures() is meant to be called e.g. once per frame in a gaming environment.
- */
- public static void updateFeatures()
- {
- // Get timing
- long now = System.currentTimeMillis();
- long deltaT = now - mTimeOfLastUpdate;
-
- // Update available driver
- DirectInputDevice.update();
-
- //
- // Update the virtual devices.
- //
- Iterator vdevices = mVirtualDevices.iterator();
- while ( vdevices.hasNext() )
- {
- ((JXVirtualInputDevice)vdevices.next()).update( deltaT );
- }
-
- // Remember time
- mTimeOfLastUpdate = now;
-
- // Fire all events.
- JXInputEventManager.trigger();
- }
-
-
-
- /**
- * Get time when last update occurred.
- * @return tickervalue in milliseconds
- */
- public static long getLastUpdateTime()
- {
- return mTimeOfLastUpdate;
- }
-
-
- /**
- * Create a new pseudo-device.
- */
- public static JXKeyboardInputDevice createKeyboardDevice()
- {
- JXKeyboardInputDevice d = new JXKeyboardInputDevice();
- mDevices.add( d );
- mKBDevices.add( d );
- return d;
- }
-
-
- /**
- * Create a new pseudo-device listening to a Swing component.
- * Make sure that the component also has the keyboard focus!!
- */
- public static JXKeyboardInputDevice createKeyboardDevice( Component comp )
- {
- JXKeyboardInputDevice d = new JXKeyboardInputDevice( comp );
- mDevices.add( d );
- mKBDevices.add( d );
- return d;
- }
-
-
- /**
- * Delete a keyboard device again e.g. when the corresponding
- * JComponent gets deleted.
- */
- public static void deleteKeyboardDevice( JXKeyboardInputDevice dev )
- {
- mDevices.remove( dev );
- mKBDevices.remove( dev );
- ((JXKeyboardInputDevice)dev).shutdown();
- }
-
-
- /**
- * Create a new pseudo-device.
- */
- public static JXVirtualInputDevice createVirtualDevice()
- {
- JXVirtualInputDevice d = new JXVirtualInputDevice();
- mDevices.add( d );
- mVirtualDevices.add( d );
- return d;
- }
-
-
- /**
- * Delete a virtual device again.
- */
- public static void deleteVirtualDevice( JXVirtualInputDevice dev )
- {
- mDevices.remove( dev );
- mVirtualDevices.remove( dev );
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/directinput/DIAxis.java b/java/src/de/hardcode/jxinput/directinput/DIAxis.java
deleted file mode 100644
index a6d0eac..0000000
--- a/java/src/de/hardcode/jxinput/directinput/DIAxis.java
+++ /dev/null
@@ -1,70 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 27. Dezember 2001, 00:14
-//**********************************************************************************************
-package de.hardcode.jxinput.directinput;
-
-import de.hardcode.jxinput.Axis;
-
-/**
- *
- * @author Herkules
- */
-class DIAxis implements Axis
-{
- private final int mDeviceIdx;
- private final int mIdx;
-
- /**
- * Creates a new instance of DIAxis.
- */
- DIAxis( int devidx, int idx )
- {
- mDeviceIdx = devidx;
- mIdx = idx;
- }
-
- public String getName()
- {
- return DirectInputDriver.getAxisName( mDeviceIdx, mIdx );
- }
-
-
- /**
- * Denote wether this feature has changed beyond it's resolution since it got last
- * updated.
- */
- public boolean hasChanged()
- {
- return true;
- }
-
- public double getValue()
- {
- return DirectInputDriver.getAxisValue( mDeviceIdx, mIdx );
- }
-
- public int getType()
- {
- return DirectInputDriver.getAxisType( mDeviceIdx, mIdx );
- }
-
- /**
- * Inform about the resolution of the axis.
- *
- * @return resolution, e.g. 2^-16
- */
- public double getResolution()
- {
- // extend the driver here!!
- // Here I assume typical 16 bit resolution
- return ( getType() == Axis.SLIDER ? 1.0/65536.0 : 2.0/65536.0 ) ;
- }
-
-}
-
-
diff --git a/java/src/de/hardcode/jxinput/directinput/DIButton.java b/java/src/de/hardcode/jxinput/directinput/DIButton.java
deleted file mode 100644
index 5419550..0000000
--- a/java/src/de/hardcode/jxinput/directinput/DIButton.java
+++ /dev/null
@@ -1,55 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 27. Dezember 2001, 00:14
-//**********************************************************************************************
-package de.hardcode.jxinput.directinput;
-
-import de.hardcode.jxinput.Button;
-
-
-/**
- *
- * @author Herkules
- */
-class DIButton implements Button
-{
- private final int mDeviceIdx;
- private final int mIdx;
-
- /**
- * Creates a new instance of DIButton.
- */
- DIButton( int devidx, int idx )
- {
- mDeviceIdx = devidx;
- mIdx = idx;
- }
-
- public String getName()
- {
- return DirectInputDriver.getButtonName( mDeviceIdx, mIdx );
- }
-
- /**
- * Denote wether this feature has changed beyond it's resolution since it got last
- * updated.
- */
- public boolean hasChanged()
- {
- return true;
- }
-
- public int getType()
- {
- return DirectInputDriver.getButtonType( mDeviceIdx, mIdx );
- }
-
- public boolean getState()
- {
- return DirectInputDriver.getButtonState( mDeviceIdx, mIdx );
- }
-}
\ No newline at end of file
diff --git a/java/src/de/hardcode/jxinput/directinput/DIDirectional.java b/java/src/de/hardcode/jxinput/directinput/DIDirectional.java
deleted file mode 100644
index 9da2d3d..0000000
--- a/java/src/de/hardcode/jxinput/directinput/DIDirectional.java
+++ /dev/null
@@ -1,78 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 27. Dezember 2001, 23:40
-//**********************************************************************************************
-package de.hardcode.jxinput.directinput;
-
-import de.hardcode.jxinput.Directional;
-
-/**
- *
- * @author Herkules
- */
-class DIDirectional implements Directional
-{
- private final int mDeviceIdx;
- private final int mIdx;
-
- /**
- * Creates a new instance of DIDirectional.
- */
- DIDirectional( int devidx, int idx )
- {
- mDeviceIdx = devidx;
- mIdx = idx;
- }
-
- /** Features may have a name provided e.g. by the driver. */
- public String getName()
- {
- return DirectInputDriver.getDirectionalName( mDeviceIdx, mIdx );
- }
-
- /**
- * Denote wether this feature has changed beyond it's resolution since it got last
- * updated.
- */
- public boolean hasChanged()
- {
- return true;
- }
-
-
- public boolean isCentered()
- {
- return ( 0xffff == (DirectInputDriver.getDirection( mDeviceIdx, mIdx ) & 0xffff) );
- }
-
- public int getDirection()
- {
- return isCentered() ? 0 : DirectInputDriver.getDirection( mDeviceIdx, mIdx );
- }
-
- public double getValue()
- {
- if ( isCentered() )
- return 0.0;
- return 1.0;
- }
-
- /**
- * Inform about the resolution of the value returned by getValue().
- *
- * @return resolution, e.g. 1.0 for coolie hats
- */
- public double getResolution()
- {
- // DI POV always return 0.0 or 1.0, so the resolution is 1.0.
- return 1.0;
- }
-
-
-}
-
-
diff --git a/java/src/de/hardcode/jxinput/directinput/DirectInputDevice.java b/java/src/de/hardcode/jxinput/directinput/DirectInputDevice.java
deleted file mode 100644
index a20eab3..0000000
--- a/java/src/de/hardcode/jxinput/directinput/DirectInputDevice.java
+++ /dev/null
@@ -1,170 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 26. Dezember 2001, 00:40
-//**********************************************************************************************
-package de.hardcode.jxinput.directinput;
-
-import de.hardcode.jxinput.JXInputDevice;
-import de.hardcode.jxinput.Axis;
-import de.hardcode.jxinput.Directional;
-import de.hardcode.jxinput.Button;
-
-/**
- *
- * @author Herkules
- */
-public class DirectInputDevice implements JXInputDevice
-{
- int mDeviceIdx;
-
- private DIAxis[] mAxes;
- private DIButton[] mButtons;
- private DIDirectional[] mDirectionals;
-
- /**
- * The number of DirectInput devices available with the driver.
- */
- public static int getNumberOfDevices()
- {
- if ( DirectInputDriver.isAvailable() )
- return DirectInputDriver.getNumberOfDevices();
- return 0;
- }
-
-
- /**
- * Update the state of all devices.
- */
- public static void update()
- {
- if ( DirectInputDriver.isAvailable() )
- DirectInputDriver.nativeupdate();
- }
-
-
-
-
- /**
- * Creates a new instance of DirectInputDevice.
- */
- public DirectInputDevice( int devidx )
- {
- mDeviceIdx = devidx;
-
- init();
- }
-
- /**
- * Reset the DirectInput connection.
- */
- public static void reset()
- {
- if ( DirectInputDriver.isAvailable() )
- DirectInputDriver.reset();
- }
-
-
- /**
- * Initialisation of fields.
- */
- private final void init()
- {
- //
- // Allocate arrays for max. number of features
- //
- mAxes = new DIAxis [ getMaxNumberOfAxes() ];
- mButtons = new DIButton [ getMaxNumberOfButtons() ];
- mDirectionals = new DIDirectional [ getMaxNumberOfDirectionals() ];
-
- //
- // Fill arrays due to the state of the driver.
- //
- for ( int i = 0; i < mAxes.length; ++i )
- {
- if ( DirectInputDriver.isAxisAvailable( mDeviceIdx, i ) )
- mAxes[ i ] = new DIAxis( mDeviceIdx, i );
- }
-
- for ( int i = 0; i < mButtons.length; ++i )
- {
- if ( DirectInputDriver.isButtonAvailable( mDeviceIdx, i ) )
- mButtons[ i ] = new DIButton( mDeviceIdx, i );
- }
-
- for ( int i = 0; i < mDirectionals.length; ++i )
- {
- if ( DirectInputDriver.isDirectionalAvailable( mDeviceIdx, i ) )
- mDirectionals[ i ] = new DIDirectional( mDeviceIdx, i );
- }
- }
-
- /** Devices may have a name. */
- public String getName()
- {
- String name = DirectInputDriver.getName( mDeviceIdx );
- if ( null == name )
- return "Win32 DirectInput Joystick";
- return name;
- }
-
-
- /** Actual number of available buttons. */
- public int getNumberOfButtons()
- {
- return DirectInputDriver.getNumberOfButtons( mDeviceIdx );
- }
-
- /** Actual number of available axes. */
- public int getNumberOfAxes()
- {
- return DirectInputDriver.getNumberOfAxes( mDeviceIdx );
- }
-
- /** Actual number of available directional features. */
- public int getNumberOfDirectionals()
- {
- return DirectInputDriver.getNumberOfDirectionals( mDeviceIdx );
- }
-
- /** Maximum number of buttons as an upper bound for index values. */
- public int getMaxNumberOfButtons()
- {
- return DirectInputDriver.getMaxNumberOfButtons();
- }
-
- /** Maximum number of axes as an upper bound for index values. */
- public int getMaxNumberOfAxes()
- {
- return DirectInputDriver.getMaxNumberOfAxes();
- }
-
- /** Maximum number of available directional features. */
- public int getMaxNumberOfDirectionals()
- {
- return DirectInputDriver.getMaxNumberOfDirectionals();
- }
-
-
- public Axis getAxis(int idx)
- {
- return mAxes[ idx ];
- }
-
- public Button getButton(int idx)
- {
- return mButtons[ idx ];
- }
-
- public Directional getDirectional(int idx)
- {
- return mDirectionals[ idx ];
- }
-
-}
-
-
-
diff --git a/java/src/de/hardcode/jxinput/directinput/DirectInputDriver.java b/java/src/de/hardcode/jxinput/directinput/DirectInputDriver.java
deleted file mode 100644
index 558f7d8..0000000
--- a/java/src/de/hardcode/jxinput/directinput/DirectInputDriver.java
+++ /dev/null
@@ -1,184 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 19. Dezember 2001, 22:44
-//**********************************************************************************************
-package de.hardcode.jxinput.directinput;
-
-import java.lang.reflect.Array;
-
-/**
- * DirectInputDriver: the connection to the Win32 joystick.
- * There is only one allowed, so the layout of this class is merely static.
- *
- * History:
- *
- * Changes since 0.1beta:
- * - support of multiple devices addressed by the dev index
- *
- *
- * @author Herkules
- * @version 0.2beta
- */
-class DirectInputDriver
-{
- private final static String NATIVE_LIB_NAME = "jxinput";
-
- /** Remember wether nativeinit() succeeded. */
- static boolean sIsOperational = false;
-
- //
- // Static arrays to hold the values.
- //
- private static double [][] sAxisValues;
- private static boolean [][] sButtonStates;
- private static int [][] sDirectionalValues;
-
- /**
- * Perform the static initialization.
- */
- static
- {
- try
- {
- // Load the native lib.
- System.loadLibrary( NATIVE_LIB_NAME );
-
- init();
- }
- catch( SecurityException e )
- {
- Log.logger.warning("Native library jxinput not loaded due to a SecurityException.");
- }
- catch( UnsatisfiedLinkError e )
- {
- Log.logger.info("Native library jxinput not loaded due to an UnsatisfiedLinkError.");
- }
- }
-
-
- private final static void init()
- {
- sIsOperational = false;
- //
- // Initialize it.
- //
- if ( nativeinit() )
- {
- int devs = getNumberOfDevices();
- sAxisValues = new double [ devs ][ DirectInputDriver.getMaxNumberOfAxes() ];
- sButtonStates = new boolean [ devs ][ DirectInputDriver.getMaxNumberOfButtons() ];
- sDirectionalValues = new int [ devs ][ DirectInputDriver.getMaxNumberOfDirectionals() ];
-
- // Bind the native lib to my variables.
- bind();
-
- // Remember I am fine.
- sIsOperational = true;
- }
-
- }
-
-
- /**
- * Static ctor of DirectInputDriver.
- * No object will be created due to the static layout.
- */
- private DirectInputDriver()
- {
- }
-
- // Administration
- private static native boolean nativeinit();
- private static native void nativeexit();
- private static native void bind();
-
- static native int getNumberOfDevices();
-
- // Configuration
- static native String getName( int dev );
- static native int getNumberOfAxes( int dev );
- static native int getNumberOfButtons( int dev );
- static native int getNumberOfDirectionals( int dev );
- static native int getMaxNumberOfAxes();
- static native int getMaxNumberOfButtons();
- static native int getMaxNumberOfDirectionals();
-
- static native boolean isAxisAvailable( int dev, int idx );
- static native String getAxisName( int dev, int idx );
- static native int getAxisType( int dev, int idx );
-
- static native boolean isButtonAvailable( int dev, int idx );
- static native String getButtonName( int dev, int idx );
- static native int getButtonType( int dev, int idx );
-
- static native boolean isDirectionalAvailable( int dev, int idx );
- static native String getDirectionalName( int dev, int idx );
-
- // Operation
- static native void nativeupdate();
-
-
- public static boolean isAvailable()
- {
- return sIsOperational;
- }
-
-
- /**
- * Shutdown the device and free all Win32 resources.
- * It is not a good idea to access any joystick features after
- * shutdown().
- */
- static void shutdown()
- {
- nativeexit();
- sAxisValues = null;
- sButtonStates = null;
- sDirectionalValues = null;
- }
-
-
- /**
- * Reset the device and free all Win32 resources.
- */
- static void reset()
- {
- shutdown();
- init();
- }
-
- static double getAxisValue( int dev, int idx )
- {
- return sAxisValues[ dev ][ idx ];
- }
-
- static boolean getButtonState( int dev, int idx )
- {
- return sButtonStates[ dev ][ idx ];
- }
-
- static int getDirection( int dev, int idx )
- {
- return sDirectionalValues[ dev ][ idx ];
- }
-
- /**
- * @param args the command line arguments
- */
- public static void main (String args[])
- {
-
- if ( ! sIsOperational )
- return;
-
- for( int i = 0; i < 5000; ++i )
- nativeupdate();
-
- shutdown();
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/directinput/Log.java b/java/src/de/hardcode/jxinput/directinput/Log.java
deleted file mode 100644
index 95e586c..0000000
--- a/java/src/de/hardcode/jxinput/directinput/Log.java
+++ /dev/null
@@ -1,34 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 29. Oktober 2002, 22:57
-//**********************************************************************************************
-package de.hardcode.jxinput.directinput;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author Herkules
- */
-public class Log
-{
- public final static Logger logger = Logger.getLogger( Log.class.getPackage().getName() );
-
-// static
-// {
-// logger.setLevel( Level.ALL );
-// }
-
- /**
- * Creates a new instance of Log.
- */
- private Log()
- {
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/event/JXInputAxisEvent.java b/java/src/de/hardcode/jxinput/event/JXInputAxisEvent.java
deleted file mode 100644
index c353b5e..0000000
--- a/java/src/de/hardcode/jxinput/event/JXInputAxisEvent.java
+++ /dev/null
@@ -1,48 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 31. Januar 2002, 23:33
-//**********************************************************************************************
-package de.hardcode.jxinput.event;
-
-import de.hardcode.jxinput.JXInputDevice;
-import de.hardcode.jxinput.Axis;
-
-/**
- * Represents an event coming from an axis.
- * @author Joerg Plewe
- */
-public class JXInputAxisEvent
-{
- private final Axis mAxis;
- double mDelta;
-
- /**
- * Creates a new instance of JXInputEvent.
- */
- JXInputAxisEvent( Axis axis )
- {
- mAxis = axis;
- }
-
- /**
- * The feature that caused the event.
- */
- public final Axis getAxis()
- {
- return mAxis;
- }
-
-
- /**
- * Return the change in value that caused the event.
- */
- public double getDelta()
- {
- return mDelta;
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/event/JXInputAxisEventListener.java b/java/src/de/hardcode/jxinput/event/JXInputAxisEventListener.java
deleted file mode 100644
index d8adf46..0000000
--- a/java/src/de/hardcode/jxinput/event/JXInputAxisEventListener.java
+++ /dev/null
@@ -1,19 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 31. Januar 2002, 23:54
-//**********************************************************************************************
-package de.hardcode.jxinput.event;
-
-/**
- *
- * @author Herkules
- */
-public interface JXInputAxisEventListener
-{
- void changed( JXInputAxisEvent ev );
-}
-
diff --git a/java/src/de/hardcode/jxinput/event/JXInputButtonEvent.java b/java/src/de/hardcode/jxinput/event/JXInputButtonEvent.java
deleted file mode 100644
index d82d0b9..0000000
--- a/java/src/de/hardcode/jxinput/event/JXInputButtonEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 31. Januar 2002, 23:33
-//**********************************************************************************************
-package de.hardcode.jxinput.event;
-
-import de.hardcode.jxinput.JXInputDevice;
-import de.hardcode.jxinput.Button;
-
-/**
- * Represents event coming from a button.
- * @author Joerg Plewe
- */
-public class JXInputButtonEvent
-{
- final Button mButton;
-
- /**
- * Creates a new instance of JXInputEvent.
- */
- JXInputButtonEvent( Button button )
- {
- mButton = button;
- }
-
- /**
- * The feature that caused the event.
- */
- public final Button getButton()
- {
- return mButton;
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/event/JXInputButtonEventListener.java b/java/src/de/hardcode/jxinput/event/JXInputButtonEventListener.java
deleted file mode 100644
index afdc323..0000000
--- a/java/src/de/hardcode/jxinput/event/JXInputButtonEventListener.java
+++ /dev/null
@@ -1,19 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 31. Januar 2002, 23:54
-//**********************************************************************************************
-package de.hardcode.jxinput.event;
-
-/**
- *
- * @author Herkules
- */
-public interface JXInputButtonEventListener
-{
- void changed( JXInputButtonEvent ev );
-}
-
diff --git a/java/src/de/hardcode/jxinput/event/JXInputDirectionalEvent.java b/java/src/de/hardcode/jxinput/event/JXInputDirectionalEvent.java
deleted file mode 100644
index 70e6bcd..0000000
--- a/java/src/de/hardcode/jxinput/event/JXInputDirectionalEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 31. Januar 2002, 23:33
-//**********************************************************************************************
-package de.hardcode.jxinput.event;
-
-import de.hardcode.jxinput.JXInputDevice;
-import de.hardcode.jxinput.Directional;
-
-/**
- * Represents an event coming from an axis.
- * @author Joerg Plewe
- */
-public class JXInputDirectionalEvent
-{
- private final Directional mDirectional;
- double mValueDelta;
- int mDirectionDelta;
-
- /**
- * Creates a new instance of JXInputEvent.
- */
- JXInputDirectionalEvent( Directional directional )
- {
- mDirectional = directional;
- }
-
- /**
- * The feature that caused the event.
- */
- public final Directional getDirectional()
- {
- return mDirectional;
- }
-
- /**
- * Return the change in value that caused the event.
- */
- public double getValueDelta()
- {
- return mValueDelta;
- }
-
- /**
- * Return the change in direction that caused the event.
- */
- public int getDirectionDelta()
- {
- return mDirectionDelta;
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/event/JXInputDirectionalEventListener.java b/java/src/de/hardcode/jxinput/event/JXInputDirectionalEventListener.java
deleted file mode 100644
index 65c7efa..0000000
--- a/java/src/de/hardcode/jxinput/event/JXInputDirectionalEventListener.java
+++ /dev/null
@@ -1,19 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 31. Januar 2002, 23:54
-//**********************************************************************************************
-package de.hardcode.jxinput.event;
-
-/**
- *
- * @author Herkules
- */
-public interface JXInputDirectionalEventListener
-{
- void changed( JXInputDirectionalEvent ev );
-}
-
diff --git a/java/src/de/hardcode/jxinput/event/JXInputEventManager.java b/java/src/de/hardcode/jxinput/event/JXInputEventManager.java
deleted file mode 100644
index aa196d7..0000000
--- a/java/src/de/hardcode/jxinput/event/JXInputEventManager.java
+++ /dev/null
@@ -1,284 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 31. Januar 2002, 23:42
-//**********************************************************************************************
-package de.hardcode.jxinput.event;
-
-import de.hardcode.jxinput.JXInputManager;
-import de.hardcode.jxinput.JXInputDevice;
-
-import java.util.ArrayList;
-import de.hardcode.jxinput.Axis;
-import java.util.Iterator;
-import de.hardcode.jxinput.Button;
-import de.hardcode.jxinput.Directional;
-
-/**
- * Handles all events and listeners.
- * JXInputEventManager is layed out a static singleton.
- * @author Herkules
- */
-public class JXInputEventManager
-{
-
- private final static ArrayList mAxisEventListeners = new ArrayList();
- private final static ArrayList mButtonEventListeners = new ArrayList();
- private final static ArrayList mDirectionalEventListeners = new ArrayList();
-
- private static autotrigger mAutoTrigger = null;
-
- /**
- * Inner class combining a listener with its scheduling parameters.
- */
- private static class axislistener
- {
- final JXInputAxisEventListener mListener;
- final double mTreshold;
- final JXInputAxisEvent mEvent;
- double mLastValueFired = 0.0;
-
- axislistener( JXInputAxisEventListener l, Axis axis, double treshold )
- {
- mListener = l;
- mTreshold = treshold;
- mEvent = new JXInputAxisEvent( axis );
- }
-
- final void checkTrigger()
- {
- double curval = mEvent.getAxis().getValue();
- double delta = curval - mLastValueFired;
-
- if ( Math.abs( delta ) >= mTreshold )
- {
- mLastValueFired = curval;
- mEvent.mDelta = delta;
- mListener.changed( mEvent );
- }
- }
- }
-
- /**
- * Inner class combining a listener with its scheduling parameters.
- */
- private static class buttonlistener
- {
- final JXInputButtonEventListener mListener;
- final JXInputButtonEvent mEvent;
- boolean mLastValueFired = false;
-
- buttonlistener( JXInputButtonEventListener l, Button button )
- {
- mListener = l;
- mEvent = new JXInputButtonEvent( button );
- }
-
- final void checkTrigger()
- {
- boolean curstate = mEvent.getButton().getState();
- if ( curstate != mLastValueFired )
- {
- mLastValueFired = curstate;
- mListener.changed( mEvent );
- }
- }
- }
-
-
- private static class directionallistener
- {
- final JXInputDirectionalEventListener mListener;
- final double mValueTreshold;
- final JXInputDirectionalEvent mEvent;
- double mLastValueFired = 0.0;
- boolean mLastCenteredFired = true;
- int mLastDirectionFired = 0;
-
- directionallistener( JXInputDirectionalEventListener l, Directional directional, double valuetreshold )
- {
- mListener = l;
- mValueTreshold = valuetreshold;
- mEvent = new JXInputDirectionalEvent( directional );
- }
-
- final void checkTrigger()
- {
- double curval = mEvent.getDirectional().getValue();
- int curdir = mEvent.getDirectional().getDirection();
- boolean curctr = mEvent.getDirectional().isCentered();
-
- double delta = curval - mLastValueFired;
- int dirdelta = curdir - mLastDirectionFired;
- boolean centeredchanged = mLastCenteredFired != curctr;
-
- if ( Math.abs( delta ) >= mValueTreshold
- || Math.abs( dirdelta ) > 0
- || centeredchanged )
- {
- mLastValueFired = curval;
- mLastDirectionFired = curdir;
- mLastCenteredFired = curctr;
-
- mEvent.mValueDelta = delta;
- mEvent.mDirectionDelta = dirdelta;
- mListener.changed( mEvent );
- }
- }
- }
-
- /**
- * Creates a new instance of JXInputEventManager.
- */
- private JXInputEventManager()
- {
- }
-
-
- /**
- * Remove all listeners at once.
- */
- public static void reset()
- {
- mAxisEventListeners.clear();
- mButtonEventListeners.clear();
- mDirectionalEventListeners.clear();
- }
-
-
- /**
- * Query devices and fire all occuring events.
- * trigger() is thought to be called by JXInputManager#updateFeatures().
- */
- public static void trigger()
- {
- int n = mAxisEventListeners.size();
- for ( int i = 0; i < n; i++ )
- {
- axislistener l = (axislistener)mAxisEventListeners.get( i );
- l.checkTrigger();
- }
-
- n = mButtonEventListeners.size();
- for ( int i = 0; i < n; i++ )
- {
- buttonlistener l = (buttonlistener)mButtonEventListeners.get( i );
- l.checkTrigger();
- }
-
- n = mDirectionalEventListeners.size();
- for ( int i = 0; i < n; i++ )
- {
- directionallistener l = (directionallistener)mDirectionalEventListeners.get( i );
- l.checkTrigger();
- }
- }
-
-
- private final static class autotrigger extends Thread
- {
- boolean mFinish = false;
- final int mDelay;
-
- autotrigger( int delay )
- {
- mDelay = delay;
- }
-
- public void run()
- {
- while ( ! mFinish )
- {
- try
- {
- Thread.sleep( mDelay );
- JXInputManager.updateFeatures();
- }
- catch ( InterruptedException ex )
- {
- }
- }
- }
- }
-
-
- /**
- * Set the intervall in ms that is used to check for new values of the features.
- * Set it to <= 0 to prohibit automatic triggering. Events will then only be fired
- * when somebody invokes JXInputManager#updateFeatures().
- */
- public static void setTriggerIntervall( int ms )
- {
- //
- // Kill current thread, if any
- //
- if ( null != mAutoTrigger )
- {
- mAutoTrigger.mFinish = true;
- try
- {
- mAutoTrigger.join();
- }
- catch ( InterruptedException ex )
- {
- }
- }
-
- mAutoTrigger = null;
-
- if ( ms > 0 )
- {
- mAutoTrigger = new autotrigger( ms );
- mAutoTrigger.start();
- }
-
- }
-
-
-
-
- public static void addListener( JXInputAxisEventListener l, Axis axis, double treshold )
- {
- mAxisEventListeners.add( new JXInputEventManager.axislistener( l, axis, treshold ) );
- }
-
- public static void addListener( JXInputAxisEventListener l, Axis axis )
- {
- mAxisEventListeners.add( new JXInputEventManager.axislistener( l, axis, axis.getResolution() ) );
- }
-
- public static void removeListener( JXInputAxisEventListener l )
- {
- mAxisEventListeners.remove( l );
- }
-
-
- public static void addListener( JXInputButtonEventListener l, Button button )
- {
- mButtonEventListeners.add( new JXInputEventManager.buttonlistener( l, button ) );
- }
-
- public static void removeListener( JXInputButtonEventListener l )
- {
- mButtonEventListeners.remove( l );
- }
-
- public static void addListener( JXInputDirectionalEventListener l, Directional directional, double valuetreshold )
- {
- mDirectionalEventListeners.add( new JXInputEventManager.directionallistener( l, directional, valuetreshold ) );
- }
-
- public static void addListener( JXInputDirectionalEventListener l, Directional directional )
- {
- mDirectionalEventListeners.add( new JXInputEventManager.directionallistener( l, directional, directional.getResolution() ) );
- }
-
- public static void removeListener( JXInputDirectionalEventListener l )
- {
- mDirectionalEventListeners.remove( l );
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/j3d/DeviceConfiguration.java b/java/src/de/hardcode/jxinput/j3d/DeviceConfiguration.java
deleted file mode 100644
index 8c1288a..0000000
--- a/java/src/de/hardcode/jxinput/j3d/DeviceConfiguration.java
+++ /dev/null
@@ -1,95 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 23. Februar 2002, 14:05
-//**********************************************************************************************
-package de.hardcode.jxinput.j3d;
-
-import de.hardcode.jxinput.Axis;
-
-
-/**
- * Connects JXInput with J3DInputDevice.
- *
- * @author Herkules
- */
-public class DeviceConfiguration
-{
- public final static int AXIS_X = 0;
- public final static int AXIS_Y = 1;
- public final static int AXIS_Z = 2;
-
- private final static class axisvalue
- {
- private final Axis mAxis;
- private final IsActiveCondition mIsActive;
- private final IsActiveCondition mIsIncremental;
- private final double mScale;
- private final double mOffset;
- private double mValue;
-
- axisvalue( Axis axis, IsActiveCondition active, IsActiveCondition incremental, double offset, double scale )
- {
- mAxis = axis;
- mIsActive = active;
- mIsIncremental = incremental;
- mValue = mOffset = offset;
- mScale = scale;
- }
-
- double value()
- {
- if ( mIsActive.isActive() )
- {
- double newval = mAxis.getValue() * mScale;
-
- if ( mIsIncremental.isActive() )
- mValue += newval;
- else
- mValue = newval + mOffset;
- }
- return mValue;
- }
- }
-
- DeviceConfiguration.axisvalue [] mAxisTrans = new DeviceConfiguration.axisvalue[ 3 ];
- DeviceConfiguration.axisvalue [] mAxisRot = new DeviceConfiguration.axisvalue[ 3 ];
-
- /**
- * Creates a new instance of DeviceConfiguration.
- */
- public DeviceConfiguration()
- {
- }
-
-
- double getTranslational( int axisid )
- {
- DeviceConfiguration.axisvalue val = mAxisTrans[ axisid ];
- return null == val ? 0.0 : val.value();
- }
-
- double getRotational( int axisid )
- {
- DeviceConfiguration.axisvalue val = mAxisRot[ axisid ];
- return null == val ? 0.0 : val.value();
- }
-
- public void setTranslational( int axisid, Axis axis, IsActiveCondition active, IsActiveCondition incremental, double offset, double scale )
- {
- if ( axisid < 0 || axisid > AXIS_Z )
- throw new IllegalArgumentException();
- mAxisTrans[ axisid ] = new DeviceConfiguration.axisvalue( axis, active, incremental, offset, scale );
- }
-
- public void setRotational( int axisid, Axis axis, IsActiveCondition active, IsActiveCondition incremental, double offset, double scale )
- {
- if ( axisid < 0 || axisid > AXIS_Z )
- throw new IllegalArgumentException();
- mAxisRot[ axisid ] = new DeviceConfiguration.axisvalue( axis, active, incremental, offset, scale );
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/j3d/IsActiveCondition.java b/java/src/de/hardcode/jxinput/j3d/IsActiveCondition.java
deleted file mode 100644
index af6ca08..0000000
--- a/java/src/de/hardcode/jxinput/j3d/IsActiveCondition.java
+++ /dev/null
@@ -1,25 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 25. Februar 2002, 22:41
-//**********************************************************************************************
-package de.hardcode.jxinput.j3d;
-
-/**
- *
- * @author Herkules
- */
-public interface IsActiveCondition
-{
- public final static IsActiveCondition ALWAYS = IsAlwaysActiveCondition.ALWAYS;
- public final static IsActiveCondition NEVER = IsAlwaysActiveCondition.NEVER;
-
- /**
- * Tell wether a certain thing is active.
- */
- boolean isActive();
-}
-
diff --git a/java/src/de/hardcode/jxinput/j3d/IsActiveOnButtonCondition.java b/java/src/de/hardcode/jxinput/j3d/IsActiveOnButtonCondition.java
deleted file mode 100644
index 98da7bb..0000000
--- a/java/src/de/hardcode/jxinput/j3d/IsActiveOnButtonCondition.java
+++ /dev/null
@@ -1,39 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 25. Februar 2002, 22:43
-//**********************************************************************************************
-package de.hardcode.jxinput.j3d;
-
-import de.hardcode.jxinput.Button;
-
-/**
- *
- * @author Herkules
- */
-public class IsActiveOnButtonCondition implements IsActiveCondition
-{
- private final boolean mActiveState;
- private final Button mButton;
-
- /**
- * Creates a new instance of IsAlwayActiveCondition.
- */
- public IsActiveOnButtonCondition( Button button, boolean activestate )
- {
- mActiveState = activestate;
- mButton = button;
- }
-
- /**
- * Tell wether a certain thing is active.
- */
- public boolean isActive()
- {
- return mButton.getState() == mActiveState;
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/j3d/IsAlwaysActiveCondition.java b/java/src/de/hardcode/jxinput/j3d/IsAlwaysActiveCondition.java
deleted file mode 100644
index cd8b1fe..0000000
--- a/java/src/de/hardcode/jxinput/j3d/IsAlwaysActiveCondition.java
+++ /dev/null
@@ -1,38 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 25. Februar 2002, 22:43
-//**********************************************************************************************
-package de.hardcode.jxinput.j3d;
-
-/**
- *
- * @author Herkules
- */
-final class IsAlwaysActiveCondition implements IsActiveCondition
-{
- private final boolean mIsActive;
-
- public final static IsActiveCondition ALWAYS = new IsAlwaysActiveCondition( true );
- public final static IsActiveCondition NEVER = new IsAlwaysActiveCondition( false );
-
- /**
- * Creates a new instance of IsAlwayActiveCondition.
- */
- private IsAlwaysActiveCondition(boolean isactive)
- {
- mIsActive = isactive;
- }
-
- /**
- * Tell wether a certain thing is active.
- */
- public boolean isActive()
- {
- return mIsActive;
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/j3d/J3DInputDevice.java b/java/src/de/hardcode/jxinput/j3d/J3DInputDevice.java
deleted file mode 100644
index f5b08f2..0000000
--- a/java/src/de/hardcode/jxinput/j3d/J3DInputDevice.java
+++ /dev/null
@@ -1,171 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 22. Februar 2002, 13:21
-//**********************************************************************************************
-package de.hardcode.jxinput.j3d;
-
-import javax.media.j3d.InputDevice;
-import javax.media.j3d.Sensor;
-import javax.media.j3d.SensorRead;
-import javax.vecmath.Vector3d;
-import javax.media.j3d.Transform3D;
-import de.hardcode.jxinput.JXInputManager;
-
-
-/**
- * Implementation of Java3D's InputDevice
- *
- * @author Herkules
- */
-public class J3DInputDevice
- implements InputDevice
-{
- private Vector3d mPosition = new Vector3d();
- private Transform3D mNewTransform = new Transform3D();
-
- private Transform3D mRotTransX = new Transform3D();
- private Transform3D mRotTransY = new Transform3D();
- private Transform3D mRotTransZ = new Transform3D();
-
- private Vector3d mInitPos = new Vector3d( 0.0, 0.0, 0.0 );
-
- private Sensor mSensor = new Sensor( this );
- private SensorRead mSensorRead = new SensorRead();
-
- private DeviceConfiguration mConfig;
-
- /**
- * Creates a new instance of J3DInputDevice.
- */
- public J3DInputDevice( DeviceConfiguration config )
- {
- mConfig = config;
- setNominalPositionAndOrientation();
- }
-
-
- public void close()
- {
- // Intentionally empty
- }
-
-
- /**
- * Retrieve processing mode.
- * For this device, it always is NON_BLOCKING.
- */
- public int getProcessingMode()
- {
- return InputDevice.NON_BLOCKING;
- }
-
-
- /**
- * Don't care for the index, I only support one sensor.
- * And I deliver that.
- */
- public Sensor getSensor( int param )
- {
- return mSensor;
- }
-
-
- /**
- * Tell the world about the only one sensor I support.
- */
- public int getSensorCount()
- {
- return 1;
- }
-
-
- /**
- * Well - initialize!
- * Nothing to do here.
- */
- public boolean initialize()
- {
- return true;
- }
-
-
- /**
- * The main update method.
- */
- public void pollAndProcessInput()
- {
- JXInputManager.updateFeatures();
-
- mSensorRead.setTime( JXInputManager.getLastUpdateTime() );
-
- mRotTransX.rotX( mConfig.getRotational( DeviceConfiguration.AXIS_X ) );
- mRotTransY.rotY( mConfig.getRotational( DeviceConfiguration.AXIS_Y ) );
- mRotTransZ.rotZ( mConfig.getRotational( DeviceConfiguration.AXIS_Z ) );
-
- mPosition.set(
- mConfig.getTranslational( DeviceConfiguration.AXIS_X ),
- mConfig.getTranslational( DeviceConfiguration.AXIS_Y ),
- mConfig.getTranslational( DeviceConfiguration.AXIS_Z )
- );
-
- mNewTransform.set( mPosition );
-
- mNewTransform.mul( mRotTransX );
- mNewTransform.mul( mRotTransY );
- mNewTransform.mul( mRotTransZ );
-
- mSensorRead.set( mNewTransform );
- mSensor.setNextSensorRead( mSensorRead );
- }
-
-
- /**
- * Not called by current j3d implementation.
- */
- public void processStreamInput()
- {
- // Intentionally empty
- }
-
-
- /**
- * Reset state.
- */
- public void setNominalPositionAndOrientation()
- {
- mSensorRead.setTime( JXInputManager.getLastUpdateTime() );
-
- mRotTransX.rotX( 0.0 );
- mRotTransY.rotY( 0.0 );
- mRotTransZ.rotZ( 0.0 );
-
- mPosition.set( mInitPos );
-
- mNewTransform.set( mPosition );
-
- mNewTransform.mul( mRotTransX );
- mNewTransform.mul( mRotTransY );
- mNewTransform.mul( mRotTransZ );
-
- mSensorRead.set( mNewTransform );
- mSensor.setNextSensorRead( mSensorRead );
-
- }
-
-
- /**
- * Set the processing mode.
- * Only NON_BLOCKING is allowed!
- */
- public void setProcessingMode(int param)
- {
- if ( param != InputDevice.NON_BLOCKING )
- throw new IllegalArgumentException("Processing mode must be NON_BLOCKING");
-
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/j3d/package.html b/java/src/de/hardcode/jxinput/j3d/package.html
deleted file mode 100644
index 9b92964..0000000
--- a/java/src/de/hardcode/jxinput/j3d/package.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
true==getState() as long as they are pressed down.
- * Togglebuttons will change their state once they are pressed and keep that state
- * until they are pressed again.
- * @return [ PUSHBUTTON | TOGGLEBUTTON ]
- */
- public int getType()
- {
- return Button.PUSHBUTTON;
- }
-
-
- /**
- * Denote wether this feature has changed beyond it's resolution since it got last
- * updated.
- */
- public boolean hasChanged()
- {
- return true;
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/keyboard/KeyboardDriver.java b/java/src/de/hardcode/jxinput/keyboard/KeyboardDriver.java
deleted file mode 100644
index 7eb6232..0000000
--- a/java/src/de/hardcode/jxinput/keyboard/KeyboardDriver.java
+++ /dev/null
@@ -1,141 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 9. April 2002, 22:43
-//**********************************************************************************************
-package de.hardcode.jxinput.keyboard;
-
-import java.awt.event.KeyListener;
-import java.awt.event.KeyEvent;
-import java.util.HashMap;
-import java.security.InvalidParameterException;
-
-
-
-/**
- * Listen to a JComponent handle handle all associated button objects.
- * This is the main worker class for JXKeyboardInputDevice.
- *
- * @author Herkules
- */
-class KeyboardDriver implements KeyListener
-{
-// HashMap mKeysToObserveMap = new HashMap();
-
- int mNumberOfKeysObserved = 0;
- KeyButton [] mKeysObserved = new KeyButton [ 0x100 ];
-
-
- /**
- * Creates a new instance of KeyboardDriver.
- */
- public KeyboardDriver()
- {
- }
-
-
- /**
- * How many buttons are registered?
- */
- final int getNumberOfButtons()
- {
- return mNumberOfKeysObserved;
-// return mKeysToObserveMap.size();
- }
-
-
- /**
- * Place a new button under my observation.
- */
- final boolean registerKeyButton( KeyButton b )
- {
- final int keycode = b.getKeyCode();
-
- if ( 0 > keycode || 0x100 < keycode )
- throw new InvalidKeyCodeException();
-
- if ( null == mKeysObserved[ keycode ] )
- {
- mKeysObserved[ keycode ] = b;
- mNumberOfKeysObserved++;
- return true;
- }
- else
- {
- return false;
- }
-
-// Integer code = new Integer( b.getKeyCode() );
-// if ( ! mKeysToObserveMap.containsKey( code ) )
-// {
-// mKeysToObserveMap.put( code, b );
-// return true;
-// }
-// else
-// {
-// return false;
-// }
- }
-
- final void unregisterKeyButton( KeyButton b )
- {
- final int keycode = b.getKeyCode();
-
- if ( 0 > keycode || 0x100 < keycode )
- throw new InvalidKeyCodeException();
-
- if ( null != mKeysObserved[ b.getKeyCode() ] )
- {
- mKeysObserved[ keycode ] = null;
- mNumberOfKeysObserved--;
- }
-
-// Integer code = new Integer( b.getKeyCode() );
-// mKeysToObserveMap.remove( code );
- }
-
-
- /**
- * Retrieve the button from its keycode.
- */
- final KeyButton getButton( int keycode )
- {
- if ( 0 > keycode || 0x100 < keycode )
- throw new InvalidKeyCodeException();
-
- return mKeysObserved[ keycode ];
-
-// Integer code = new Integer( keycode );
-// return (KeyButton)mKeysToObserveMap.get( code );
- }
-
-
- //*********************************************************************************************
- //
- // Implement KeyListener
- //
- //*********************************************************************************************
-
- public void keyPressed( KeyEvent keyEvent )
- {
- KeyButton b = getButton( keyEvent.getKeyCode() );
- if ( null != b )
- b.setIsPressed( true );
- }
-
- public void keyReleased( KeyEvent keyEvent )
- {
- KeyButton b = getButton( keyEvent.getKeyCode() );
- if ( null != b )
- b.setIsPressed( false );
- }
-
- public void keyTyped( KeyEvent keyEvent )
- {
- // Intentionally empty.
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/keyboard/package.html b/java/src/de/hardcode/jxinput/keyboard/package.html
deleted file mode 100644
index e1021d1..0000000
--- a/java/src/de/hardcode/jxinput/keyboard/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- Axis.ROTATION,
- * Axis.TRANSLATION or Axis.SLIDER.
- */
- public void setType( int type )
- {
- if ( Axis.ROTATION != type
- && Axis.TRANSLATION != type
- && Axis.SLIDER != type
- )
- throw new InvalidParameterException( "Invalid type for axis!" );
-
- mType = type;
- }
-
- /**
- * Update features under my control.
- */
- final void update( long deltaT )
- {
- double change = mSpeed * deltaT;
- double springchange = mSpringSpeed * deltaT;
- boolean doincrease = ( null != mButtonIncrease && mButtonIncrease.getState() );
- boolean dodecrease = ( null != mButtonDecrease && mButtonDecrease.getState() );
- boolean iscontrolled = doincrease || dodecrease;
-
- double controlledchange = 0.0;
- if ( doincrease )
- controlledchange += change;
- if ( dodecrease )
- controlledchange -= change;
-
- mCurrentValue += controlledchange;
-
- if ( mCurrentValue > 0.0 && ! doincrease )
- {
- springchange = Math.min( mCurrentValue, springchange );
- mCurrentValue -= springchange;
- }
- if ( mCurrentValue < 0.0 && ! dodecrease )
- {
- springchange = Math.min( -mCurrentValue, springchange );
- mCurrentValue += springchange;
- }
-
- //
- // Hold value within range
- //
- if ( mCurrentValue > 1.0 )
- mCurrentValue = 1.0;
- double lowerlimit = Axis.SLIDER == mType ? 0.0 : -1.0;
- if ( mCurrentValue < lowerlimit )
- mCurrentValue = lowerlimit;
- }
-
-
- /**
- * Set the button to increase the axis for a single button axis.
- */
- public final void setIncreaseButton( Button b )
- {
- if ( null == b )
- throw new InvalidParameterException( "SelectButton may not be null!" );
-
- mButtonIncrease = b;
- }
-
-
- /**
- * Set the buttons to increase and descrease the axis.
- */
- public final void setButtons( Button increase, Button decrease )
- {
- if ( null == increase || null == decrease )
- throw new InvalidParameterException( "Buttons may not be null!" );
-
- mButtonIncrease = increase;
- mButtonDecrease = decrease;
- }
-
-
- public final void setSpeed( double speed )
- {
- mSpeed = speed;
- }
-
- public final void setSpringSpeed( double springspeed )
- {
- mSpringSpeed = springspeed;
- }
-
-
- public final void setTimeFor0To1( int ms )
- {
- if ( 0 >= ms )
- mSpeed = 0.0;
- else
- mSpeed = 1.0/ ms;
- }
- public final void setTimeFor1To0( int ms )
- {
- if ( 0 >= ms )
- mSpringSpeed = 0.0;
- else
- mSpringSpeed = 1.0/ ms;
- }
-
-
- public final void setName( String name )
- {
- mName = name;
- }
-
- //*********************************************************************************************
- //
- // Implement Axis
- //
- //*********************************************************************************************
-
- /**
- * Features may have a name provided e.g. by the driver.
- */
- public String getName()
- {
- return mName;
- }
-
- /**
- * Inform about the resolution of the axis.
- *
- * @return resolution, e.g. 2^-16
- */
- public double getResolution()
- {
- return 1.0/65536.0;
- }
-
-
- /**
- * Retrieve the type of the axis.
- * @return [ TRANSLATION | ROTATION | SLIDER ]
- */
- public int getType()
- {
- return mType;
- }
-
- /** Returns the current value of the axis.
- * The range of the result depends on the axis type.
- *
- * @return value [-1.0,1.0] or [0.0,1.0]
- */
- public double getValue()
- {
- return mCurrentValue;
- }
-
- /** Denote wether this feature has changed beyond it's resolution since it got last
- * updated.
- */
- public boolean hasChanged()
- {
- return true;
- }
-
-}
diff --git a/java/src/de/hardcode/jxinput/virtual/VirtualDriver.java b/java/src/de/hardcode/jxinput/virtual/VirtualDriver.java
deleted file mode 100644
index 5952eff..0000000
--- a/java/src/de/hardcode/jxinput/virtual/VirtualDriver.java
+++ /dev/null
@@ -1,95 +0,0 @@
-//**********************************************************************************************
-// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
-// All rights reserved. Copying, modification,
-// distribution or publication without the prior written
-// consent of the author is prohibited.
-//
-// Created on 9. April 2002, 22:43
-//**********************************************************************************************
-package de.hardcode.jxinput.virtual;
-
-import java.util.ArrayList;
-import de.hardcode.jxinput.Axis;
-
-
-
-/**
- * This is the main worker class for JXVirtualInputDevice.
- *
- * @author Herkules
- */
-class VirtualDriver
-{
-
- private final VirtualAxis[] mVAxes = new VirtualAxis[ Axis.NUMBER_OF_ID ];
-
- /**
- * Creates a new instance of KeyboardDriver.
- */
- VirtualDriver()
- {
- }
-
-
- /**
- * Update features under my control.
- */
- final void update( long deltaT )
- {
- //
- // Delegate the update call to the axes in use.
- //
- for ( int i = 0; i < mVAxes.length; i++ )
- {
- if ( null != mVAxes[ i ] )
- mVAxes[ i ].update( deltaT );
- }
- }
-
-
- /**
- * How many axes are registered?
- */
- final int getNumberOfAxes()
- {
- int ctr = 0;
- for ( int i = 0; i < mVAxes.length; i++ )
- {
- if ( null != mVAxes[ i ] )
- ctr++;
- }
- return ctr;
- }
-
- Axis getAxis(int idx)
- {
- return mVAxes[ idx ];
- }
-
-
- /**
- * Place a new axis under my observation.
- */
- final void registerVirtualAxis( int id, VirtualAxis a )
- {
- mVAxes[ id ] = a;
- }
-
-
- /**
- * Remove an axis from my control.
- */
- final void unregisterVirtualAxis( VirtualAxis a )
- {
- for ( int i = 0; i < mVAxes.length; ++i )
- {
- if ( mVAxes[ i ] == a )
- {
- mVAxes[ i ] = null;
- break;
- }
- }
- }
-
-
-}
diff --git a/java/src/de/hardcode/jxinput/virtual/package.html b/java/src/de/hardcode/jxinput/virtual/package.html
deleted file mode 100644
index d8e1d6a..0000000
--- a/java/src/de/hardcode/jxinput/virtual/package.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-