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

# XGameStreamingGetDisplayDetails

> XGameStreamingGetDisplayDetails

# XGameStreamingGetDisplayDetails

이 API는 지정한 클라이언트의 디스플레이 세부 정보를 반환합니다. 이를 사용하면 어떤 사용자 지정 종횡비로 렌더링할지 또는 DirectCapture를 사용하려면 어떤 해상도를 사용할지와 같은 정보에 근거한 결정을 내릴 수 있습니다.

## 구문

```cpp theme={null}
HRESULT XGameStreamingGetDisplayDetails(
        XGameStreamingClientId client,
        uint32_t maxSupportedPixels,
        float widestSupportedAspectRatio,
        float tallestSupportedAspectRatio,
        XGameStreamingDisplayDetails* displayDetails
)
```

### 매개 변수

*client*   \_In\_\
형식: XGameStreamingClientId

쿼리 대상 스트리밍 클라이언트입니다.

*maxSupportedPixels*   \_In\_\
형식: uint32\_t

게임에서 지원하는 최대 픽셀 수입니다.

*widestSupportedAspectRatio*   \_In\_\
형식: float

게임에서 지원하는 가장 넓은 종횡비입니다. 가장 넓은 지원 해상도를 사용하여 width / height로 계산됩니다.

*tallestSupportedAspectRatio*   \_In\_\
형식: float

게임에서 지원하는 가장 높은 종횡비입니다. 가장 높은 지원 해상도를 사용하여 width / height로 계산됩니다.

*displayDetails*   \_Out\_\
형식: [XGameStreamingDisplayDetails\*](/reference/system/xgamestreaming/structs/xgamestreamingdisplaydetails)

스트리밍 클라이언트의 디스플레이 세부 정보입니다.

### 반환 값

형식: HRESULT

성공하면 **S\_OK**를 반환하고, 그렇지 않으면 오류 코드를 반환합니다.

#### 잠재적 오류

| 오류 코드                                    | 오류 값       | 오류 원인                                                                                                                                                                     |
| ---------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| E\_GAMESTREAMING\_NOT\_INITIALIZED       | 0x89245400 | XGameStreaming 런타임이 초기화되지 않았습니다. 다른 API를 호출하기 전에 XGameStreamingInitialize를 호출하세요.                                                                                         |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED | 0x89245401 | 지정한 클라이언트가 연결되어 있지 않습니다.                                                                                                                                                  |
| E\_GAMESTREAMING\_NO\_DATA               | 0x89245402 | 요청한 데이터를 사용할 수 없습니다. 데이터는 나중에 사용할 수 있게 될 수 있습니다.                                                                                                                          |
| E\_INVALIDARG                            | 0x80070057 | 하나 이상의 매개 변수가 잘못되었습니다. `maxSupportedPixels`는 0보다 커야 합니다. `widestSupportedAspectRatio`는 16/9 이상이어야 하며 무한대가 아니어야 합니다. `tallestSupportedAspectRatio`는 16/9 이하이면서 0보다 커야 합니다. |

오류 코드 목록은 [오류 코드](/reference/errorcodes)를 참조하세요.

## 설명

`displayDetails`의 데이터를 사용하여 게임 렌더링 해상도와 같은 게임의 여러 측면을 제어할 수 있으며, 중요한 정보나 UI가 상호 작용 가능한 위치에 놓이고 가려지지 않도록 배치 위치를 결정할 수 있습니다.

`displayDetails` 구조체의 `preferredWidth`와 `preferredHeight`는 스트리밍 클라이언트의 실제 디스플레이, 스트리밍 시스템 기반의 제한 사항, 그리고 게임이 제공한 매개 변수(`maxSupportedPixels`, `widestSupportedAspectRatio`, `tallestSupportedAspectRatio`)를 기반으로 결정됩니다.

게임 시작 시점에는 데이터를 사용할 수 없을 수 있으며, 클라이언트 연결 이벤트 시점에도 반드시 사용할 수 있는 것은 아니라는 점에 유의하세요. 따라서 게임에서는 이벤트나 폴링을 사용해야 합니다.

## 예제

```C++ theme={null}

#define DEFAULT_GAME_WIDTH 1920
#define DEFAULT_GAME_HEIGHT 1080

#define GAME_WIDEST_SUPPORTED_ASPECT_RATIO 21.5f / 9.0f
#define GAME_TALLEST_SUPPORTED_ASPECT_RATIO 16.0f / 10.0f

static uint32_t s_currentStreamWidth = DEFAULT_GAME_WIDTH;
static uint32_t s_currentStreamHeight = DEFAULT_GAME_HEIGHT;

// Option 1: Event driven. Note: be aware of potential threading issues when using the task queue.
void GameStreamingClientManager::OnConnectionStateChanged(XGameStreamingClientId client, XGameStreamingConnectionState connected)
{
    // Other connection work like registering or unregistering for the client properties change events.
    ...

    UpdateResolutionIfNeeded();
}

void GameStreamingClientManager::OnClientPropertiesChanged(
    XGameStreamingClientId client,
    uint32_t updatedPropertiesCount,
    XGameStreamingClientProperty* updatedProperties)
{
    for (uint32_t i = 0; i < updatedPropertiesCount; ++i)
    {
        switch (updatedProperties[i])
        {
        case XGameStreamingClientProperty::DisplayDetails:
        {
            UpdateResolutionIfNeeded();
            break;
        }

        default:
            // A characteristic we are not tracking - do nothing
            break;
        }
    }
}

// Option 2: Polling.

void Game::Update(DX::StepTimer const& timer)
{
    ...

    gameStreamingClientManager->UpdateResolutionIfNeeded();

    ...
}

void GameStreamingClientManager::UpdateResolutionIfNeeded()
{
    bool changeResolution = false;
    bool useDefaultResolution = true;

    // Only use custom resolution when there is only one streaming client connected.
    if (XGameStreamingGetClientCount() == 1)
    {
        XGameStreamingClientId client;
        uint32_t clientsUsed = 0;
        HRESULT hr = XGameStreamingGetClients(1, &client, &clientsUsed);
        if (SUCCEEDED(hr) && clientsUsed == 1)
        {
            XGameStreamingDisplayDetails displayDetails = {};
            hr = XGameStreamingGetDisplayDetails(client, DEFAULT_GAME_WIDTH * DEFAULT_GAME_HEIGHT, GAME_WIDEST_SUPPORTED_ASPECT_RATIO, GAME_TALLEST_SUPPORTED_ASPECT_RATIO, &displayDetails);

            if (SUCCEEDED(hr))
            {
                useDefaultResolution = false;

                // Assuming the game supports all resolutions, use the stream resolution to the preferred dimensions as provided.
                if (s_currentStreamWidth != displayDetails.preferredWidth || s_currentStreamHeight != displayDetails.preferredHeight)
                {
                    changeResolution = true;
                    s_currentStreamWidth = displayDetails.preferredWidth;
                    s_currentStreamHeight = displayDetails.preferredHeight;
                }
            }
            else
            {
                LogFormat(L"XGameStreamingGetDisplayDetails failed %x", hr);
            }
        }
        else
        {
            LogFormat(L"XGameStreamingGetClients failed hr=%x clientsUsed=%d", hr, clientsUsed);
        }
    }

    if (useDefaultResolution)
    {
        if (s_currentStreamWidth != DEFAULT_GAME_WIDTH || s_currentStreamHeight != DEFAULT_GAME_HEIGHT)
        {
            changeResolution = true;
            s_currentStreamWidth = DEFAULT_GAME_WIDTH;
            s_currentStreamHeight = DEFAULT_GAME_HEIGHT;
        }
    }

    if (changeResolution)
    {
        // Update the stream to the new resolution.
        HRESULT hr = XGameStreamingSetResolution(s_currentStreamWidth, s_currentStreamHeight);
        if (SUCCEEDED(hr))
        {
            // Update the game to render at the new resolution.
        }
        else
        {
            LogFormat(L"XGameStreamingSetResolution failed %x", hr);
        }
    }
}

```

## 요구 사항

**헤더:** xgamestreaming.h\
**라이브러리:** xgameruntime.lib\
**지원 플랫폼:** Windows, XBOX One 계열 콘솔 및 XBOX Series 콘솔

## 함께 보기

[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members)

[XGameStreamingDisplayDetails](/reference/system/xgamestreaming/structs/xgamestreamingdisplaydetails)

[XGameStreamingRegisterClientPropertiesChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterclientpropertieschanged)

[XGameStreamingSetResolution](/reference/system/xgamestreaming/functions/xgamestreamingsetresolution)

[사용자 지정 해상도 개요](/build/core-features/common/game-streaming/game-streaming-custom-resolution-overview)


## Related topics

- [XGameStreamingDisplayDetails](/ko/reference/system/xgamestreaming/structs/xgamestreamingdisplaydetails.md)
- [XGameStreamingVideoFlags](/ko/reference/system/xgamestreaming/enums/xgamestreamingvideoflags.md)
- [XGameStreamingSetResolution](/ko/reference/system/xgamestreaming/functions/xgamestreamingsetresolution.md)
- [XGameStreamingClientProperty](/ko/reference/system/xgamestreaming/enums/xgamestreamingclientproperty.md)
- [게임 스트리밍 사용자 지정 해상도 모범 사례](/ko/build/core-features/common/game-streaming/game-streaming-custom-resolution-best-practices.md)
