RemappingButtonCategory Enumeration

Definition

Arten von Gamepad-Neuzuordnungen.

public enum class RemappingButtonCategory
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Gaming.Input.GamingInputPreviewContract, 131072)]
enum class RemappingButtonCategory
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Gaming.Input.GamingInputPreviewContract), 131072)]
public enum RemappingButtonCategory
var value = Windows.Gaming.Input.Preview.RemappingButtonCategory.buttonSettings
Public Enum RemappingButtonCategory
Vererbung
RemappingButtonCategory
Attribute

Windows-Anforderungen

Gerätefamilie
Windows Desktop Extension SDK (eingeführt in 10.0.23665.0)
API contract
Windows.Gaming.Input.GamingInputPreviewContract (eingeführt in v2.0)

Felder

AnalogSettings 1

Wird zum Austauschen analoger Steuerelemente verwendet.

ButtonSettings 0

Wird verwendet, um Schaltflächen neu zuzuordnen.

ShareDoublePress 9

Nicht implementiert.

ShareDoublePressMetaData 10

Nicht implementiert.

ShareDoublePressMetaDataDisplay 11

Nicht implementiert.

ShareLongPress 6

Nicht implementiert.

ShareLongPressMetaData 7

Nicht implementiert.

ShareLongPressMetaDataDisplay 8

Nicht implementiert.

ShareShortPress 3

Nicht implementiert.

ShareShortPressMetaData 4

Nicht implementiert.

ShareShortPressMetaDataDisplay 5

Nicht implementiert.

VibrationSettings 2

Wird verwendet, um Vibrationen zu deaktivieren.

Beispiele

void RemapButtons(IGameController controller, IGameControllerProvider controllerProvider)
{
    LegacyGipGameControllerProvider legacyGipGameControllerProvider =
        LegacyGipGameControllerProvider.FromGameControllerProvider(controllerProvider);

    // Retrieve all current remappings set for standard controllers
    IReadOnlyDictionary<RemappingButtonCategory, object> currentMappings =
        legacyGipGameControllerProvider.GetStandardControllerButtonRemapping(
            controller.User, false);

    // Swap two of the buttons
    Dictionary<RemappingButtonCategory, object> remaps =
        new Dictionary<RemappingButtonCategory, object>();

    // Duplicates are not allowed. Swap two of the buttons
    UInt64 currentButtonMappings =
       (UInt64)currentMappings[RemappingButtonCategory.ButtonSettings];

    // Isolate the buttons we want to remap
    UInt64 lastButton = (currentButtonMappings & 0xf000000000000000);
    UInt64 secondLastButton = currentButtonMappings & 0x0f00000000000000;

    // Swap their positions
    UInt64 newMapping = (lastButton >> 4) | (secondLastButton << 4);

    // Recombine with the original mappings
    UInt64 newButtonMappings = (currentButtonMappings & 0x00ffffffffffffff) | newMapping;

    // Add the new button remappings to the mapping dictionary
    remaps.Add(RemappingButtonCategory.ButtonSettings, newButtonMappings);

    // Update controller mapping
    legacyGipGameControllerProvider.SetStandardControllerButtonRemapping(
        controller.User, false, newButtonMappings);
}

Hinweise

Achtung

Die Controllerzuordnung ist systemweit und für den jeweiligen Benutzer persistent. Dies sollte nur auf Die Anweisung des Benutzers erfolgen.

Gilt für: