Exemple #1
0
      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
      }
Exemple #2
0
        //this gets called once every refreshRate milliseconds by main program
        public void mainLoop()
        {
            joystick.setAxis(1,controller.Scaled.GearLever,HID_USAGES.HID_USAGE_SL1);
            joystick.setAxis(1,controller.Scaled.AimingX,HID_USAGES.HID_USAGE_X);
			joystick.setAxis(1,controller.TunerDial,HID_USAGES.HID_USAGE_X);
            joystick.setAxis(1,controller.Scaled.AimingY,HID_USAGES.HID_USAGE_Y);
            joystick.setAxis(1,controller.Scaled.RightMiddlePedal,HID_USAGES.HID_USAGE_Z);//throttle
            joystick.setAxis(1,controller.Scaled.RotationLever,HID_USAGES.HID_USAGE_RZ);
            joystick.setAxis(1,controller.Scaled.SightChangeX,HID_USAGES.HID_USAGE_SL0);
            joystick.setAxis(1,controller.Scaled.SightChangeY,HID_USAGES.HID_USAGE_RX);
            joystick.setAxis(1,controller.Scaled.LeftPedal,HID_USAGES.HID_USAGE_RY);

			
            for (int i = 1; i <= vJoyButtons; i++)
            {
                joystick.setButton((bool)controller.GetButtonState(i - 1), (uint)1, (char)(i - 1));
            }
			if(lastControllerDial != controller.TunerDial)
			{
				controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF2, true, 3, SBC.Key.A + controller.TunerDial, true);//last true means if you hold down the button,		
				lastControllerDial = controller.TunerDial;
			}


            joystick.sendUpdate(1);
        }
        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, Microsoft.DirectX.DirectInput.Key.A, true);           //last true means if you hold down the button,
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF1, true, 3, Microsoft.DirectX.DirectInput.Key.B, true);
            controller.AddButtonKeyMapping(ButtonEnum.RightJoyMainWeapon, Microsoft.DirectX.DirectInput.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);


            desiredX = currentX = controller.AimingX;
            desiredY = currentY = controller.AimingY;
        }
        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
        }
        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);
             *      }
             * setting these manually, leaving loop for example*/

            //add simple buttonlight mapping,false = keep light on, i.e. a button that changes states
            //public void AddButtonKeyLightMapping(ButtonEnum button, bool lightOnHold, int intensity, VirtualKeyCode keyCode, bool holdDown)
            controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch, true, 3, VirtualKeyCode.VK_V, true);          //last true means if you hold down the button,
            controller.AddButtonKeyLightMapping(ButtonEnum.Ignition, true, 15, VirtualKeyCode.VK_S, true);             //its the same as holding down the key
            controller.AddButtonKeyLightMapping(ButtonEnum.Start, true, 15, VirtualKeyCode.VK_O, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonMapZoomInOut, true, 3, VirtualKeyCode.VK_R, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomOut, true, 3, VirtualKeyCode.VK_N, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionManipulator, true, 3, VirtualKeyCode.OEM_5, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionLineColorChange, false, 7, VirtualKeyCode.VK_L, true);//false means button changes states
            controller.AddButtonKeyLightMapping(ButtonEnum.Washing, true, 3, VirtualKeyCode.SPACE, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.Extinguisher, true, 3, VirtualKeyCode.VK_F, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.Chaff, true, 3, VirtualKeyCode.VK_P, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionTankDetach, true, 3, VirtualKeyCode.TAB, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionNightScope, false, 7, VirtualKeyCode.VK_A, true);   //false means button changes states
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF1, true, 3, VirtualKeyCode.VK_E, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF3, true, 3, VirtualKeyCode.VK_W, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMain, true, 3, VirtualKeyCode.OEM_6, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConSub, true, 3, VirtualKeyCode.OEM_4, true);

            /*controller.AddButtonKeyLightMapping(ButtonEnum.Comm1, true, 3,
             * controller.AddButtonKeyLightMapping(ButtonEnum.Comm2, true, 3);
             * controller.AddButtonKeyLightMapping(ButtonEnum.Comm3, true, 3);
             * controller.AddButtonKeyLightMapping(ButtonEnum.Comm4, true, 3);
             * controller.AddButtonKeyLightMapping(ButtonEnum.Comm5, true, 3);dealing with these manually*/



            //COMPOUND button light mapping, these use a modifier key, followed by another key
            controller.AddButtonKeyLightMapping(ButtonEnum.Eject, true, 15, VirtualKeyCode.CONTROL, VirtualKeyCode.VK_Z, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonOpenClose, true, 3, VirtualKeyCode.MENU, VirtualKeyCode.VK_C, true);    //MENU is the same as alt
            controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonModeSelect, true, 3, VirtualKeyCode.CONTROL, VirtualKeyCode.VK_Z, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonSubMonitor, true, 7, VirtualKeyCode.SHIFT, VirtualKeyCode.VK_M, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomIn, true, 3, VirtualKeyCode.CONTROL, VirtualKeyCode.VK_N, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionFSS, true, 7, VirtualKeyCode.MENU, VirtualKeyCode.VK_H, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionOverride, true, 3, VirtualKeyCode.SHIFT, VirtualKeyCode.VK_O, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF2, true, 3, VirtualKeyCode.SHIFT, VirtualKeyCode.VK_E, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMagazine, true, 7, VirtualKeyCode.SHIFT, VirtualKeyCode.VK_C, true);

            //simple key mapping, toggles don't have lights
            controller.AddButtonKeyMapping(ButtonEnum.ToggleFilterControl, VirtualKeyCode.OEM_4, true);
            controller.AddButtonKeyMapping(ButtonEnum.ToggleOxygenSupply, VirtualKeyCode.OEM_4, true);
            controller.AddButtonKeyMapping(ButtonEnum.LeftJoySightChange, VirtualKeyCode.NUMPAD0, true);
            controller.AddButtonKeyMapping(ButtonEnum.RightJoyMainWeapon, VirtualKeyCode.DELETE_key, false);                                      //true means send separate keydown/keyup commands
            controller.AddButtonKeyMapping(ButtonEnum.RightJoyFire, VirtualKeyCode.RETURN, false);


            if (inverseThumbStick)
            {
                inverseThumbStickMultiplier = 1;
            }
            else
            {
                inverseThumbStickMultiplier = -1;
            }
        }
        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
        }
