Files
UnrealEngineUWP/Engine/Source/Runtime/TimeManagement/Public/CommonFrameRates.h
Steve Robb cc12aaac04 Math macro prefix fixes for CoreUObject and Engine.
#rb none
#jira UE-140139
#preflight 624af57b637925b5d3fb9fef

[CL 19609424 by Steve Robb in ue5-main branch]
2022-04-04 11:13:42 -04:00

74 lines
2.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Misc/FrameRate.h"
#include "Containers/ArrayView.h"
enum class ECommonFrameRate : uint8
{
FPS_12,
FPS_15,
FPS_24,
FPS_25,
FPS_30,
FPS_48,
FPS_50,
FPS_60,
FPS_100,
FPS_120,
FPS_240,
NTSC_24,
NTSC_30,
NTSC_60,
Private_Num
};
struct FCommonFrameRateInfo
{
FFrameRate FrameRate;
FText DisplayName;
FText Description;
};
struct TIMEMANAGEMENT_API FCommonFrameRates
{
typedef __underlying_type(ECommonFrameRate) NumericType;
FORCEINLINE static FFrameRate FPS_12() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_12].FrameRate; }
FORCEINLINE static FFrameRate FPS_15() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_15].FrameRate; }
FORCEINLINE static FFrameRate FPS_24() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_24].FrameRate; }
FORCEINLINE static FFrameRate FPS_25() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_25].FrameRate; }
FORCEINLINE static FFrameRate FPS_30() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_30].FrameRate; }
FORCEINLINE static FFrameRate FPS_48() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_48].FrameRate; }
FORCEINLINE static FFrameRate FPS_50() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_50].FrameRate; }
FORCEINLINE static FFrameRate FPS_60() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_60].FrameRate; }
FORCEINLINE static FFrameRate FPS_100() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_100].FrameRate; }
FORCEINLINE static FFrameRate FPS_120() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_120].FrameRate; }
FORCEINLINE static FFrameRate FPS_240() { return AllFrameRates[(NumericType)ECommonFrameRate::FPS_240].FrameRate; }
FORCEINLINE static FFrameRate NTSC_24() { return AllFrameRates[(NumericType)ECommonFrameRate::NTSC_24].FrameRate; }
FORCEINLINE static FFrameRate NTSC_30() { return AllFrameRates[(NumericType)ECommonFrameRate::NTSC_30].FrameRate; }
FORCEINLINE static FFrameRate NTSC_60() { return AllFrameRates[(NumericType)ECommonFrameRate::NTSC_60].FrameRate; }
static TArrayView<const FCommonFrameRateInfo> GetAll();
static bool Contains(FFrameRate FrameRateToCheck)
{
return Find(FrameRateToCheck) != nullptr;
}
static const FCommonFrameRateInfo* Find(FFrameRate InFrameRate);
/** Find a common frame rate that matches the given frame rate as a decimal number of frames per second.
*
* @param InFrameRateAsDecimal: Frame rate (in frames per second) to search for.
* @param Tolerance: Numerical tolerance to use when searching for a frame rate match.
* @return: a pointer to the matching common frame rate if a match was found, or nullptr otherwise.
*/
static const FCommonFrameRateInfo* Find(const double InFrameRateAsDecimal, const double Tolerance = UE_DOUBLE_KINDA_SMALL_NUMBER);
private:
static const FCommonFrameRateInfo AllFrameRates[(int32)ECommonFrameRate::Private_Num];
};