Class PerformanceKit
PerformanceKit is used to integrate resolution changes when playing in browser.
Inheritance
Namespace: Pley
Assembly: Pley.dll
Syntax
public static class PerformanceKit : object
Methods
GetCommonResolutionNonAlloc(PerformanceKit.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(PerformanceKit.Resolution[] array)
Parameters
Type | Name | Description |
---|---|---|
Performance |
array | A pre allocated array used to store the resolution in. |
Returns
Type | Description |
---|---|
System. |
The amount of items in the array that was assigned. |
GetCommonResolutionNonAlloc(PerformanceKit.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 PleyResult GetCommonResolutionNonAlloc(PerformanceKit.Resolution[] array, out int count)
Parameters
Type | Name | Description |
---|---|---|
Performance |
array | A pre allocated array used to store the resolution in. |
System. |
count | The amount of items assigned to the array. |
Returns
Type | Description |
---|---|
Pley |
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 PerformanceKit.Resolution[] GetCommonResolutions()
Returns
Type | Description |
---|---|
Performance |
New array of 10 common resolutions. |
GetCommonResolutions(out PerformanceKit.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 PleyResult GetCommonResolutions(out PerformanceKit.Resolution[] resolutions)
Parameters
Type | Name | Description |
---|---|---|
Performance |
resolutions | The array where the common resolution values is going to be allocated to. |
Returns
Type | Description |
---|---|
Pley |
Returns whether it succeeded or not. |
GetIsFullscreen()
Is the game currently being played in fullscreen mode
Declaration
public static bool GetIsFullscreen()
Returns
Type | Description |
---|---|
System. |
The fullscreen mode value |
GetIsFullscreen(out Boolean)
Is the game currently being played in fullscreen mode
Declaration
public static PleyResult GetIsFullscreen(out bool isFullscreen)
Parameters
Type | Name | Description |
---|---|---|
System. |
isFullscreen | The fullscreen mode value |
Returns
Type | Description |
---|---|
Pley |
Result whether it succeeded or not |
GetResolution()
Gets the resolution at which the game is currently rendering.
Declaration
public static PerformanceKit.Resolution GetResolution()
Returns
Type | Description |
---|---|
Performance |
Returns current resolution game is rendering in. |
GetResolution(out PerformanceKit.Resolution)
Gets the resolution at which the game is currently rendering.
Declaration
public static PleyResult GetResolution(out PerformanceKit.Resolution resolution)
Parameters
Type | Name | Description |
---|---|---|
Performance |
resolution | Output paramter for the current resolution game is rendering in. |
Returns
Type | Description |
---|---|
Pley |
Returns whether it succeeded or not. |
GetViewportSize()
Returns the actual viewport size on the device.
Declaration
public static PerformanceKit.Resolution GetViewportSize()
Returns
Type | Description |
---|---|
Performance |
The viewport size. |
GetViewportSize(out PerformanceKit.Resolution)
Returns the actual viewport size on the device.
Declaration
public static PleyResult GetViewportSize(out PerformanceKit.Resolution resolution)
Parameters
Type | Name | Description |
---|---|---|
Performance |
resolution | The viewport size value. |
Returns
Type | Description |
---|---|
Pley |
Result whether it succeeded or not. |
SetFullscreen(Boolean)
Set if the game should be in fullscreen mode.
Declaration
public static PleyResult SetFullscreen(bool fullscreen)
Parameters
Type | Name | Description |
---|---|---|
System. |
fullscreen |
Returns
Type | Description |
---|---|
Pley |
Result whether it succeeded or not |
SetResolution(PerformanceKit.Resolution, Boolean, Boolean)
Sets the resolution at which the game will render.
Declaration
public static PleyResult SetResolution(PerformanceKit.Resolution resolution, bool matchCommon = true, bool capToScreen = true)
Parameters
Type | Name | Description |
---|---|---|
Performance |
resolution | The target resolution to set. |
System. |
matchCommon | Whether to adjust resolution to the closest common resolution. |
System. |
capToScreen | Whether to adjust resolution to not be greater than screen resolution. |
Returns
Type | Description |
---|---|
Pley |
Whether it succeeded or not. |
SetResolution(Int32, Int32)
Sets the resolution at which the game will render.
Declaration
public static PleyResult SetResolution(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System. |
width | Target resolution width. |
System. |
height | Target resolution height. |
Returns
Type | Description |
---|---|
Pley |
Whether it succeeded or not. |
SetResolution(Int32, Int32, Boolean, Boolean)
Sets the resolution at which the game will render.
Declaration
public static PleyResult SetResolution(int width, int height, bool matchCommon, bool capToScreen)
Parameters
Type | Name | Description |
---|---|---|
System. |
width | Target resolution width. |
System. |
height | Target resolution height. |
System. |
matchCommon | Whether to adjust resolution to the closest common resolution. |
System. |
capToScreen | Whether to adjust resolution to not be greater than screen resolution. |
Returns
Type | Description |
---|---|
Pley |
Whether it succeeded or not. |
Events
OnFullscreenChanged
Callback for when the fullscreen mode is changed
Declaration
public static event PerformanceKit.FullscreenChangedCallback OnFullscreenChanged
Event Type
Type | Description |
---|---|
Performance |
OnViewportSizeChanged
Callback for when the viewport size is changed.
Declaration
public static event PerformanceKit.ViewportSizeChangedCallback OnViewportSizeChanged
Event Type
Type | Description |
---|---|
Performance |