aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/OSX/src/java
diff options
context:
space:
mode:
authorgregorypierce <[email protected]>2003-08-07 21:57:08 +0000
committergregorypierce <[email protected]>2003-08-07 21:57:08 +0000
commitbacc9bbd213bd1455a489dd90bdf5034775aa10c (patch)
tree314bec5a1fa937b0e96650d4f8ef725f3632d73e /plugins/OSX/src/java
parent099f3acc0e35dbc83a5f33f5647fa19aea0bd2bd (diff)
no message
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@41 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins/OSX/src/java')
-rwxr-xr-xplugins/OSX/src/java/net/java/games/input/OSXEnvironmentPlugin.java42
-rw-r--r--plugins/OSX/src/java/net/java/games/input/OSXMouse.java32
2 files changed, 30 insertions, 44 deletions
diff --git a/plugins/OSX/src/java/net/java/games/input/OSXEnvironmentPlugin.java b/plugins/OSX/src/java/net/java/games/input/OSXEnvironmentPlugin.java
index 8f6e5c8..a39e04b 100755
--- a/plugins/OSX/src/java/net/java/games/input/OSXEnvironmentPlugin.java
+++ b/plugins/OSX/src/java/net/java/games/input/OSXEnvironmentPlugin.java
@@ -53,21 +53,7 @@ import net.java.games.util.plugins.Plugin;
*/
public class OSXEnvironmentPlugin extends ControllerEnvironment implements Plugin
{
- static
- {
- System.loadLibrary("jinput");
- }
-
- public native void hidCreate();
- public native void hidDispose();
- public native void enumDevices();
- /**
- * Opens an input device and returns the address of the input queue for that device
- */
- public native long openDevice( long lpDevice, int queueDepth );
- public native void closeDevice( long lpDevice, long lpInputQueue );
- public native void pollDevice( long lpInputQueue );
public static final int HID_DEVICE_MOUSE = 0x02;
public static final int HID_DEVICE_JOYSTICK = 0x04;
@@ -125,6 +111,34 @@ public class OSXEnvironmentPlugin extends ControllerEnvironment implements Plugi
public static final int HID_ELEMENTTYPE_COLLECTION = 513;
+ static
+ {
+ System.loadLibrary("jinput");
+ }
+
+ public native void hidCreate();
+ public native void hidDispose();
+ public native void enumDevices();
+
+ /**
+ * Opens an input device and returns the address of the input queue for that device
+ */
+ public native long openDevice( long lpDevice, int queueDepth );
+ public native void closeDevice( long lpDevice, long lpQueue );
+
+
+ /**
+ * Polls a device and returns the element top most on the input queue. The elements that
+ * are returned are only those that have had their hidCookies registered with registerDeviceElement.
+ * @param lpQueue
+ * @return
+ */
+ public native int pollDevice( long lpQueue );
+ public native int pollElement( long lpDevice, long hidCookie );
+ public native void registerDeviceElement( long lpQueue, long hidCookie );
+ public native void deregisterDeviceElement( long lpQueue, long hidCookie );
+
+
private HashMap devices = new HashMap();
diff --git a/plugins/OSX/src/java/net/java/games/input/OSXMouse.java b/plugins/OSX/src/java/net/java/games/input/OSXMouse.java
index 0c1fe1a..31e683e 100644
--- a/plugins/OSX/src/java/net/java/games/input/OSXMouse.java
+++ b/plugins/OSX/src/java/net/java/games/input/OSXMouse.java
@@ -181,18 +181,7 @@ public class OSXMouse extends Mouse implements InputController
*/
public float getPollData()
{
-/* // Mouse button
- byte data = mouseData[index];
- if ((data & 0x80) != 0)
- {
- return 1.0f;
- }
- else
- {
- return 0.0f;
- }*/
-
- return 0.0f;
+ return (float) plugin.pollElement( lpDevice, hidCookie );
}
/** Returns <code>true</code> if data returned from <code>poll</code>
@@ -237,24 +226,7 @@ public class OSXMouse extends Mouse implements InputController
*/
public float getPollData()
{
-/* int data = ((int) mouseData[index] << 12) |
- ((int) mouseData[index + 1] << 8) |
- ((int) mouseData[index + 2] << 4) |
- ((int) mouseData[index + 3]);
- if (data == -1)
- {
- return -1.0f;
- }
- else if (data >= 1)
- {
- return 1.0f;
- }
- else
- {
- return 0.0f;
- }*/
-
- return 0.0f;
+ return (float) plugin.pollElement( lpDevice, hidCookie );
}
/** Returns <code>true</code> if data returned from <code>poll</code>