> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameStreamingGetGamepadPhysicality

> XGameStreamingGetGamepadPhysicality

# XGameStreamingGetGamepadPhysicality

Obtiene la asignación de fisicalidad de la entrada a partir de una lectura de mando específica.

<a id="syntaxSection" />

## Sintaxis

```cpp theme={null}
HRESULT XGameStreamingGetGamepadPhysicality(
         IGameInputReading* gamepadReading,
         XGameStreamingGamepadPhysicality* gamepadPhysicality
)
```

<a id="parametersSection" />

### Parámetros

*gamepadReading*   \_In\_\
Tipo: IGameInputReading\*

La lectura del mando que se está consultando.

*gamepadPhysicality*   \_Out\_\
Tipo: [XGameStreamingGamepadPhysicality](/reference/system/xgamestreaming/enums/xgamestreaminggamepadphysicality)\*

La fisicalidad de la lectura de entrada.

<a id="retvalSection" />

### Valor devuelto

Tipo: HRESULT

Devuelve **S\_OK** si se realiza correctamente; de lo contrario, devuelve un código de error.

**Posibles errores**

| Código de error                              | Valor de error | Motivo del error                                                                                                                                                                                      |
| -------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| E\_GAMESTREAMING\_NOT\_INITIALIZED           | 0x89245400     | El entorno de ejecución de XGameStreaming no se ha inicializado. Llame a [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize) antes de llamar a otras API. |
| E\_GAMESTREAMING\_NOT\_STREAMING\_CONTROLLER | 0x89245404     | La lectura actual no procede de un mando de streaming.                                                                                                                                                |

<a id="remarksSection" />

## Comentarios

Es posible que los juegos necesiten diferenciar una entrada de mando en función de si la entrada procede de un mando conectado físicamente o de un diseño táctil que se ha traducido en una entrada de mando virtual.

**Escenario de ejemplo**

El juego tiene una acción de *salto* asociada al botón **A**. Ofrece un diseño táctil con el icono de *salto* configurado con la pulsación del botón **A** en el mando virtual. El juego también ofrece a los jugadores la posibilidad de reasignar el mando físico de forma que **A** ya no esté asociado a *salto*.

El juego puede mostrar sugerencias visuales para interactuar con elementos del juego (por ejemplo, presione **A** para *saltar*). Cuando el jugador usa los diseños táctiles, la sugerencia visual debe mostrar la iconografía del botón del diseño táctil.

<a id="exampleSection" />

## Ejemplo

En el siguiente ejemplo de código, el juego tiene la acción de *salto* vinculada de forma predeterminada al botón **A** del mando. Aunque el jugador puede personalizar esta configuración, el diseño táctil
de la pantalla es fijo y, por tanto, una pulsación del botón **A** desde el diseño táctil debe tratarse siempre como *salto*, mientras que el botón **A** de un mando físico debe tratarse como lo que el
jugador haya establecido en la personalización de la asignación del mando.

```cpp theme={null}
void Game::Update(DX::StepTimer const& timer)
{
    g_gameInput->GetCurrentReading(GameInputKind::GameInputKindController, g_gamepad, &reading);
    
    GameInputGamepadState state;
    reading->GetGamepadState(&state);

    XGameStreamingGamepadPhysicality physicality = XGameStreamingGamepadPhysicality::None;
    
    HRESULT hr = XGameStreamingGetGamepadPhysicality(reading, &physicality);

    if ((state.buttons & GameInputGamepadA) != GameInputGamepadNone)
    {
        if (SUCCEEDED(hr))
        {
            if ((physicality & XGameStreamingGamepadPhysicality::AVirtual) == 
                XGameStreamingGamepadPhysicality::AVirtual)
            {
                // 'A' Input came from touch layout
                // Perform 'jump' action, if applicable
            }
            else if ((physicality & XGameStreamingGamepadPhysicality::APhysical) == 
                 XGameStreamingGamepadPhysicality::APhysical)
            {
                // 'A' Input came from the physical controller.
                // Lookup 'A' from the user's customized controller mapping.
                // Perform whatever action A is mapped to, if applicable.
            }
        }
        else
        {
            // Physicality not present on this gamepad.
            // Perform input 'A' action as if there were no stream.
        }
    }

    // UI icon updates.
    // If the player is using the touch layouts, then show touch iconography, 
    // otherwise switch to the physical controller iconography.
    if (SUCCEEDED(hr))
    {
        if ((physicality & XGameStreamingGamepadPhysicality::AllVirtual) != 
            XGameStreamingGamepadPhysicality::None)
        {
            // At least one input is coming from virtual touch layout.
            // Update UI icons to match the touch layouts.
        } 
        else 
        {
            if ((physicality & XGameStreamingGamepadPhysicality::AllPhysical) != 
                XGameStreamingGamepadPhysicality::None)
            {
                // At least one input is coming from a physical controller.
                // Update UI icons to match a physical controller inputs (for example, LT/LB/RT/RB icon).
            }
        }
    }
    else
    {
        // Use the default non-streaming behavior for UI icons 
    }
}
```

<a id="requirementsSection" />

## Requisitos

**Encabezado:** xgamestreaming.h

**Biblioteca:** xgameruntime.lib

**Plataformas compatibles:** Windows, consolas de la familia XBOX One y consolas XBOX Series

<a id="seealsoSection" />

## Consulte también

[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members)\
[XGameStreamingGamepadPhysicality](/reference/system/xgamestreaming/enums/xgamestreaminggamepadphysicality)\
[Adaptación táctil de XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members#TouchAdaptation)


## Related topics

- [XGameStreamingGamepadPhysicality](/es/reference/system/xgamestreaming/enums/xgamestreaminggamepadphysicality.md)
- [XGameStreaming](/es/reference/system/xgamestreaming/xgamestreaming_members.md)
- [Guía del diseñador para crear controles táctiles](/es/build/core-features/common/game-streaming/building-touch-layouts/game-streaming-tak-designers-guide.md)
- [XGameStreamingGetAssociatedFrame](/es/reference/system/xgamestreaming/functions/xgamestreaminggetassociatedframe.md)
- [GAMEPAD_VIBRATION](/es/reference/tools/xtf/xtfinput/structures/gamepad_vibration.md)
