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 |
---|---|---|
PerformanceKit.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(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 |
---|---|---|
PerformanceKit.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 |
---|---|
PleyResult | 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 |
---|---|
PerformanceKit.Resolution[] | 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 |
---|---|---|
PerformanceKit.Resolution[] | resolutions | The array where the common resolution values is going to be allocated to. |
Returns
Type | Description |
---|---|
PleyResult | 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.Boolean | 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.Boolean | isFullscreen | The fullscreen mode value |
Returns
Type | Description |
---|---|
PleyResult | 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 |
---|---|
PerformanceKit.Resolution | 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 |
---|---|---|
PerformanceKit.Resolution | resolution | Output parameter for the current resolution game is rendering in. |
Returns
Type | Description |
---|---|
PleyResult | Returns whether it succeeded or not. |
GetViewportSize()
Returns the actual viewport size on the device.
Declaration
public static PerformanceKit.Resolution GetViewportSize()
Returns
Type | Description |
---|---|
PerformanceKit.Resolution | 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 |
---|---|---|
PerformanceKit.Resolution | resolution | The viewport size value. |
Returns
Type | Description |
---|---|
PleyResult | 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.Boolean | fullscreen |
Returns
Type | Description |
---|---|
PleyResult | Result whether it succeeded or not |
SetResolution(PerformanceKit.Resolution)
Sets the resolution at which the game will render.
Declaration
public static PleyResult SetResolution(PerformanceKit.Resolution resolution)
Parameters
Type | Name | Description |
---|---|---|
PerformanceKit.Resolution | resolution | The target resolution to set. |
Returns
Type | Description |
---|---|
PleyResult | Whether it succeeded or not. |
SetResolution(PerformanceKit.Resolution, Boolean, Boolean)
Declaration
public static PleyResult SetResolution(PerformanceKit.Resolution resolution, bool matchCommon = true, bool capToScreen = true)
Parameters
Type | Name | Description |
---|---|---|
PerformanceKit.Resolution | resolution | |
System.Boolean | matchCommon | |
System.Boolean | capToScreen |
Returns
Type | Description |
---|---|
PleyResult |
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.Int32 | width | Target resolution width. |
System.Int32 | height | Target resolution height. |
Returns
Type | Description |
---|---|
PleyResult | Whether it succeeded or not. |
SetResolution(Int32, Int32, Boolean, Boolean)
Declaration
public static PleyResult SetResolution(int width, int height, bool matchCommon, bool capToScreen)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | |
System.Int32 | height | |
System.Boolean | matchCommon | |
System.Boolean | capToScreen |
Returns
Type | Description |
---|---|
PleyResult |
Events
OnFullscreenChanged
Callback for when the fullscreen mode is changed
Declaration
public static event PerformanceKit.FullscreenChangedCallback OnFullscreenChanged
Event Type
Type | Description |
---|---|
PerformanceKit.FullscreenChangedCallback |
OnViewportSizeChanged
Callback for when the viewport size is changed.
Declaration
public static event PerformanceKit.ViewportSizeChangedCallback OnViewportSizeChanged
Event Type
Type | Description |
---|---|
PerformanceKit.ViewportSizeChangedCallback |