const int refreshRate = 50;//number of milliseconds between call to mainLoop //this gets called once by main program public void Initialize() { int baseLineIntensity = 1; //just an average value for LED intensity int emergencyLightIntensity = 15; //for stuff like eject,cockpit Hatch,Ignition, and Start controller = new SteelBattalionController(); controller.Init(50);//50 is refresh rate in milliseconds //set all buttons by default to light up only when you press them down for (int i = 4; i < 4 + 30; i++) { if (i != (int)ButtonEnum.Eject)//excluding eject since we are going to flash that one { controller.AddButtonLightMapping((ButtonEnum)(i - 1), (ControllerLEDEnum)(i), true, baseLineIntensity); } } /* * controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch, true, 3, SBC.Key.A, true);//last true means if you hold down the button, * controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF1, true, 3, SBC.Key.B, true); * controller.AddButtonKeyMapping(ButtonEnum.RightJoyMainWeapon, SBC.Key.C, true);*/ joystick = new vJoy(); acquired = joystick.acquireVJD(1); joystick.resetAll();//have to reset before we use it joystick.setAxis(1, 32768 / 2, HID_USAGES.HID_USAGE_SL1); joystick.setAxis(1, 32768 / 2, HID_USAGES.HID_USAGE_X); joystick.setAxis(1, 32768 / 2, HID_USAGES.HID_USAGE_Y); joystick.setAxis(1, 32768 / 2, HID_USAGES.HID_USAGE_Z);//throttle joystick.setAxis(1, 32768 / 2, HID_USAGES.HID_USAGE_RZ); joystick.setAxis(1, 32768 / 2, HID_USAGES.HID_USAGE_SL0); joystick.setAxis(1, 32768 / 2, HID_USAGES.HID_USAGE_RX); joystick.setAxis(1, 32768 / 2, HID_USAGES.HID_USAGE_RY); }
const int refreshRate = 50; //number of milliseconds between call to mainLoop //this gets called once by main program public void Initialize() { int baseLineIntensity = 1; //just an average value for LED intensity int emergencyLightIntensity = 15; //for stuff like eject,cockpit Hatch,Ignition, and Start controller = new SteelBattalionController(); controller.Init(50); //50 is refresh rate in milliseconds //set all buttons by default to light up only when you press them down for (int i = 4; i < 4 + 30; i++) { if (i != (int)ButtonEnum.Eject) //excluding eject since we are going to flash that one { controller.AddButtonLightMapping((ButtonEnum)(i - 1), (ControllerLEDEnum)(i), true, baseLineIntensity); } } controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch, true, 3, SBC.Key.A, true); //last true means if you hold down the button, //no longer using Microsoft.DirectX.DirectInput but included this in here to show that I made //code backwards compatible controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF1, true, 3, Microsoft.DirectX.DirectInput.Key.Delete, true); controller.AddButtonKeyMapping(ButtonEnum.RightJoyMainWeapon, SBC.Key.C, true); joystick = new vJoy(); acquired = joystick.acquireVJD(1); joystick.resetAll(); //have to reset before we use it }
const int refreshRate = 30; // Number of milliseconds between call to mainLoop // This gets called once by main program public void Initialize() { int baseLineIntensity = 3; // Just an average value for LED intensity int emergencyLightIntensity = 15; // For stuff like eject,cockpit Hatch,Ignition, and Start controller = new SteelBattalionController(); controller.Init(50); // 50 is refresh rate in milliseconds //set all buttons by default to light up only when you press them down for (int i = 4; i < 4 + 30; i++) { if (i != (int)ButtonEnum.Eject) // Excluding eject since we are going to flash that one { controller.AddButtonLightMapping((ButtonEnum)(i - 1), (ControllerLEDEnum)(i), true, baseLineIntensity); } } // Button Bindings controller.AddButtonKeyMapping(ButtonEnum.RightJoyMainFire, Microsoft.DirectX.DirectInput.Key.R, true); controller.AddButtonKeyMapping(ButtonEnum.RightJoyMainWeapon, Microsoft.DirectX.DirectInput.Key.D2, true); controller.AddButtonKeyMapping(ButtonEnum.RightJoyLockOn, Microsoft.DirectX.DirectInput.Key.R, true); controller.AddButtonKeyLightMapping(ButtonEnum.Eject, true, 3, Microsoft.DirectX.DirectInput.Key.O, true); controller.AddButtonKeyLightMapping(ButtonEnum.Ignition, true, 3, Microsoft.DirectX.DirectInput.Key.P, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Start, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonOpenClose, true, 3, Microsoft.DirectX.DirectInput.Key.B, true); controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonMapZoomInOut, true, 3, Microsoft.DirectX.DirectInput.Key.B, true); //controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonModeSelect, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonSubMonitor, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomIn, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true); controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomOut, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionFSS, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionManipulator, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionLineColorChange, true, 3, Microsoft.DirectX.DirectInput.Key.H, true); controller.AddButtonKeyLightMapping(ButtonEnum.Washing, true, 3, Microsoft.DirectX.DirectInput.Key.C, true); controller.AddButtonKeyLightMapping(ButtonEnum.Extinguisher, true, 3, Microsoft.DirectX.DirectInput.Key.O, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Chaff, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionTankDetach, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionOverride, true, 3, Microsoft.DirectX.DirectInput.Key.O, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionNightScope, true, 3, Microsoft.DirectX.DirectInput.Key.N, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF1, true, 3, Microsoft.DirectX.DirectInput.Key.Tab, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF2, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF3, true, 4, Microsoft.DirectX.DirectInput.Key.LeftControl, true); controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMain, true, 3, Microsoft.DirectX.DirectInput.Key.RightControl, true); controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConSub, true, 3, Microsoft.DirectX.DirectInput.Key.BackSpace, true); //controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMagazine, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.Comm1, true, 3, Microsoft.DirectX.DirectInput.Key.F6, true); controller.AddButtonKeyLightMapping(ButtonEnum.Comm2, true, 3, Microsoft.DirectX.DirectInput.Key.F8, true); controller.AddButtonKeyLightMapping(ButtonEnum.Comm3, true, 3, Microsoft.DirectX.DirectInput.Key.F9, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Comm4, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); controller.AddButtonKeyLightMapping(ButtonEnum.Comm5, true, 3, Microsoft.DirectX.DirectInput.Key.RightBracket, true); controller.AddButtonKeyMapping(ButtonEnum.LeftJoySightChange, Microsoft.DirectX.DirectInput.Key.Z, true); joystick = new vJoy(); acquired = joystick.acquireVJD(1); joystick.resetAll(); //have to reset before we use it }
int peddleLoop = 0; //used to stop resting peddle loop // This gets called once by main program public void Initialize() { int baseLineIntensity = 3; // Just an average value for LED intensity int emergencyLightIntensity = 15; // For stuff like eject,cockpit Hatch,Ignition, and Start controller = new SteelBattalionController(); controller.Init(50); // 50 is refresh rate in milliseconds //set all buttons by default to light up only when you press them down for (int i = 4; i < 4 + 30; i++) { if (i != (int)ButtonEnum.Eject) // Excluding eject since we are going to flash that one { controller.AddButtonLightMapping((ButtonEnum)(i - 1), (ControllerLEDEnum)(i), true, baseLineIntensity); } } //this is an example 1st parameter 2nd 3rd 4th //controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch, true, 3, Microsoft.DirectX.DirectInput.Key.A, true); //First variable defines which key on the SteelBatallionController you want to affect. //The second parameter controls state change. if you change the parameter from true to false, then the button becomes a statebutton, useful for modes such as nightvision where you press the button to toggle the state. //The third parameter controls the light intensity, any value from 1 - 15 is acceptable. //The fourth variable for AddButtonKeyLightMapping controls whether or not the button is held down when you press it. If changed to "false" the button will press only one time even if you hold it down. //In order to define what key you want the button to press you need to know the DirectX.DirectInput key enumerations, they are available here:http://msdn.microsoft.com/en-us/library/windows/desktop/bb321074(v=vs.85).aspx //Button Bindings //controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch, true, 3, Microsoft.DirectX.DirectInput.Key.A, true); //controller.AddButtonKeyLightMapping(ButtonEnum.RightJoyLockOn, true, 3, Microsoft.DirectX.DirectInput.Key.R, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Eject, true, 3, Microsoft.DirectX.DirectInput.Key.O, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Ignition, true, 3, Microsoft.DirectX.DirectInput.Key.P, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Start, true, 15, Microsoft.DirectX.DirectInput.Key.S, true); //startup toggle // controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonOpenClose, false, 3, Microsoft.DirectX.DirectInput.Key.LeftControl, Microsoft.DirectX.DirectInput.Key.R, true); // not working, nothing sent to game controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF1, false, 3, Microsoft.DirectX.DirectInput.Key.LeftShift, Microsoft.DirectX.DirectInput.Key.F, false); // not working, nothing sent to game //controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonMapZoomInOut, true, 3, Microsoft.DirectX.DirectInput.Key.B, true); //controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonModeSelect, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonSubMonitor, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomIn, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true); //controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomOut, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionFSS, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionManipulator, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionLineColorChange, false, 3, Microsoft.DirectX.DirectInput.Key.H, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Washing, true, 3, Microsoft.DirectX.DirectInput.Key.C, true); controller.AddButtonKeyLightMapping(ButtonEnum.Extinguisher, true, 3, Microsoft.DirectX.DirectInput.Key.F, false); //controller.AddButtonKeyLightMapping(ButtonEnum.Chaff, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionTankDetach, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionOverride, true, 3, Microsoft.DirectX.DirectInput.Key.O, true); // controller.AddButtonKeyLightMapping(ButtonEnum.FunctionNightScope, false, 3, Microsoft.DirectX.DirectInput.Key.A, true); //light amplification toggle //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF2, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF3, true, 3, Microsoft.DirectX.DirectInput.Key.LeftControl, true); // controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMain, true, 3, Microsoft.DirectX.DirectInput.Key.Z, true); //controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConSub, true, 3, Microsoft.DirectX.DirectInput.Key.BackSpace, true); //controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMagazine, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Comm1, true, 3, Microsoft.DirectX.DirectInput.Key.F6, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Comm2, true, 3, Microsoft.DirectX.DirectInput.Key.F8, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Comm3, true, 3, Microsoft.DirectX.DirectInput.Key.F9, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Comm4, true, 3, Microsoft.DirectX.DirectInput.Key.X, true); //controller.AddButtonKeyLightMapping(ButtonEnum.Comm5, true, 3, Microsoft.DirectX.DirectInput.Key.RightBracket, true); //controller.AddButtonKeyMapping(ButtonEnum.LeftJoySightChange, Microsoft.DirectX.DirectInput.Key.Z, true); //controller.AddButtonKeyMapping(ButtonEnum.RightJoyMainWeapon, Microsoft.DirectX.DirectInput.Key.D6, Microsoft.DirectX.DirectInput.Key.D5, true); joystick = new vJoy(); acquired = joystick.acquireVJD(1); joystick.resetAll(); //have to reset before we use it }