public void ProcessJoystickEvent(JoyAxisEvent ev)
 {
     int id = ev.Which;
     if (IsJoystickInstanceValid(id))
     {
         int index = sdl_instanceid_to_joysticks[id];
         JoystickDevice<Sdl2JoystickDetails> joystick = (JoystickDevice<Sdl2JoystickDetails>)joysticks[index];
         float value = ev.Value * RangeMultiplier;
         joystick.SetAxis(ev.Axis, value);
         joystick.Details.PacketNumber = Math.Max(0, unchecked(joystick.Details.PacketNumber + 1));
     }
     else
     {
         Debug.Print("[SDL2] Invalid joystick id {0} in {1}", id, ev.Type);
     }
 }
Beispiel #2
0
 public void ProcessJoystickEvent(JoyAxisEvent ev)
 {
     int id = ev.Which;
     if (IsJoystickInstanceValid(id))
     {
         int index = sdl_instanceid_to_joysticks[id];
         JoystickDevice<Sdl2JoystickDetails> joystick = (JoystickDevice<Sdl2JoystickDetails>)joysticks[index];
         float value = ev.Value * RangeMultiplier;
         joystick.SetAxis((JoystickAxis)ev.Axis, value);
         joystick.Details.PacketNumber = Math.Max(0, unchecked(joystick.Details.PacketNumber + 1));
     }
     else
     {
         Debug.Print("[SDL2] Invalid joystick id {0} in {1}", id, ev.Type);
     }
 }