示例#1
0
 public static void Initialize()
 {
     for (var i = 0; i < MAX_GAMEPADS; i++)
     {
         OpenTKGamePad.GetState(i);                                                // not sure if this is important to do at this time, but the processing which used to be done here included calls to OpenTK, so I left this no-op just in case --yoshi
     }
     initialized = true;
 }
示例#2
0
        public void Update()
        {
            // update both here just in case
            var tmpState = OpenTKGamePad.GetState(_deviceIndex);

            DebugState(tmpState);
            state = tmpState;
            var tmpJstate = Joystick.GetState(_deviceIndex);

            DebugState(tmpJstate);
            jState = tmpJstate;
        }
示例#3
0
        /// <remarks>Initialization is only called once when MainForm loads</remarks>
        public static void Initialize()
        {
            CloseAll();
            var playerCount = 0;

            for (var i = 0; i < MAX_GAMEPADS; i++)
            {
                if (OpenTKGamePad.GetState(i).IsConnected || Joystick.GetState(i).IsConnected)
                {
                    Console.WriteLine($"OTK GamePad/Joystick index: {i}");
                    Devices.Add(new OTK_GamePad(i, ++playerCount));
                }
            }
        }
示例#4
0
        private OTK_GamePad(int index, int playerIndex)
        {
            _deviceIndex = index;
            _playerIndex = playerIndex;

            if (Joystick.GetState(_deviceIndex).IsConnected)
            {
                Guid                  = Joystick.GetGuid(_deviceIndex);
                _guidObtained         = true;
                _joystickCapabilities = Joystick.GetCapabilities(_deviceIndex);
            }
            else
            {
                Guid          = Guid.NewGuid();
                _guidObtained = false;
            }

            if (OpenTKGamePad.GetState(_deviceIndex).IsConnected)
            {
                _name = OpenTKGamePad.GetName(_deviceIndex);
                _gamePadCapabilities = OpenTKGamePad.GetCapabilities(_deviceIndex);
            }
            else
            {
                _name = "OTK GamePad Undetermined Name";
            }

            InputNamePrefix = $"{(MappedGamePad ? "X" : "J")}{_playerIndex} ";

            Update();

            Console.WriteLine($"Initialising OpenTK GamePad: {Guid}");
            Console.WriteLine($"OpenTK Mapping: {_name}");

            InitializeMappings();
        }
示例#5
0
 public static List <Buttons> GetPressedDPadButtons(int controllerIndex)
 {
     return(GetPressedDPadButtons(OTKGamePad.GetState(controllerIndex)));
 }