summaryrefslogtreecommitdiffstats
path: root/plugins/DX8/src/java/net
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/DX8/src/java/net')
-rw-r--r--plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java20
-rw-r--r--plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java31
2 files changed, 51 insertions, 0 deletions
diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java b/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java
index f31c66e..993ab93 100644
--- a/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java
+++ b/plugins/DX8/src/java/net/java/games/input/DirectInputDevice.java
@@ -86,6 +86,9 @@ class DirectInputDevice extends AbstractController {
* @see DirectInputAxis for a breakdown of this structure
*/
int[] data = new int[32];
+
+ /** Array list of rumblers */
+ private ArrayList rumblerList = new ArrayList();
/**
* Private constructor
@@ -150,6 +153,16 @@ class DirectInputDevice extends AbstractController {
list.add(DirectInputAxis.createAxis(this, id, didft, name));
}
+ /**
+ * Callback called by enumDevice to add a rumbler
+ *
+ * @param effect the natie effect id
+ * @param axisID The axis ID
+ */
+ private void addRumbler(long effect, Axis.Identifier axisID) {
+ rumblerList.add(new DirectInputRumbler(this, effect, axisID));
+ }
+
/** Polls axes for data. Returns false if the controller is no longer valid.
* Polling reflects the current state of the device when polled, and is
* unbuffered.
@@ -175,6 +188,13 @@ class DirectInputDevice extends AbstractController {
}
/**
+ * Returns the rumbler array
+ */
+ public Rumbler[] getRumblers() {
+ return (Rumbler[]) rumblerList.toArray(new Rumbler[0]);
+ }
+
+ /**
* Polls the device; native method. The data from the poll is stored in
* the data array.
*/
diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java b/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java
new file mode 100644
index 0000000..de04724
--- /dev/null
+++ b/plugins/DX8/src/java/net/java/games/input/DirectInputRumbler.java
@@ -0,0 +1,31 @@
+/*
+ * DirectInputRumbler.java
+ *
+ * Created on 01 December 2003, 21:39
+ */
+
+package net.java.games.input;
+
+/**
+ *
+ * @author Jeremy
+ */
+public class DirectInputRumbler implements net.java.games.input.Rumbler {
+
+ private DirectInputDevice device;
+ private long effect;
+ private Axis.Identifier axisID;
+
+ /** Creates a new instance of DirectInputRumbler */
+ public DirectInputRumbler(DirectInputDevice device, long effect, Axis.Identifier axisID) {
+ this.device = device;
+ this.effect = effect;
+ this.axisID = axisID;
+ }
+
+ public void rumble(float intensity) {
+ setRumble(effect, intensity);
+ }
+
+ private native void setRumble(long effect, float intensity);
+}