mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-25 21:21:03 +00:00
Do not call SDL.GetVersion unless requested
This commit is contained in:
parent
635bb85313
commit
32828ecd8a
|
@ -29,6 +29,7 @@ using System.Runtime.InteropServices;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
@ -46,17 +47,25 @@ namespace OpenTK.Platform.SDL2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public readonly static object Sync = new object();
|
public readonly static object Sync = new object();
|
||||||
public readonly static Version Version;
|
static Nullable<Version> version;
|
||||||
|
public static Version Version
|
||||||
static SDL()
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GetVersion(out Version);
|
if (!version.HasValue)
|
||||||
|
{
|
||||||
|
version = GetVersion();
|
||||||
|
}
|
||||||
|
return version.Value;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// nom nom
|
// nom nom
|
||||||
|
Debug.Print("[SDL2] Failed to retrieve version");
|
||||||
|
return new Version();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +149,12 @@ namespace OpenTK.Platform.SDL2
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetVersion", ExactSpelling = true)]
|
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetVersion", ExactSpelling = true)]
|
||||||
public static extern void GetVersion(out Version version);
|
public static extern void GetVersion(out Version version);
|
||||||
|
public static Version GetVersion()
|
||||||
|
{
|
||||||
|
Version v;
|
||||||
|
GetVersion(out v);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetWindowID", ExactSpelling = true)]
|
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetWindowID", ExactSpelling = true)]
|
||||||
|
|
Loading…
Reference in a new issue