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);
        }
Пример #2
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
      }
        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
        }
Пример #4
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();
        }
Пример #5
0
        private void checkvJoyProperties()
        {
            vJoy   joystick = new vJoy();
            string installedVersion;

            // Get the driver attributes (Vendor ID, Product ID, Version Number)
            if (!joystick.isEnabled())
            {
                MessageBox.Show("vJoy driver not enabled: Failed Getting vJoy attributes.\n");
            }
            else
            {
                installedVersion = joystick.getSerialNumberString();
                if (installedVersion != joystick.getCompiledVersionNumber())
                {
                    MessageBox.Show("vJoy version :" + installedVersion + "does not match required version of 2.1.5");
                }
            }
            //Console.WriteLine("Vendor: {0}\nProduct :{1}\nVersion Number:{2}\n", joystick.GetvJoyManufacturerString(), joystick.GetvJoyProductString(), joystick.GetvJoySerialNumberString());


            int a = 1;
        }
Пример #6
0
        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
        }