Game Control Plus
1.2.2
|
Public Member Functions | |
boolean | matches (Configuration config) |
String | getName () |
String | getTypeName () |
int | getTypeID () |
String | getPortTypeName () |
String | toString () |
void | update () |
String | toListText (String tab) |
String | toText (String tab) |
String | buttonsToText (String tab) |
String | slidersToText (String tab) |
List< ControlInput > | getInputs () |
int | getNumberOfSliders () |
ControlSlider | getSlider (final int i_sliderNumb) |
ControlSlider | getSlider (final String i_sliderName) |
void | setTolerance (final float i_tolerance) |
int | getNumberOfButtons () |
ControlButton | getButton (final int i_buttonNumb) |
ControlButton | getButton (final String i_buttonName) |
ControlHat | getHat (final int i_hatNumb) |
ControlHat | getHat (final String i_hatName) |
void | open () |
void | close () |
int | getNumberOfRumblers () |
void | rumble (final float i_intensity, final int i_id) |
void | rumble (final float i_intensity) |
void | plug (final Object i_object, final String i_methodName, final int i_eventType, final int i_input) |
void | plug (final String i_methodName, final int i_eventType, final int i_input) |
void | plug (final Object i_object, final String i_methodName, final int i_eventType, final String i_input) |
void | plug (final String i_methodName, final int i_eventType, final String i_input) |
boolean | equals (Object d) |
int | compareTo (ControlDevice d) |
Public Attributes | |
boolean | available = true |
Public Attributes inherited from org.gamecontrolplus.gui.KConstants | |
final float | INPUT_UI_HEIGHT = 24 |
final float | DESC_UI_HEIGHT = 30 |
final float | ELEMENT_UI_GAP = 4 |
final float | INPUT_UI_LENGTH = 220 |
final float | DESC_UI_LENGTH = 300 |
final float | TEXTFIELD_GAP = 4 |
final float | INICATOR_D = 12 |
final float | CONNECTOR_SIZE_R = 10 |
final float | CONNECTOR_SIZE_R2 = CONNECTOR_SIZE_R * CONNECTOR_SIZE_R |
final float | CONNECTOR_SIZE_D = 2 * CONNECTOR_SIZE_R |
final int | INPUT = 0x01 |
final int | DESC = 0x02 |
final float | FONT_SIZE = 12 |
final int | PANEL_WIDTH = 320 |
final int | PANEL_HEIGHT = 280 |
final int | UI_BUTTON = 0x01 |
final int | UI_COOLIEHAT = 0x02 |
final int | UI_SLIDER = 0x03 |
final int | UI_DESCRIPTOR = 0x04 |
final int[] | UI_E_BACK = new int[] { 0, 0xFFFFD0D0, 0xFFD0FFD0, 0xFFD0D0FF, 0xFFFFD0D0 } |
final int | BACKGROUND = 0xFFF0FFF0 |
final int | PANEL = 0xFF208020 |
final int | BORDER = 0xFF4040A0 |
final int | CONNECTION = 0xFF8080A0 |
final int | HIGHLIGHT = 0xFFFF40FF |
final int | NAME_AREA = 0xFFC8C8FF |
final int | CONNECTOR = 0xFFFFC0FF |
final int | TEXTFILL = 0xFF000080 |
final int | PRESSED = 0xFFFF3030 |
final int | RELEASED = 0xFF802020 |
final int | SLIDER_CURSOR = 0xFFFF4040 |
int | WORKING = 0 |
int | CANCELLED = 1 |
int | FINISHED = 2 |
int | NOT_OVER = 0x0000 |
int | OVER_CONNECTOR = 0x0100 |
int | ON_PRESS = 0 |
int | ON_RELEASE = 1 |
int | WHILE_PRESS = 2 |
int | BUTTON_TYPE = 1 |
int | HAT_TYPE = 2 |
int | SLIDER_TYPE = 3 |
String | SEPARATOR = "\t" |
Protected Member Functions | |
void | updateRelative () |
Package Functions | |
ControlDevice (final Controller i_controller, final PApplet i_parent) | |
Private Member Functions | |
void | setupDevice () |
Private Attributes | |
final Controller | controller |
final PApplet | parent |
final List< ControlSlider > | sliders = new ArrayList<ControlSlider>() |
final List< ControlButton > | buttons = new ArrayList<ControlButton>() |
Rumbler[] | rumblers = new Rumbler[0] |
final Map< String, ControlInput > | inputNameMap |
final List< ControlInput > | inputs = new ArrayList<ControlInput>() |
boolean | open = false |
final String | name |
The device class is for the communication with your input devices. A device consists of buttons and sliders, sliders can be grouped to sticks.
To react on button events you can plug methods, that are called when a button is pressed, released or while a button is pressed.
|
package |
Initializes a new device by the given Controller
i_controller |
String org.gamecontrolplus.ControlDevice.buttonsToText | ( | String | tab | ) |
Get a text description of the buttons on this device
tab |
void org.gamecontrolplus.ControlDevice.close | ( | ) |
Use this method to close a device. A closed device does not to be updated to get values.
ControlButton org.gamecontrolplus.ControlDevice.getButton | ( | final int | i_buttonNumb | ) |
Use this method to get a Button based on its position in the list of inputs. Use the buttonsToText method to see what buttons are available for a device.
i_buttonName | int, the number of the button to return |
ControlButton org.gamecontrolplus.ControlDevice.getButton | ( | final String | i_buttonName | ) |
Use this method to get a Button based on its name. The name could be the system-dependent name or the name specified in a device configuration. Use the buttonsToText method to see what buttons are available for a device.
i_buttonName | String, the name of the button to return |
ControlHat org.gamecontrolplus.ControlDevice.getHat | ( | final int | i_hatNumb | ) |
Use this method to get a Hat based on its position in the list of inputs. Use the buttonsToText method to see what hats are available for a device.
i_buttonName | String, the name of the button to return |
ControlHat org.gamecontrolplus.ControlDevice.getHat | ( | final String | i_hatName | ) |
Use this method to get a Hat based on its name. The name could be the system-dependent name or the name specified in a device configuration. Use the buttonsToText method to see what hats are available for a device.
i_hatName | String, the name of the hat to return |
List<ControlInput> org.gamecontrolplus.ControlDevice.getInputs | ( | ) |
Get a list of all inputs for this device
int org.gamecontrolplus.ControlDevice.getNumberOfButtons | ( | ) |
Returns the number of buttons of the device.
int org.gamecontrolplus.ControlDevice.getNumberOfSliders | ( | ) |
Returns the number of sliders of the device.
String org.gamecontrolplus.ControlDevice.getPortTypeName | ( | ) |
Get the name of the connection type e.g. USB, network etc.
ControlSlider org.gamecontrolplus.ControlDevice.getSlider | ( | final int | i_sliderNumb | ) |
Use this method to get a Slider based on its position in the list of inputs. Use printSliders to see what sliders are available for a device.
i_sliderNumb | int, the number of the slider to return |
ControlSlider org.gamecontrolplus.ControlDevice.getSlider | ( | final String | i_sliderName | ) |
Use this method to get a Slider based on its name. The name could be the system-dependent name or the name specified in a device configuration. Use printSliders to see what sliders are available for a device.
i_sliderName | String, the name of the slider to return |
int org.gamecontrolplus.ControlDevice.getTypeID | ( | ) |
Get the name for the type of device e.g. Gamepad, Mouse
String org.gamecontrolplus.ControlDevice.getTypeName | ( | ) |
Get the name for the type of device e.g. Gamepad, Mouse
boolean org.gamecontrolplus.ControlDevice.matches | ( | Configuration | config | ) |
If available will attempt to match this device to the required configuration. If a match occurs then
config |
void org.gamecontrolplus.ControlDevice.open | ( | ) |
Use this method to open a device. A device is automatically opened by default, so you only need to call this when you have closed it with the close method.
void org.gamecontrolplus.ControlDevice.plug | ( | final Object | i_object, |
final String | i_methodName, | ||
final int | i_eventType, | ||
final int | i_input | ||
) |
Plug is a handy method to handle incoming button events. To create a plug you have to implement a method that reacts on the events. To plug a method you need to give a device the method name, the event type you want to react on and the button. If your method is inside a class you have to give the plug a reference to it.
i_object | Object: the object with the method to plug |
i_methodName | String: the name of the method that has to be plugged |
i_eventType | constant: can be ControllIO.ON_PRESS, ControllIO.ON_RELEASE or ControllIO.WHILE_PRESS |
i_input | int: the number of the button that triggers the plug |
void org.gamecontrolplus.ControlDevice.plug | ( | final String | i_methodName, |
final int | i_eventType, | ||
final int | i_input | ||
) |
Plug is a handy method to handle incoming button events. To create a plug you have to implement a method that reacts on the events. To plug a method you need to give a device the method name, the event type you want to react on and the button. If your method is inside a class you have to give the plug a reference to it.
i_methodName | String: the name of the method that has to be plugged |
i_eventType | constant: can be ControllIO.ON_PRESS, ControllIO.ON_RELEASE or ControllIO.WHILE_PRESS |
i_input | int: the number of the button that triggers the plug |
void org.gamecontrolplus.ControlDevice.plug | ( | final Object | i_object, |
final String | i_methodName, | ||
final int | i_eventType, | ||
final String | i_input | ||
) |
Plug is a handy method to handle incoming button events. To create a plug you have to implement a method that reacts on the events. To plug a method you need to give a device the method name, the event type you want to react on and the button. If your method is inside a class you have to give the plug a reference to it.
i_object | Object: the object with the method to plug |
i_methodName | String: the name of the method that has to be plugged |
i_eventType | constant: can be ControllIO.ON_PRESS, ControllIO.ON_RELEASE or ControllIO.WHILE_PRESS |
i_input | String: the name of the button that triggers the plug |
void org.gamecontrolplus.ControlDevice.plug | ( | final String | i_methodName, |
final int | i_eventType, | ||
final String | i_input | ||
) |
Plug is a handy method to handle incoming button events. To create a plug you have to implement a method that reacts on the events. To plug a method you need to give a device the method name, the event type you want to react on and the button. If your method is inside a class you have to give the plug a reference to it.
i_methodName | String: the name of the method that has to be plugged |
i_eventType | constant: can be ControllIO.ON_PRESS, ControllIO.ON_RELEASE or ControllIO.WHILE_PRESS |
i_input | String: the name of the button that triggers the plug |
void org.gamecontrolplus.ControlDevice.setTolerance | ( | final float | i_tolerance | ) |
Tolerance is minimum under which the input is set to zero. Use this method to set the tolerance for all sliders of the device.
i_tolerance | float, the new tolerance for the device |
|
private |
Loads the available Sliders, Sticks and Buttons for a device
String org.gamecontrolplus.ControlDevice.slidersToText | ( | String | tab | ) |
Get a text description of the sliders on this device
tab |
String org.gamecontrolplus.ControlDevice.toListText | ( | String | tab | ) |
Get a short text description for this device
tab |
String org.gamecontrolplus.ControlDevice.toString | ( | ) |
Returns the String representation of a device
String org.gamecontrolplus.ControlDevice.toText | ( | String | tab | ) |
Get a detailed text description for this device
tab |
void org.gamecontrolplus.ControlDevice.update | ( | ) |
This method is called on every thread loop
|
protected |
This method is called before each frame to update the controller values
boolean org.gamecontrolplus.ControlDevice.available = true |
This is used to show the device is available for selection by matching with a configurations file.
|
private |
list containing the buttons on the device
|
private |
The JInput controller instance for this device
|
private |
to map the device generated input names and Controller inputs
|
private |
A List with the buttons and sliders available by the device
|
private |
The name of the device.
|
private |
true if the device has been opened. Only opened devices are updated before a frame.
|
private |
Instance to the PApplet where gcp is running
list containing the rumblers on the device
|
private |
list containing the sliders on the device