RemappingButtonCategory Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Types of gamepad remapping.
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
- Inheritance
-
RemappingButtonCategory
- Attributes
Windows requirements
Device family |
Windows Desktop Extension SDK (introduced in 10.0.23665.0)
|
API contract |
Windows.Gaming.Input.GamingInputPreviewContract (introduced in v2.0)
|
Fields
Name | Value | Description |
---|---|---|
ButtonSettings | 0 | Used to remap buttons. |
AnalogSettings | 1 | Used to swap analog controls. |
VibrationSettings | 2 | Used to disable vibration. |
ShareShortPress | 3 | Not implemented. |
ShareShortPressMetaData | 4 | Not implemented. |
ShareShortPressMetaDataDisplay | 5 | Not implemented. |
ShareLongPress | 6 | Not implemented. |
ShareLongPressMetaData | 7 | Not implemented. |
ShareLongPressMetaDataDisplay | 8 | Not implemented. |
ShareDoublePress | 9 | Not implemented. |
ShareDoublePressMetaData | 10 | Not implemented. |
ShareDoublePressMetaDataDisplay | 11 | Not implemented. |
Examples
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);
}
Remarks
Caution
Controller mapping is system-wide and persistent for the given user. This should only be done at the user's direction.