Cas d'emploi typique : realisation d'un cockpit biplace. Les axes sont partagés sur les different controleurs, ce qui veut dire que les 2 pilotes peuvent controller l'appareil car les joysticks partagent les meme axes X et Y, le simulateur ne voit qu'un seul et unique joystick (T.A.R.G.E.T fait le reste). Cela rends le systeme compatible avec tout les simus du marché.
La priorité va au dernier controlleur qui a été bougé. Il est egalement possible de neutraliser ou reactiver le joystick qu'on ne souhaite pas utiliser
Pour un avion civil, on peut envisager un T-16000 M en position gauche et droite (le stick pouvant etre reglé pour gaucher ou droitiers) et une throttle warthog au centre.
Sur un chasseur biplace, on pourrait cumuler 2 ensemble Warthog (throttle + stick)
Voiçi le code pour 2 sticks de warthog et une throttle :
include "target.tmh"
//add new grip
alias Joystick1; //we create the second joystick name to be able to programm it
int main()
{
Configure(&HCougar, MODE_EXCLUDED);
Configure(&T16000, MODE_EXCLUDED);
Configure(&LMFD, MODE_EXCLUDED);
Configure(&RMFD, MODE_EXCLUDED);
if(Init(&EventHandle)) return 1;
SetKBRate(32, 50);
SetKBLayout(KB_FR);
//lets defines features and button names of the add Joystick1
&Joystick1 = GetIndexJoy(SelectUsbDevice("VID_044F&PID_0402&REV_0100")); // We define (in fact copy) the mapping of Joystick1 we have previsouly created
// axis mapping for joy 0
MapAxis(&Joystick, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Joystick, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
// axis mapping for joy 1
MapAxis(&Joystick1, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Joystick1, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
// axis mapping for throttle
MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapKey(&Joystick, S2, PULSE+'a');
MapKey(&Joystick1, S2, PULSE+'b');
}
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
}