Exemple #7
0
        //this gets called once by main program
        public void Initialize()
        {
            controller = new SteelBattalionController();
            controller.Init(refreshRate);

            baseLineIntensity = new int[35];

            // Simple button bindings
            controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConMain, true, maxLightIntensity, SBC.Key.D1, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.WeaponConSub, true, maxLightIntensity, SBC.Key.D2, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.CockpitHatch, true, maxLightIntensity, SBC.Key.Tab, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.Ignition, true, maxLightIntensity, SBC.Key.LeftShift, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.Start, true, maxLightIntensity, SBC.Key.Space, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF1, true, maxLightIntensity, SBC.Key.A, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF2, true, maxLightIntensity, SBC.Key.S, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionF3, true, maxLightIntensity, SBC.Key.D, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionTankDetach, true, maxLightIntensity, SBC.Key.F, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionOverride, true, maxLightIntensity, SBC.Key.G, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionNightScope, true, maxLightIntensity, SBC.Key.H, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionManipulator, true, maxLightIntensity, SBC.Key.Z, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.FunctionLineColorChange, true, maxLightIntensity, SBC.Key.X, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.Washing, true, maxLightIntensity, SBC.Key.Q, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.Extinguisher, true, maxLightIntensity, SBC.Key.R, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.Comm1, true, maxLightIntensity, SBC.Key.Escape, false);
            controller.AddButtonKeyLightMapping(ButtonEnum.Comm5, true, maxLightIntensity, SBC.Key.F11, false);
            // Map every left side button on the monitor block to left alt
            controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonOpenClose, true, maxLightIntensity, SBC.Key.LeftAlt, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonModeSelect, true, maxLightIntensity, SBC.Key.LeftAlt, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomIn, true, maxLightIntensity, SBC.Key.LeftAlt, true);
            // Map every right side button on the monitor block to left ctrl
            controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonMapZoomInOut, true, maxLightIntensity, SBC.Key.LeftControl, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MultiMonSubMonitor, true, maxLightIntensity, SBC.Key.LeftControl, true);
            controller.AddButtonKeyLightMapping(ButtonEnum.MainMonZoomOut, true, maxLightIntensity, SBC.Key.LeftControl, true);

            controller.AddButtonKeyMapping(ButtonEnum.ToggleFilterControl, SBC.Key.LeftAlt, true);
            controller.AddButtonKeyMapping(ButtonEnum.ToggleOxygenSupply, SBC.Key.LeftControl, true);

            controller.AddButtonKeyMapping(ButtonEnum.LeftJoySightChange, SBC.Key.LeftShift, false);

            last_controller_dial = controller.TunerDial;
            saved_gear_lever     = controller.GearLever;

            check_light_toggles();

            joystick = new vJoy();
            acquired = joystick.acquireVJD(1);
            joystick.resetAll();
        }