blob: d739b6c8d6023ed68a9b561e407b64f6ddab1533 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
package net.java.games.input;
/**
* Created by IntelliJ IDEA.
* User: gpierce
* Date: Aug 2, 2003
* Time: 3:59:09 PM
* To change this template use Options | File Templates.
*/
public class OSXGamepad extends AbstractController implements InputController
{
private OSXEnvironmentPlugin plugin;
private long lpDevice;
private long lpQueue;
public OSXGamepad( OSXEnvironmentPlugin plugin, long lpDevice, String productName )
{
super( productName );
this.plugin = plugin;
this.lpDevice = lpDevice;
openDevice();
}
public boolean poll()
{
plugin.pollDevice( lpQueue );
return true;
}
public void openDevice()
{
this.lpQueue = plugin.openDevice( this.lpDevice, 32 );
}
public void closeDevice()
{
plugin.closeDevice( this.lpDevice, this.lpQueue );
}
public void pollDevice()
{
plugin.pollDevice( this.lpQueue );
}
public void addControllerElement(InputControllerElement element)
{
switch ( element.getElementType() )
{
case OSXEnvironmentPlugin.HID_ELEMENTTYPE_INPUT_MISC:
System.out.println("*Adding misc component");
break;
case OSXEnvironmentPlugin.HID_ELEMENTTYPE_INPUT_BUTTON:
System.out.println("*Adding button");
break;
case OSXEnvironmentPlugin.HID_ELEMENTTYPE_INPUT_AXIS:
System.out.println("*Adding axis");
break;
case OSXEnvironmentPlugin.HID_ELEMENTTYPE_INPUT_SCANCODES:
System.out.println("*Adding scancode");
break;
case OSXEnvironmentPlugin.HID_ELEMENTTYPE_OUTPUT:
System.out.println("*Adding forcefeedback");
break;
case OSXEnvironmentPlugin.HID_ELEMENTTYPE_FEATURE:
System.out.println("*Adding feature");
break;
case OSXEnvironmentPlugin.HID_ELEMENTTYPE_COLLECTION:
System.out.println("*Adding collection");
break;
}
}
}
|