Exemple #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;
                }
            }
        }
Exemple #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)}"
                });
            }
        }