aboutsummaryrefslogtreecommitdiffstats
path: root/coreAPI
diff options
context:
space:
mode:
authorendolf <[email protected]>2003-12-02 18:55:13 +0000
committerendolf <[email protected]>2003-12-02 18:55:13 +0000
commit08739c125094ad6cb42cf466772994576896fa49 (patch)
tree6e4e08e2077a51235e99fba692b35982a6064845 /coreAPI
parentc6a3dffe69834c25788c7dcef5e61360cb93e3c3 (diff)
Updated rumblers to be able to get their axis name and axis identifier
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@64 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'coreAPI')
-rw-r--r--coreAPI/src/java/net/java/games/input/Rumbler.java15
-rw-r--r--coreAPI/src/java/net/java/games/input/test/RumbleTest.java15
2 files changed, 30 insertions, 0 deletions
diff --git a/coreAPI/src/java/net/java/games/input/Rumbler.java b/coreAPI/src/java/net/java/games/input/Rumbler.java
index 2d4c8b8..9da084b 100644
--- a/coreAPI/src/java/net/java/games/input/Rumbler.java
+++ b/coreAPI/src/java/net/java/games/input/Rumbler.java
@@ -49,4 +49,19 @@ public interface Rumbler {
*/
public abstract void rumble(float intensity);
+ /**
+ * Get the string name of the axis the rumbler is attached to
+ *
+ * @return The axis name
+ */
+ public String getAxisName();
+
+ /**
+ * Get the axis identifier the rumbler is attached to
+ *
+ * @return The axis identifier
+ */
+ public Axis.Identifier getAxisIdentifier();
+
+
} // interface Rumbler
diff --git a/coreAPI/src/java/net/java/games/input/test/RumbleTest.java b/coreAPI/src/java/net/java/games/input/test/RumbleTest.java
index 706485b..64fe204 100644
--- a/coreAPI/src/java/net/java/games/input/test/RumbleTest.java
+++ b/coreAPI/src/java/net/java/games/input/test/RumbleTest.java
@@ -24,6 +24,7 @@ public class RumbleTest {
Rumbler[] rumblers = controllers[i].getRumblers();
System.out.println("Found " + rumblers.length + " rumblers");
for(int j=0;j<rumblers.length;j++) {
+ System.out.println("Rumbler " + rumblers[j].getAxisName() + " on axis " + rumblers[j].getAxisIdentifier().getName());
System.out.println("Rumbling with intensity: " + 0.5f);
rumblers[j].rumble(0.5f);
try {
@@ -36,6 +37,20 @@ public class RumbleTest {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
+ System.out.println("Fading rumble to -1");
+ for(float k=1.0f;k>-1.0f;) {
+ long startTime = System.currentTimeMillis();
+ rumblers[j].rumble(k);
+ try {
+ Thread.sleep(1);
+ } catch (InterruptedException e) {
+ }
+ k-=((float)(System.currentTimeMillis() - startTime))/1000f;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ }
System.out.println("Rumbling with intensity: " + 0.0f);
rumblers[j].rumble(0f);
try {