Fixed platform detection for Android

Conflicts:
	Source/OpenTK/Configuration.cs
This commit is contained in:
Stefanos A 2013-10-13 22:35:20 +02:00
parent a51540e8d9
commit 28fa768257
2 changed files with 26 additions and 1 deletions

View file

@ -38,7 +38,10 @@ namespace OpenTK
/// <summary>Provides information about the underlying OS and runtime.</summary>
public static class Configuration
{
static bool runningOnWindows, runningOnUnix, runningOnX11, runningOnMacOS, runningOnLinux, runningOnMono;
static bool runningOnWindows, runningOnUnix, runningOnX11, runningOnMacOS, runningOnLinux;
static bool runningOnMono;
static bool runningOnAndroid;
static bool? sdl2supported;
volatile static bool initialized;
readonly static object InitLock = new object();
@ -114,6 +117,26 @@ namespace OpenTK
#endregion
#region public static bool RunningOnAndroid
/// <summary>
/// Gets a <c>System.Boolean</c> indicating whether
/// OpenTK is running on an Android device.
/// </summary>
public static bool RunningOnAndroid
{
get
{
#if ANDROID
return true;
#else
return false;
#endif
}
}
#endregion
#region --- Private Methods ---
#region private static string DetectUnixKernel()

View file

@ -76,6 +76,8 @@ namespace OpenTK.Platform.SDL2
current = OpenTK.Platform.X11.Glx.GetCurrentContext();
else if (Configuration.RunningOnMacOS)
current = OpenTK.Platform.MacOS.Cgl.GetCurrentContext();
else if (Configuration.RunningOnAndroid)
current = OpenTK.Platform.Egl.Egl.GetCurrentContext();
else
throw new NotSupportedException("Unknown platform, please report to http://www.opentk.com");