Поделиться через


RemappingButtonCategory Перечисление

Определение

Типы переназначения геймпада.

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
Наследование
RemappingButtonCategory
Атрибуты

Требования к Windows

Семейство устройств
Windows Desktop Extension SDK (появилось в 10.0.23665.0)
API contract
Windows.Gaming.Input.GamingInputPreviewContract (появилось в v2.0)

Поля

AnalogSettings 1

Используется для замены аналоговых элементов управления.

ButtonSettings 0

Используется для повторного сопоставления кнопок.

ShareDoublePress 9

Не реализован.

ShareDoublePressMetaData 10

Не реализован.

ShareDoublePressMetaDataDisplay 11

Не реализован.

ShareLongPress 6

Не реализован.

ShareLongPressMetaData 7

Не реализован.

ShareLongPressMetaDataDisplay 8

Не реализован.

ShareShortPress 3

Не реализован.

ShareShortPressMetaData 4

Не реализован.

ShareShortPressMetaDataDisplay 5

Не реализован.

VibrationSettings 2

Используется для отключения вибрации.

Примеры

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

Комментарии

Внимание!

Сопоставление контроллера является системным и постоянным для данного пользователя. Это следует делать только по указанию пользователя.

Применяется к