Share via


RemappingButtonCategory Énumération

Définition

Types de remapping du boîtier de commande.

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
Héritage
RemappingButtonCategory
Attributs

Configuration requise pour Windows

Famille d’appareils
Windows Desktop Extension SDK (introduit dans 10.0.23665.0)
API contract
Windows.Gaming.Input.GamingInputPreviewContract (introduit dans v2.0)

Champs

AnalogSettings 1

Utilisé pour échanger des contrôles analogiques.

ButtonSettings 0

Utilisé pour remappper les boutons.

ShareDoublePress 9

Non implémenté.

ShareDoublePressMetaData 10

Non implémenté.

ShareDoublePressMetaDataDisplay 11

Non implémenté.

ShareLongPress 6

Non implémenté.

ShareLongPressMetaData 7

Non implémenté.

ShareLongPressMetaDataDisplay 8

Non implémenté.

ShareShortPress 3

Non implémenté.

ShareShortPressMetaData 4

Non implémenté.

ShareShortPressMetaDataDisplay 5

Non implémenté.

VibrationSettings 2

Utilisé pour désactiver les vibrations.

Exemples

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);
}

Remarques

Attention

Le mappage de contrôleur est persistant à l’échelle du système pour l’utilisateur donné. Cela ne doit être effectué qu’à la direction de l’utilisateur.

S’applique à