From f309876d163dcca4b5565b6a550e5c839f2fe282 Mon Sep 17 00:00:00 2001 From: emmaus Date: Sat, 16 Jun 2018 15:49:03 +0000 Subject: [PATCH] added netstandard project --- src/OpenTK/Graphics/ES20/Helper.cs | 4 +- src/OpenTK/Graphics/ES30/Helper.cs | 4 +- src/OpenTK/Graphics/OpenGL/GLHelper.cs | 4 +- src/OpenTK/Graphics/OpenGL4/Helper.cs | 4 +- src/OpenTK/OpenTK.Standard.csproj | 99 ++++++++++++++++++++++ src/OpenTK/Platform/Windows/WinGLNative.cs | 13 ++- 6 files changed, 117 insertions(+), 11 deletions(-) create mode 100644 src/OpenTK/OpenTK.Standard.csproj diff --git a/src/OpenTK/Graphics/ES20/Helper.cs b/src/OpenTK/Graphics/ES20/Helper.cs index 59905173..70330e1a 100644 --- a/src/OpenTK/Graphics/ES20/Helper.cs +++ b/src/OpenTK/Graphics/ES20/Helper.cs @@ -340,7 +340,7 @@ namespace OpenTK.Graphics.ES20 { GL.Viewport(0, 0, size.Width, size.Height); } - +#if !MINIMAL public static void Viewport(Point location, Size size) { GL.Viewport(location.X, location.Y, size.Width, size.Height); @@ -350,7 +350,7 @@ namespace OpenTK.Graphics.ES20 { GL.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } -#if MINIMAL +#else public static void Viewport(OpenTK.Point location, OpenTK.Size size) { GL.Viewport(location.X, location.Y, size.Width, size.Height); diff --git a/src/OpenTK/Graphics/ES30/Helper.cs b/src/OpenTK/Graphics/ES30/Helper.cs index b26975a7..c2a98381 100644 --- a/src/OpenTK/Graphics/ES30/Helper.cs +++ b/src/OpenTK/Graphics/ES30/Helper.cs @@ -335,7 +335,7 @@ namespace OpenTK.Graphics.ES30 { GL.Viewport(0, 0, size.Width, size.Height); } - +#if !MINIMAL public static void Viewport(Point location, Size size) { GL.Viewport(location.X, location.Y, size.Width, size.Height); @@ -345,7 +345,7 @@ namespace OpenTK.Graphics.ES30 { GL.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } -#if MINIMAL +#else public static void Viewport(OpenTK.Point location, OpenTK.Size size) { GL.Viewport(location.X, location.Y, size.Width, size.Height); diff --git a/src/OpenTK/Graphics/OpenGL/GLHelper.cs b/src/OpenTK/Graphics/OpenGL/GLHelper.cs index 7d9f283a..e8887b14 100644 --- a/src/OpenTK/Graphics/OpenGL/GLHelper.cs +++ b/src/OpenTK/Graphics/OpenGL/GLHelper.cs @@ -2772,7 +2772,7 @@ namespace OpenTK.Graphics.OpenGL } } } - +#if MINIMAL /// /// [requires: v1.0] /// Set the viewport. This function assumes a lower left corner of (0, 0). @@ -2814,7 +2814,7 @@ namespace OpenTK.Graphics.OpenGL { GL.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } -#if MINIMAL +#else /// /// [requires: v1.0] /// Set the viewport. diff --git a/src/OpenTK/Graphics/OpenGL4/Helper.cs b/src/OpenTK/Graphics/OpenGL4/Helper.cs index 4cc6d600..f2ead011 100644 --- a/src/OpenTK/Graphics/OpenGL4/Helper.cs +++ b/src/OpenTK/Graphics/OpenGL4/Helper.cs @@ -411,7 +411,7 @@ namespace OpenTK.Graphics.OpenGL4 { GL.Viewport(0, 0, size.Width, size.Height); } - +#if !MINIMAL public static void Viewport(Point location, Size size) { GL.Viewport(location.X, location.Y, size.Width, size.Height); @@ -421,7 +421,7 @@ namespace OpenTK.Graphics.OpenGL4 { GL.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } -#if MINIMAL +#else public static void Viewport(OpenTK.Point location, OpenTK.Size size) { GL.Viewport(location.X, location.Y, size.Width, size.Height); diff --git a/src/OpenTK/OpenTK.Standard.csproj b/src/OpenTK/OpenTK.Standard.csproj new file mode 100644 index 00000000..a6edc1cd --- /dev/null +++ b/src/OpenTK/OpenTK.Standard.csproj @@ -0,0 +1,99 @@ + + + OpenTK + netstandard2.0 + OpenTK + $(DefineConstants);WIN32;CARBON;X11;SDL2;OPENGL;OPENGLES;MINIMAL + + + True + 285212672 + + + bin\Debug\OpenTK.xml + 4096 + False + bin\Debug\ + False + False + 4 + True + full + + + True + 285212672 + + + bin\Release\OpenTK.xml + 4096 + True + bin\Release\ + False + False + 4 + True + pdbonly + + + True + + + ..\..\OpenTK.snk + + + + + + + + + + + + + + + + + + + + + stylecop.json + + + stylecop.ruleset + + + + true + 1.0.1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/OpenTK/Platform/Windows/WinGLNative.cs b/src/OpenTK/Platform/Windows/WinGLNative.cs index a5714c27..d2eebd88 100644 --- a/src/OpenTK/Platform/Windows/WinGLNative.cs +++ b/src/OpenTK/Platform/Windows/WinGLNative.cs @@ -44,8 +44,11 @@ namespace OpenTK.Platform.Windows { private const ExtendedWindowStyle ParentStyleEx = ExtendedWindowStyle.WindowEdge | ExtendedWindowStyle.ApplicationWindow; private const ExtendedWindowStyle ChildStyleEx = 0; - +#if NETSTANDARD + private readonly IntPtr Instance = Functions.GetModuleHandle(typeof(WinGLNative).Module.Name); +#else private readonly IntPtr Instance = Marshal.GetHINSTANCE(typeof(WinGLNative).Module); +#endif private readonly IntPtr ClassName = Marshal.StringToHGlobalAuto(Guid.NewGuid().ToString()); private readonly WindowProcedure WindowProcedureDelegate; @@ -1240,11 +1243,15 @@ namespace OpenTK.Platform.Windows } } } - +#if !NETSTANDARD Debug.Assert(oldCursorHandle != IntPtr.Zero); Debug.Assert(oldCursorHandle != cursor_handle); Debug.Assert(oldCursor != cursor); - +#else + System.Diagnostics.Debug.Assert(oldCursorHandle != IntPtr.Zero); + System.Diagnostics.Debug.Assert(oldCursorHandle != cursor_handle); + System.Diagnostics.Debug.Assert(oldCursor != cursor); +#endif // If we've replaced a custom (non-default) cursor we need to free the handle. if (oldCursor != MouseCursor.Default) {