Game Control Plus API

This page gives an overview of the code needed to use this library in your sketch, you should watch the video guides to get the most out of this library. Although the API is very similar to proCONTROLL the real power comes from using configuration files to abstract the system dependant names, so easying the problems associated with distributing applications.

If you are not interested in distributing your application then you don't have to use a configuration file, instead use the device and input names returned by the OS directly. You can use the Pcp_ShowDevices example to find out the names. You can use these system dependant names alongside the any user defined names from a configuration file. The choice is yours.

Inside the Sketch

The first thing to do is declare some global varials e.g.

// This one is essential
ControlIO control;
// You will need some of the following depending on the sketch.

// A ControlDevice might be a joystick, gamepad, mouse etc.
ControlDevice device;

// A device will have some combination of buttons, hats and sliders
ControlButton button;
ControlHat hat
ControlSlider slider;

Before we do anything with the library we need to create the control object. So in the setup method after the call to size(...) add the following line.

control = ControlIO.getInstance(this);

This will initialise the library by loading the system specific libraries and scanning for connected devices. If we want to use a device then we must discover the device name and the names of the inputs associated with it. You can use the Pcp_ShowDevices example to find out the names. Once we have the names we can get a handle on the device and interogate its inputs.

device = control.getDevice("Logitech Extreme 3D");

If we are using a configuration file then we can ask the library to find a device that has the inputs named in the configuration file with -

device = control.getMatchedDevice(configFilename);

Once we have got the device we can use it to get its inputs e.g.

button = device.getButton("0");
hat = device.getHat("pov");
slider = device.getSlider("x");

Buttons are either pressed or not so this statement returns either true or false.


Hats have a number of values that we can retrieve depending on our needs.


This returns zero if it is in the rest position otherwise it returns the value -

Pos X Y Direction hat is pushed
1 -0.707 -0.707 Up-left
2 0 -1 Up
3 0.707 -0.707 Up-right
4 1 0 Right
5 0.707 0.707 Down-right
6 0 1 Down
7 -0.707 0.707 Down-left
8 -1 0 Left

Alternatively these methods return true if the hat is in the specified direction.


Sliders generally return a floating point number in the range -1.0 to 1.0 inclusive.


The X and Y hat values and the slider values and multiplied by 1.0 (defaualt multiplier) before returnint the value. You can change the multiplier and get the multiplier with -

// Pre multiply the value by 2 before returning it
// Only affects X and Y value for hats
// Get the multipllier value

Sliders at rest should return a value of 0 (zero). As they are analog evices the actual value value is small but rarely zero. This behaviour may not be desirable in which case we can set a tolerance below which any value will be reported as zero.

// Any value in the range -0.1 to 0.1 will be returned as zero
// Get the tolerance

This is just an overview for more detailed information see the reference included with the library.