Compartir a través de


RemappingButtonCategory Enumeración

Definición

Tipos de reasignación del controlador para juegos.

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
Herencia
RemappingButtonCategory
Atributos

Requisitos de Windows

Familia de dispositivos
Windows Desktop Extension SDK (se introdujo en la versión 10.0.23665.0)
API contract
Windows.Gaming.Input.GamingInputPreviewContract (se introdujo en la versión v2.0)

Campos

AnalogSettings 1

Se usa para intercambiar controles analógicos.

ButtonSettings 0

Se usa para reasignar botones.

ShareDoublePress 9

Sin implementar.

ShareDoublePressMetaData 10

Sin implementar.

ShareDoublePressMetaDataDisplay 11

Sin implementar.

ShareLongPress 6

Sin implementar.

ShareLongPressMetaData 7

Sin implementar.

ShareLongPressMetaDataDisplay 8

Sin implementar.

ShareShortPress 3

Sin implementar.

ShareShortPressMetaData 4

Sin implementar.

ShareShortPressMetaDataDisplay 5

Sin implementar.

VibrationSettings 2

Se usa para deshabilitar la vibración.

Ejemplos

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

Comentarios

Precaución

La asignación de controladores es en todo el sistema y es persistente para el usuario determinado. Esto solo debe hacerse en la dirección del usuario.

Se aplica a