TargetPlatformUtilityΒΆ
-
class
TargetPlatformUtility
: System.Object - A static utility class which returns the platform that
code is currently executing under.
This method allows you to access platform information at runtime. To change what code is built at compile-time based on the platform, use one of the following constants:
PLATFORM_ANDROID
PLATFORM_IOS
PLATFORM_LINUX
PLATFORM_MACOS
PLATFORM_OUYA
PLATFORM_PSMOBILE
PLATFORM_WINDOWS
PLATFORM_WINDOWS8
PLATFORM_WINDOWSGL
PLATFORM_WINDOWSPHONE
PLATFORM_WEB
You can use these constants with the
#if
construct in C#. For example:
public void MyMethod() { #if PLATFORM_WINDOWS SomeWindowsSpecificCall() #elif PLATFORM_LINUX SomeLinuxSpecificCall() #endif }
-
public TargetPlatform
GetExecutingPlatform
() Returns the platform that the game is currently executing on.
Returns: The T:Protogame.TargetPlatform value representing the platform that the game is currently executing on.