Debian Codegraph @

malai-core/org.malai.jinput/src/main/GamePadInspector.java

raw
1 import net.java.games.input.*;
2
3 public class GamePadInspector {
4
5
6 private ControllerEnvironment env;
7
8
9 /**
10 * Constructeur par defaut
11 */
12 public GamePadInspector() {
13 env = ControllerEnvironment.getDefaultEnvironment();
14
15 Controller[] ctrls = env.getControllers();
16
17 for(Controller c : ctrls) {
18 System.out.println("\n=>["+c.getName()+"]");
19 System.out.println(" -> Type : "+c.getType());
20 System.out.println(" -> Port type : "+c.getPortType());
21 System.out.println(" -> Port number : "+c.getPortNumber());
22
23 System.out.println("\n -Controls :");
24 Component[] cpnts = c.getComponents();
25
26 for(Component cp : cpnts) {
27 System.out.println(" -> ["+cp.getName()+"] :");
28 if (cp.getIdentifier() instanceof Component.Identifier.Button)
29 System.out.println(" Identifier : Button "+cp.getIdentifier());
30 else if (cp.getIdentifier() instanceof Component.Identifier.Axis)
31 System.out.println(" Identifier : Axis "+cp.getIdentifier());
32 else
33 System.out.println(" Identifier : Key "+cp.getIdentifier());
34 }
35 }
36 }
37
38
39
40 /**
41 * @param args
42 */
43 public static void main(String[] args) {
44 new GamePadInspector();
45 }
46
47 }