示例#1
0
        private void SeedAxisMap(int deviceAxeCount, ObservableCollection <IHotasBaseMap> buttonMap)
        {
            var foundDevices = 0;

            for (var i = 0; i < JoystickOffsetValues.AxisNames.Length; i++)
            {
                if (!Joystick.IsAxisPresent(JoystickOffsetValues.AxisNames[i]))
                {
                    continue;
                }

                var offset   = JoystickOffsetValues.GetOffset(i);
                var axisType = HOTASButton.ButtonType.AxisLinear;

                if (offset == JoystickOffset.RX ||
                    offset == JoystickOffset.RY ||
                    offset == JoystickOffset.RZ)
                {
                    axisType = HOTASButton.ButtonType.AxisRadial;
                }

                buttonMap.Add(new HOTASAxis()
                {
                    MapId   = (int)offset,
                    Type    = axisType,
                    MapName = $"{JoystickOffsetValues.GetName(offset)}"
                });

                if (++foundDevices >= deviceAxeCount)
                {
                    break;
                }
            }
        }
示例#2
0
        private void SeedButtonMap(JoystickOffset startFrom, int length, HOTASButton.ButtonType type, ObservableCollection <IHotasBaseMap> buttonMap)
        {
            var indexStart = JoystickOffsetValues.GetIndex(startFrom.ToString());

            for (var count = indexStart; count < indexStart + length; count++)
            {
                var offset = JoystickOffsetValues.GetOffset(count);
                buttonMap.Add(new HOTASButton()
                {
                    MapId   = (int)offset,
                    Type    = type,
                    MapName = $"{JoystickOffsetValues.GetName(offset)}"
                });
            }
        }
示例#3
0
        private void SeedPointOfViewMap(JoystickOffset startFrom, int length, HOTASButton.ButtonType type, ObservableCollection <IHotasBaseMap> buttonMap)
        {
            var indexStart = JoystickOffsetValues.GetIndex(startFrom.ToString());

            for (var count = indexStart; count < indexStart + length; count++)
            {
                var offset = JoystickOffsetValues.GetOffset(count);

                //each of the eight POV positions needs a unique offset number so that we don't have to have a compound index to do lookups with later.
                //so POV1 Offset is 0x00000020 and the value of the EAST position = 0x2328, then assign translated offset of 0x23280020
                //so POV2 Offset is 0x00000024 and the value of the SOUTH EAST position = 0x34BC then assign translated offset of 0x34BC0024
                for (uint position = 0; position < 8; position++)
                {
                    var translatedOffset = HOTASQueue.TranslatePointOfViewOffset(offset, 4500 * (int)position);

                    buttonMap.Add(new HOTASButton()
                    {
                        MapId   = (int)translatedOffset,
                        Type    = type,
                        MapName = Enum.GetName(typeof(JoystickOffsetValues.PointOfViewPositionValues), 4500 * position)
                    });
                }
            }
        }