コード例 #1
0
ファイル: Input.cs プロジェクト: Tankooni/shoe-polish
        /// <summary>
        /// Called by Engine to update the input.
        /// </summary>
        internal static void Update()
        {
            if (!FP.Screen.IsOpen())
            {
                return;
            }

            keys.Cycle();
            mouseButtons.Cycle();

            _mouseWheelDelta = 0;

            var convertedCoords = FP.Screen.MapPixelToCoords(Mouse.GetPosition(FP.Screen));

            _mousePos.X = convertedCoords.X;
            _mousePos.Y = convertedCoords.Y;

            if (firstJoystickCheck > 0)
            {
                firstJoystickCheck--;
                if (firstJoystickCheck == 0)
                {
                    for (uint i = 0; i < Joystick.Count; ++i)
                    {
                        if (Joystick.IsConnected(i))
                        {
                            var e = new JoystickConnectEvent();
                            e.JoystickId = i;

                            ControllerConnected(FP.Screen, new JoystickConnectEventArgs(e));
                        }
                    }
                }
            }

            Joystick.Update();
            Controller.UpdateAll();

            //	TODO:	cursor style
        }
コード例 #2
0
ファイル: EventArgs.cs プロジェクト: eickegao/Blazera
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the joystick connect arguments from a joystick connect event
 /// </summary>
 /// <param name="e">Joystick button event</param>
 ////////////////////////////////////////////////////////////
 public JoystickConnectEventArgs(JoystickConnectEvent e)
 {
     JoystickId = e.JoystickId;
 }