Exemplo n.º 1
0
 public void Reset()
 {
     this.buttons = new ButtonStates();
 }
Exemplo n.º 2
0
 private void ProcessInputForMap(HidInputReport report, HIDButtonMap buttonMap, ref ButtonStates newState)
 {
     foreach (var mappingItem in buttonMap)
     {
         HIDMapping mapping = mappingItem.Value;
         if (mapping.IsNumeric)
         {
             HidNumericControl control = report.GetNumericControl(mapping.UsagePage, mapping.UsageId);
             ushort            value   = (ushort)control.Value;
             if (!this.CheckDeadzone(control.ControlDescription, control))
             {
                 continue;
             }
             if (mapping.UsagePage == 0x01 && mapping.UsageId == 0x39)
             {
                 // dpad
                 if ((mapping.Direction == DPadDirection.Down && value >= 3 && value <= 5) ||
                     (mapping.Direction == DPadDirection.Left && value >= 5 && value <= 7) ||
                     (mapping.Direction == DPadDirection.Up && (value == 7 || value == 0 || value == 1)) ||
                     (mapping.Direction == DPadDirection.Right && value >= 1 && value <= 3)
                     )
                 {
                     this.setButtonState(mappingItem.Key, ref newState);
                 }
             }
             else
             {
                 // axis
                 ushort center = NumericCenters[mapping.UsagePage];
                 if ((value < center && mapping.Sign < 0) ||
                     (value > center && mapping.Sign > 0))
                 {
                     this.setButtonState(mappingItem.Key, ref newState);
                 }
             }
         }
         else
         {
             HidBooleanControl control = report.GetBooleanControl(mapping.UsagePage, mapping.UsageId);
             if (control.IsActive)
             {
                 this.setButtonState(mappingItem.Key, ref newState);
             }
         }
     }
 }
Exemplo n.º 3
0
 public ControllerState()
 {
     this.buttons = default(ButtonStates);
 }