Class PerformanceKit
PerformanceKit is used to integrate resolution changes when playing in browser.
Inheritance
Namespace: Trail
Assembly: Trail.dll
Syntax
public static class PerformanceKit : object
Methods
GetCommonResolutionNonAlloc(Resolution[])
Gets a list of 10 well-known resolutions based on the device display, ranging from 360p to 4K (adjusted for screen ratio). Always includes the native screen resolution.
Useful for presenting a list of resolutions to the player which they may select from, e.g. in the settings view.
Declaration
public static int GetCommonResolutionNonAlloc(Resolution[] array)
Parameters
Type | Name | Description |
---|---|---|
Resolution[] | array | A pre allocated array used to store the resolution in. |
Returns
Type | Description |
---|---|
System.Int32 | The amount of items in the array that was assigned. |
GetCommonResolutionNonAlloc(Resolution[], out Int32)
Gets a list of 10 well-known resolutions based on the device display, ranging from 360p to 4K (adjusted for screen ratio). Always includes the native screen resolution.
Useful for presenting a list of resolutions to the player which they may select from, e.g. in the settings view.
Declaration
public static Result GetCommonResolutionNonAlloc(Resolution[] array, out int count)
Parameters
Type | Name | Description |
---|---|---|
Resolution[] | array | A pre allocated array used to store the resolution in. |
System.Int32 | count | The amount of items assigned to the array. |
Returns
Type | Description |
---|---|
Result | Returns whether it succeeded or not. |
GetCommonResolutions()
Gets a list of 10 well-known resolutions based on the device display, ranging from 360p to 4K (adjusted for screen ratio). Always includes the native screen resolution.
Useful for presenting a list of resolutions to the player which they may select from, e.g. in the settings view.
Declaration
public static Resolution[] GetCommonResolutions()
Returns
Type | Description |
---|---|
Resolution[] | New array of 10 common resolutions. |
GetCommonResolutions(out Resolution[])
Gets a list of 10 well-known resolutions based on the device display, ranging from 360p to 4K (adjusted for screen ratio). Always includes the native screen resolution.
Useful for presenting a list of resolutions to the player which they may select from, e.g. in the settings view.
Declaration
public static Result GetCommonResolutions(out Resolution[] resolutions)
Parameters
Type | Name | Description |
---|---|---|
Resolution[] | resolutions | The array where the common resolution values is going to be allocated to. |
Returns
Type | Description |
---|---|
Result | Returns whether it succeeded or not. |
GetDisplayResolution()
Returns the actual native resolution on the device.
Declaration
public static Resolution GetDisplayResolution()
Returns
Type | Description |
---|---|
Resolution | The display resolution from the user. |
GetDisplayResolution(out Resolution)
Returns the actual native resolution on the device.
Declaration
public static Result GetDisplayResolution(out Resolution resolution)
Parameters
Type | Name | Description |
---|---|---|
Resolution | resolution | The output resolution. |
Returns
Type | Description |
---|---|
Result | Result whether it succeeded or not. |
GetRecommendedQualityLevel()
This is not tested or 100% supported. Should not be used.
Declaration
public static Int32 GetRecommendedQualityLevel()
Returns
Type | Description |
---|---|
Int32 |
GetRecommendedQualityLevel(out Int32)
This is not tested or 100% supported. Should not be used.
Declaration
public static Result GetRecommendedQualityLevel(out Int32 qualityLevel)
Parameters
Type | Name | Description |
---|---|---|
Int32 | qualityLevel |
Returns
Type | Description |
---|---|
Result |
GetRecommendedResolution()
Used to get the recommended resolution for the user's device.
Declaration
public static Resolution GetRecommendedResolution()
Returns
Type | Description |
---|---|
Resolution | Returns the recommended resolution. |
GetRecommendedResolution(out Resolution)
Used to get the recommended resolution for the user's device.
Declaration
public static Result GetRecommendedResolution(out Resolution resolution)
Parameters
Type | Name | Description |
---|---|---|
Resolution | resolution | Output paramter for the game resolution |
Returns
Type | Description |
---|---|
Result | Returns result whether it succeeded or not. |
GetResolution()
Gets the resolution at which the game is currently rendering.
Declaration
public static Resolution GetResolution()
Returns
Type | Description |
---|---|
Resolution | Returns current resolution game is rendering in. |
GetResolution(out Resolution)
Gets the resolution at which the game is currently rendering.
Declaration
public static Result GetResolution(out Resolution resolution)
Parameters
Type | Name | Description |
---|---|---|
Resolution | resolution | Output paramter for the current resolution game is rendering in. |
Returns
Type | Description |
---|---|
Result | Returns whether it succeeded or not. |
GetViewportSize()
Returns the actual viewport size on the device.
Declaration
public static Resolution GetViewportSize()
Returns
Type | Description |
---|---|
Resolution | The viewport size. |
GetViewportSize(out Resolution)
Returns the actual viewport size on the device.
Declaration
public static Result GetViewportSize(out Resolution resolution)
Parameters
Type | Name | Description |
---|---|---|
Resolution | resolution | The viewport size value. |
Returns
Type | Description |
---|---|
Result | Result whether it succeeded or not. |
GetWindowedMode()
Is the game currently being played in windowed mode
Declaration
public static bool GetWindowedMode()
Returns
Type | Description |
---|---|
System.Boolean | The windowed mode value |
GetWindowedMode(out Boolean)
Is the game currently being played in windowed mode
Declaration
public static Result GetWindowedMode(out bool windowedMode)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | windowedMode | The windowed mode value |
Returns
Type | Description |
---|---|
Result | Result whether it succeeded or not |
SetResolution(Int32, Int32)
Sets the resolution at which the game will render.
Declaration
public static Result SetResolution(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | Target resolution width. |
System.Int32 | height | Target resolution height. |
Returns
Type | Description |
---|---|
Result | Whether it succeeded or not. |
SetResolution(Int32, Int32, Boolean, Boolean)
Sets the resolution at which the game will render.
Declaration
public static Result SetResolution(int width, int height, bool matchCommon, bool capToScreen)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | Target resolution width. |
System.Int32 | height | Target resolution height. |
System.Boolean | matchCommon | Whether to adjust resolution to the closest common resolution. |
System.Boolean | capToScreen | Whether to adjust resolution to not be greater than screen resolution. |
Returns
Type | Description |
---|---|
Result | Whether it succeeded or not. |
SetResolution(Resolution)
Sets the resolution at which the game will render.
Declaration
public static Result SetResolution(Resolution resolution)
Parameters
Type | Name | Description |
---|---|---|
Resolution | resolution | The target resolution to set. |
Returns
Type | Description |
---|---|
Result | Whether it succeeded or not. |
SetResolution(Resolution, Boolean, Boolean)
Sets the resolution at which the game will render.
Declaration
public static Result SetResolution(Resolution resolution, bool matchCommon, bool capToScreen)
Parameters
Type | Name | Description |
---|---|---|
Resolution | resolution | The target resolution to set. |
System.Boolean | matchCommon | Whether to adjust resolution to the closest common resolution. |
System.Boolean | capToScreen | Whether to adjust resolution to not be greater than screen resolution. |
Returns
Type | Description |
---|---|
Result | Whether it succeeded or not. |
Events
OnDisplayResolutionChanged
Callback for when the actual native resolution on the device changes, either changing display settings or changing monitor, etc.
Declaration
public static event PerformanceKit.DisplayResolutionChangedCallback OnDisplayResolutionChanged
Event Type
Type | Description |
---|---|
PerformanceKit.DisplayResolutionChangedCallback |
OnViewportSizeChanged
Callback for when the viewport size is changed.
Declaration
public static event PerformanceKit.ViewportSizeChangedCallback OnViewportSizeChanged
Event Type
Type | Description |
---|---|
PerformanceKit.ViewportSizeChangedCallback |
OnWindowedModeChanged
Callback for when the windowed mode is changed
Declaration
public static event PerformanceKit.WindowedModeChangedCallback OnWindowedModeChanged
Event Type
Type | Description |
---|---|
PerformanceKit.WindowedModeChangedCallback |