mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2026-01-04 15:59:57 +01:00
Initial rumbler test support
This commit is contained in:
parent
28f05a7e9d
commit
f4c4499bf3
|
|
@ -85,6 +85,19 @@
|
|||
<!-- <arg file="myfile.txt"/> -->
|
||||
</java>
|
||||
</target>
|
||||
<target name="rumbletest" depends="init,all" description="Try running it.">
|
||||
<java classname="net.java.games.input.test.RumbleTest"
|
||||
fork="true" failonerror="true" dir="src/tests">
|
||||
<classpath>
|
||||
<pathelement location="bin/jinput.jar"/>
|
||||
<pathelement location="${utils}"/>
|
||||
</classpath>
|
||||
<!-- Pass some args, perhaps: -->
|
||||
<!-- <arg value="-myfile"/> -->
|
||||
<!-- Will be given as an absolute path: -->
|
||||
<!-- <arg file="myfile.txt"/> -->
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="javadoc" depends="init" description="Javadoc for my API.">
|
||||
<javadoc packagenames="net.java.games.input.*"
|
||||
|
|
|
|||
56
coreAPI/src/java/net/java/games/input/test/RumbleTest.java
Normal file
56
coreAPI/src/java/net/java/games/input/test/RumbleTest.java
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* RumbleTest.java
|
||||
*
|
||||
* Created on 01 December 2003, 23:02
|
||||
*/
|
||||
package net.java.games.input.test;
|
||||
|
||||
import net.java.games.input.ControllerEnvironment;
|
||||
import net.java.games.input.Controller;
|
||||
import net.java.games.input.Rumbler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jeremy
|
||||
*/
|
||||
public class RumbleTest {
|
||||
|
||||
/** Creates a new instance of RumbleTest */
|
||||
public RumbleTest() {
|
||||
ControllerEnvironment ca = ControllerEnvironment.getDefaultEnvironment();
|
||||
Controller[] controllers = ca.getControllers();
|
||||
for(int i=0;i<controllers.length;i++) {
|
||||
System.out.println("Scanning " + controllers[i].getName());
|
||||
Rumbler[] rumblers = controllers[i].getRumblers();
|
||||
System.out.println("Found " + rumblers.length + " rumblers");
|
||||
for(int j=0;j<rumblers.length;j++) {
|
||||
System.out.println("Rumbling with intensity: " + 0.5f);
|
||||
rumblers[j].rumble(0.5f);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
System.out.println("Rumbling with intensity: " + 1.0f);
|
||||
rumblers[j].rumble(1f);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
System.out.println("Rumbling with intensity: " + 0.0f);
|
||||
rumblers[j].rumble(0f);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new RumbleTest();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue