UE5 C++ 获取显示器分辨率

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyFunctionLibrary.generated.h"

/**
 * 
 */
UCLASS()
class NEW53TEST_API UMyFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	UFUNCTION(BlueprintCallable)
    static FVector2D etCurrentScreenResolution();
};
// Fill out your copyright notice in the Description page of Project Settings.


#include "MyFunctionLibrary.h"
//#include "GameFramework/GameUserSettings.h"
#include 
//#include 

FVector2D UMyFunctionLibrary::etCurrentScreenResolution()
{
	//FIntPoint resolution = GEngine->GetGameUserSettings()->GetScreenResolution();
	//GEngine->GetGameUserSettings()->ApplySettings(true);

	int width = GetSystemMetrics(SM_CXSCREEN);
	int height = GetSystemMetrics(SM_CYSCREEN);

	FVector2D resolution2D(width,height);
	
	return resolution2D;
}

 

你可能感兴趣的:(ue5,c++,java)