mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2026-04-05 22:45:50 +00:00
Updated rumblers to be able to get their axis name and axis identifier
This commit is contained in:
parent
a4176e75f8
commit
ec62ee8549
5 changed files with 45 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue