> ## 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

Obtém o mapeamento de fisicalidade de entrada de uma leitura específica do gamepad.

<a id="syntaxSection" />

## Sintaxe

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

<a id="parametersSection" />

### Parâmetros

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

A leitura do gamepad que está sendo consultada.

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

A fisicalidade da leitura de entrada.

<a id="retvalSection" />

### Valor retornado

Tipo: HRESULT

Retornará **S\_OK** se for bem-sucedido; caso contrário, retornará um código de erro.

**Erros potenciais**

| Código de erro | Valor do erro | Motivo do erro |
| - | - | - |
| E\_GAMESTREAMING\_NOT\_INITIALIZED | 0x89245400 | O runtime do XGameStreaming não foi inicializado. Chame [XGameStreamingInitialize](/pt-BR/reference/system/xgamestreaming/functions/xgamestreaminginitialize) antes de chamar outras APIs. |
| E\_GAMESTREAMING\_NOT\_STREAMING\_CONTROLLER | 0x89245404 | A leitura atual não veio de um controle de streaming. |

<a id="remarksSection" />

## Comentários

Os jogos talvez precisem diferenciar uma entrada de controle com base em se ela veio de um controle conectado fisicamente ou de um layout de toque que foi convertido em uma entrada de controle virtual.

**Cenário de exemplo**

O jogo tem uma ação de *pular* associada ao botão **A**. Ele oferece um layout de toque com o ícone de *pular* configurado com o pressionamento do botão **A** no controle virtual. O jogo também oferece aos jogadores a capacidade de remapear o controle físico de forma que **A** não esteja mais associado a *pular*.

O jogo pode apresentar dicas visuais para interagir com elementos do jogo (por exemplo, Pressione **A** para *pular*). Quando o jogador usa os layouts de toque, a dica visual deve mostrar a iconografia do botão do layout de toque.

<a id="exampleSection" />

## Exemplo

No exemplo de código a seguir, o jogo tem a ação de *pular* vinculada ao botão **A** do controle por padrão. Embora essa configuração possa ser personalizada pelo jogador, o layout de toque
na tela é fixo e, portanto, um pressionamento do botão **A** no layout de toque deve sempre ser tratado como *pular*, enquanto o **A** de um controle físico deve ser tratado de acordo com o que o
jogador definiu na personalização do mapeamento do controle.

```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

**Cabeçalho:** xgamestreaming.h

**Biblioteca:** xgameruntime.lib

**Plataformas com suporte:** Windows, consoles da família XBOX One e consoles XBOX Series

<a id="seealsoSection" />

## Confira também

[XGameStreaming](/pt-BR/reference/system/xgamestreaming/xgamestreaming_members)\
[XGameStreamingGamepadPhysicality](/pt-BR/reference/system/xgamestreaming/enums/xgamestreaminggamepadphysicality)\
[Adaptação de toque do XGameStreaming](/pt-BR/reference/system/xgamestreaming/xgamestreaming_members#TouchAdaptation)


## Related topics

- [XGameStreamingGetGamepadPhysicality](/reference/system/xgamestreaming/functions/xgamestreaminggetgamepadphysicality.md)
- [XGameStreamingGamepadPhysicality](/reference/system/xgamestreaming/enums/xgamestreaminggamepadphysicality.md)
