diff options
author | endolf <[email protected]> | 2003-07-23 12:22:55 +0000 |
---|---|---|
committer | endolf <[email protected]> | 2003-07-23 12:22:55 +0000 |
commit | 4e023f726e4cd57a9e58679e92391bc5b9d25f61 (patch) | |
tree | 199d8d05cc5e1e9a99de120b95ea98c32ebf10fc /coreAPI | |
parent | e619c6ef3a393592df20b45e2b40cccee8794d3e (diff) |
Update to allow hat switches to be in 4 more positions.
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@12 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'coreAPI')
-rw-r--r-- | coreAPI/src/java/net/java/games/input/Axis.java | 16 | ||||
-rw-r--r-- | coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java | 12 |
2 files changed, 28 insertions, 0 deletions
diff --git a/coreAPI/src/java/net/java/games/input/Axis.java b/coreAPI/src/java/net/java/games/input/Axis.java index a4abced..438f37f 100644 --- a/coreAPI/src/java/net/java/games/input/Axis.java +++ b/coreAPI/src/java/net/java/games/input/Axis.java @@ -330,17 +330,33 @@ public interface Axis { */ 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 */ diff --git a/coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java b/coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java index 15668bf..9e6d56f 100644 --- a/coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java +++ b/coreAPI/src/java/net/java/games/input/test/ControllerReadTest.java @@ -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); |