mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2026-01-18 14:40:28 +01:00
Update to allow hat switches to be in 4 more positions.
This commit is contained in:
parent
7c2ae4030d
commit
c931dd231c
|
|
@ -329,18 +329,34 @@ public interface Axis {
|
|||
* Synonmous with OFF
|
||||
*/
|
||||
public static final float CENTER = OFF;
|
||||
/**
|
||||
* Standard value for up-left HAT position
|
||||
*/
|
||||
public static final float UP_LEFT = 0.125f;
|
||||
/**
|
||||
* Standard value for up HAT position
|
||||
*/
|
||||
public static final float UP = 0.25f;
|
||||
/**
|
||||
* Standard value for up-right HAT position
|
||||
*/
|
||||
public static final float UP_RIGHT = 0.375f;
|
||||
/**
|
||||
* Standard value for right HAT position
|
||||
*/
|
||||
public static final float RIGHT = 0.50f;
|
||||
/**
|
||||
* Standard value for down-right HAT position
|
||||
*/
|
||||
public static final float DOWN_RIGHT = 0.625f;
|
||||
/**
|
||||
* Standard value for down HAT position
|
||||
*/
|
||||
public static final float DOWN = 0.75f;
|
||||
/**
|
||||
* Standard value for down-left HAT position
|
||||
*/
|
||||
public static final float DOWN_LEFT = 0.875f;
|
||||
/**
|
||||
* Standard value for left HAT position
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -105,15 +105,27 @@ class DigitalHatPanel extends AxisPanel {
|
|||
} else if ( data == Axis.POV.UP) {
|
||||
digitalState.setBackground(Color.green);
|
||||
digitalState.setText("UP");
|
||||
} else if ( data == Axis.POV.UP_RIGHT) {
|
||||
digitalState.setBackground(Color.green);
|
||||
digitalState.setText("UP+RIGHT");
|
||||
} else if ( data == Axis.POV.RIGHT) {
|
||||
digitalState.setBackground(Color.green);
|
||||
digitalState.setText("RIGHT");
|
||||
} else if ( data == Axis.POV.DOWN_RIGHT) {
|
||||
digitalState.setBackground(Color.green);
|
||||
digitalState.setText("DOWN+RIGHT");
|
||||
} else if ( data == Axis.POV.DOWN) {
|
||||
digitalState.setBackground(Color.green);
|
||||
digitalState.setText("DOWN");
|
||||
} else if ( data == Axis.POV.DOWN_LEFT) {
|
||||
digitalState.setBackground(Color.green);
|
||||
digitalState.setText("DOWN+LEFT");
|
||||
} else if ( data == Axis.POV.LEFT) {
|
||||
digitalState.setBackground(Color.green);
|
||||
digitalState.setText("LEFT");
|
||||
} else if ( data == Axis.POV.UP_LEFT) {
|
||||
digitalState.setBackground(Color.green);
|
||||
digitalState.setText("UP+LEFT");
|
||||
}else { // shoudl never happen
|
||||
digitalState.setBackground(Color.red);
|
||||
digitalState.setText("ERR:"+data);
|
||||
|
|
|
|||
|
|
@ -155,12 +155,20 @@ class DirectInputAxis extends AbstractAxis {
|
|||
return Axis.POV.OFF;
|
||||
} else if (data == 0.0) {
|
||||
return Axis.POV.UP;
|
||||
} else if (data == 4500) {
|
||||
return Axis.POV.UP_RIGHT;
|
||||
} else if (data == 9000) {
|
||||
return Axis.POV.RIGHT;
|
||||
} else if (data == 13500) {
|
||||
return Axis.POV.DOWN_RIGHT;
|
||||
} else if (data == 18000) {
|
||||
return Axis.POV.DOWN;
|
||||
} else if (data == 22500) {
|
||||
return Axis.POV.DOWN_LEFT;
|
||||
} else if (data == 27000) {
|
||||
return Axis.POV.LEFT;
|
||||
} else if (data == 31500) {
|
||||
return Axis.POV.UP_LEFT;
|
||||
} else {
|
||||
System.err.print("Unexpected value for DX8 HAT: "+data);
|
||||
return Axis.POV.OFF;
|
||||
|
|
|
|||
Loading…
Reference in a new issue