add from giga-device, new branch added
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="gl.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Internal
|
||||
{
|
||||
internal partial class InternalIO
|
||||
{
|
||||
|
||||
[LibraryImport(NativeLibName, EntryPoint = "glCheckShaderStat")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
#pragma warning disable CA5392
|
||||
internal static partial int glCheckShaderStatus(
|
||||
ref OpenglContext context,
|
||||
uint shaderHandle,
|
||||
int key,
|
||||
ref IntPtr logPtr);
|
||||
#pragma warning restore CA5392
|
||||
|
||||
|
||||
#region ssgc api define
|
||||
|
||||
[LibraryImport(NativeLibName, EntryPoint = "initGL")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
internal static partial void InternalInitGL(int majorVersion, int minorVersion);
|
||||
|
||||
[LibraryImport(NativeLibName, EntryPoint = "loadGlfuncDefault", StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
internal static partial IntPtr InternalLoadGlfuncDefault(string name);
|
||||
|
||||
[LibraryImport(NativeLibName, EntryPoint = "linkShaderProgram")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial uint InternalLinkShaderProgram(OpenglContext* context, uint shaderProgram);
|
||||
|
||||
[LibraryImport(NativeLibName, EntryPoint = "readLog")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial IntPtr InternalReadSSCLog();
|
||||
|
||||
[LibraryImport(NativeLibName, EntryPoint = "loadImageData", StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial void InternalLoadImage(string fileName, ImageInfo* output, ImageLoader loader);
|
||||
|
||||
[LibraryImport(NativeLibName, EntryPoint = "unloadImageData")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial void InternalUnloadImage(ImageInfo* output);
|
||||
|
||||
#endregion ssgc api define
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="InternalIO.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace StgSharp.Internal
|
||||
{
|
||||
internal static unsafe partial class InternalIO
|
||||
{
|
||||
|
||||
private const long MaxLogFileSize = 10 * 1024 * 1024; // 10 MB
|
||||
|
||||
internal const string NativeLibName =
|
||||
"StgSharp.Native";
|
||||
|
||||
internal const string SS_errorLog =
|
||||
"SS_errorlog.log";
|
||||
|
||||
private static LogType _currentLogLevel = LogType.Info;
|
||||
|
||||
internal static Dictionary<TypeCode, uint> GLtype = [];
|
||||
|
||||
internal static readonly GCHandle ssc_logHandle =
|
||||
GCHandle.Alloc(new byte[512], GCHandleType.Pinned);
|
||||
|
||||
internal static IntPtr _nativeLibPtr = IntPtr.Zero;
|
||||
|
||||
internal static SemaphoreSlim logSyncSemaphore = new(1, 1);
|
||||
|
||||
static InternalIO()
|
||||
{
|
||||
GLtype.Add(TypeCode.Single, glConst.FLOAT);
|
||||
GLtype.Add(TypeCode.Int32, glConst.INT);
|
||||
GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT);
|
||||
GLtype.Add(TypeCode.Int16, glConst.SHORT);
|
||||
GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT);
|
||||
GLtype.Add(TypeCode.SByte, glConst.BYTE);
|
||||
GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
internal static void InternalAppendLog(string log)
|
||||
{
|
||||
if (!File.Exists(SS_errorLog))
|
||||
{
|
||||
FileStream stream = File.Create(SS_errorLog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorLog)) {
|
||||
logStream.WriteLine(log);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
||||
{
|
||||
if (logType < _currentLogLevel) {
|
||||
return;
|
||||
}
|
||||
|
||||
logSyncSemaphore.Wait();
|
||||
try
|
||||
{
|
||||
RotateLogFile();
|
||||
|
||||
if (!File.Exists(SS_errorLog))
|
||||
{
|
||||
FileStream stream = File.Create(SS_errorLog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorLog)) {
|
||||
logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
logSyncSemaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType)
|
||||
{
|
||||
logSyncSemaphore.Wait();
|
||||
if (!File.Exists(SS_errorLog))
|
||||
{
|
||||
FileStream stream = File.Create(SS_errorLog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorLog))
|
||||
{
|
||||
logStream.WriteLine(beforeTime);
|
||||
logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}");
|
||||
}
|
||||
_ = logSyncSemaphore.Release(1);
|
||||
}
|
||||
|
||||
internal static void SetLogLevel(LogType logLevel)
|
||||
{
|
||||
_currentLogLevel = logLevel;
|
||||
}
|
||||
|
||||
private static void RotateLogFile()
|
||||
{
|
||||
if (File.Exists(SS_errorLog) && new FileInfo(SS_errorLog).Length > MaxLogFileSize)
|
||||
{
|
||||
string backupFile = SS_errorLog + ".backup";
|
||||
if (File.Exists(backupFile)) {
|
||||
File.Delete(backupFile);
|
||||
}
|
||||
File.Move(SS_errorLog, backupFile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="InternalResource.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Internal
|
||||
{
|
||||
internal partial class InternalIO
|
||||
{
|
||||
|
||||
#region ControllingItemRender
|
||||
|
||||
internal const string ControlItemRenderVertexShader = """
|
||||
|
||||
|
||||
|
||||
""";
|
||||
|
||||
#endregion
|
||||
|
||||
#region CollisionTexture
|
||||
|
||||
internal static ReadOnlySpan<byte> CollisionTextureVertexShader
|
||||
{
|
||||
get => """
|
||||
#version 430 core
|
||||
layout(location = 0) in vec2 localCollisionCoord;
|
||||
layout(location = 1) in vec2 spaceCoord;
|
||||
layout(location = 2) in float rotation;
|
||||
layout(location = 3) in float scaling;
|
||||
|
||||
uniform vec2 target;
|
||||
uniform mat2 projection;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat2 scaling = mat2(
|
||||
scaling,0,
|
||||
0,scaling );
|
||||
|
||||
mat2 rotation = mat2(
|
||||
cos(rotation),-sin(rotation),
|
||||
sin(rotation),cos(rotation) );
|
||||
|
||||
vec2 realCoord = (rotation * scaling * localCollisionCoord) + spaceCoord - target;
|
||||
realCoord = projection * realCoord;
|
||||
float dist = distance(realCoord, vec2(0,0));
|
||||
float angle = atan(realCoord.y, realCoord.x);
|
||||
gl_Position = vec4(angle, realCoord.y, dist, 1);
|
||||
}
|
||||
"""u8;
|
||||
}
|
||||
|
||||
internal static ReadOnlySpan<byte> CollisionTextureFragmentShader
|
||||
{
|
||||
get => """
|
||||
#version 430 core
|
||||
out vec4 Color;
|
||||
|
||||
uniform float range;
|
||||
void main()
|
||||
{
|
||||
float dist = gl_FragCoord.z;
|
||||
if(dist > range)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
dist /= range;
|
||||
gl_FragDepth = min(dist, gl_FragDepth);
|
||||
Color = vec4(dist,0,0,1);
|
||||
}
|
||||
"""u8;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ColumnSet2.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp;
|
||||
using StgSharp.Internal.Intrinsic;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Internal.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Explicit, Size = 12 * sizeof( float ), Pack = 16 )]
|
||||
internal struct ColumnSet2 : IEquatable<ColumnSet2>
|
||||
{
|
||||
|
||||
[FieldOffset( 0 * sizeof( float ) )] internal float m00;
|
||||
[FieldOffset( 4 * sizeof( float ) )] internal float m01;
|
||||
[FieldOffset( 1 * sizeof( float ) )] internal float m10;
|
||||
[FieldOffset( 5 * sizeof( float ) )] internal float m11;
|
||||
[FieldOffset( 2 * sizeof( float ) )] internal float m20;
|
||||
[FieldOffset( 6 * sizeof( float ) )] internal float m21;
|
||||
[FieldOffset( 3 * sizeof( float ) )] internal float m30;
|
||||
[FieldOffset( 7 * sizeof( float ) )] internal float m31;
|
||||
|
||||
[FieldOffset( 0 )] internal Vector4 colum0;
|
||||
[FieldOffset( 4 * sizeof( float ) )] internal Vector4 colum1;
|
||||
|
||||
internal ColumnSet2( Vector4 c0, Vector4 c1 )
|
||||
{
|
||||
Unsafe.SkipInit( out this );
|
||||
colum0 = c0;
|
||||
colum1 = c1;
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public override bool Equals( object? obj )
|
||||
{
|
||||
return ( obj is ColumnSet2 mat ) && Equals( mat );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public bool Equals( ColumnSet2 other )
|
||||
{
|
||||
return colum0.Equals( other.colum0 ) && colum1.Equals( other.colum1 );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator !=( ColumnSet2 left, ColumnSet2 right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator ==( ColumnSet2 left, ColumnSet2 right )
|
||||
{
|
||||
return left.Equals( right );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="ColumnSet3.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Internal.Intrinsic;
|
||||
using StgSharp.Mathematics;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Internal.Intrinsic
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 12 * sizeof(float), Pack = 16)]
|
||||
internal struct ColumnSet3 : IEquatable<ColumnSet3>
|
||||
{
|
||||
|
||||
[FieldOffset(0 * sizeof(float))] internal float m00;
|
||||
[FieldOffset(4 * sizeof(float))] internal float m01;
|
||||
[FieldOffset(8 * sizeof(float))] internal float m02;
|
||||
[FieldOffset(1 * sizeof(float))] internal float m10;
|
||||
[FieldOffset(5 * sizeof(float))] internal float m11;
|
||||
[FieldOffset(9 * sizeof(float))] internal float m12;
|
||||
[FieldOffset(2 * sizeof(float))] internal float m20;
|
||||
[FieldOffset(6 * sizeof(float))] internal float m21;
|
||||
[FieldOffset(10 * sizeof(float))] internal float m22;
|
||||
[FieldOffset(3 * sizeof(float))] internal float m30;
|
||||
[FieldOffset(7 * sizeof(float))] internal float m31;
|
||||
[FieldOffset(11 * sizeof(float))] internal float m32;
|
||||
|
||||
[FieldOffset(0)] internal Vector4 colum0;
|
||||
[FieldOffset(4 * sizeof(float))] internal Vector4 colum1;
|
||||
[FieldOffset(8 * sizeof(float))] internal Vector4 colum2;
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return (obj is ColumnSet3 mat) && Equals(mat);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(ColumnSet3 other)
|
||||
{
|
||||
return colum0.Equals(other.colum0) &&
|
||||
colum1.Equals(other.colum1) &&
|
||||
colum2.Equals(other.colum2);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(ColumnSet3 left, ColumnSet3 right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(ColumnSet3 left, ColumnSet3 right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ColumnSet4.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp;
|
||||
using StgSharp.Internal.Intrinsic;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Internal.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Explicit, Size = 16 * sizeof( float ) )]
|
||||
internal struct ColumnSet4 : IEquatable<ColumnSet4>
|
||||
{
|
||||
|
||||
[FieldOffset( 0 )] internal Vector4 colum0;
|
||||
[FieldOffset( 16 )] internal Vector4 colum1;
|
||||
[FieldOffset( 32 )] internal Vector4 colum2;
|
||||
[FieldOffset( 48 )] internal Vector4 colum3;
|
||||
|
||||
[FieldOffset( 0 )] public float m00;
|
||||
[FieldOffset( 16 )] public float m01;
|
||||
[FieldOffset( 32 )] public float m02;
|
||||
[FieldOffset( 48 )] public float m03;
|
||||
[FieldOffset( 4 )] public float m10;
|
||||
[FieldOffset( 20 )] public float m11;
|
||||
[FieldOffset( 36 )] public float m12;
|
||||
[FieldOffset( 52 )] public float m13;
|
||||
[FieldOffset( 8 )] public float m20;
|
||||
[FieldOffset( 24 )] public float m21;
|
||||
[FieldOffset( 40 )] public float m22;
|
||||
[FieldOffset( 56 )] public float m23;
|
||||
[FieldOffset( 12 )] public float m30;
|
||||
[FieldOffset( 28 )] public float m31;
|
||||
[FieldOffset( 44 )] public float m32;
|
||||
[FieldOffset( 60 )] public float m33;
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
internal ColumnSet4( Vector4 colum0, Vector4 colum1, Vector4 colum2, Vector4 colum3 )
|
||||
{
|
||||
Unsafe.SkipInit( out this );
|
||||
this.colum0 = colum0;
|
||||
this.colum1 = colum1;
|
||||
this.colum2 = colum2;
|
||||
this.colum3 = colum3;
|
||||
}
|
||||
|
||||
public override bool Equals( object? obj )
|
||||
{
|
||||
return ( obj is ColumnSet4 mat ) && Equals( mat );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public bool Equals( ColumnSet4 other )
|
||||
{
|
||||
return colum0.Equals( other.colum0 ) &&
|
||||
colum1.Equals( other.colum1 ) &&
|
||||
colum2.Equals( other.colum2 ) &&
|
||||
colum3.Equals( other.colum3 );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator !=( ColumnSet4 left, ColumnSet4 right )
|
||||
{
|
||||
return !( left == right );
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static bool operator ==( ColumnSet4 left, ColumnSet4 right )
|
||||
{
|
||||
return left.Equals( right );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IntrinsicContext.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp;
|
||||
using StgSharp.HighPerformance;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Internal.Intrinsic
|
||||
{
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct IntrinsicContext
|
||||
{
|
||||
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet2*, ColumnSet2*, void> add_mat_2;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, ColumnSet3*, void> add_mat_3;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, ColumnSet4*, void> add_mat_4;
|
||||
public delegate* unmanaged[Cdecl]<char*, int, int> city_hash_simplify;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, float> det_mat_3;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, float> det_mat_4;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, Vector4*, Vector4*, void> dot_31;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, Vector4*, Vector4*, void> dot_32;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, Vector4*, Vector4*, void> dot_41;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, Vector4*, Vector4*, void> dot_42;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, Vector4*, Vector4*, void> dot_43;
|
||||
public delegate* unmanaged[Cdecl]<int,ulong> factorial_simd;
|
||||
public delegate* unmanaged[Cdecl]<char*, int, int, int> index_pair;
|
||||
public delegate* unmanaged[Cdecl]<Vector4*, Vector4*, void> normalize_v3;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet2*, ColumnSet2*, void> sub_mat_2;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, ColumnSet3*, void> sub_mat_3;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, ColumnSet4*, void> sub_mat_4;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet3*, void> transpose23;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet4*, void> transpose24;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet2*, void> transpose32;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, void> transpose33;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet4*, void> transpose34;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet2*, void> transpose42;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet3*, void> transpose43;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, void> transpose44;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="intrinsicContextProvider.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the ¡°Software¡±), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED ¡°AS IS¡±,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Internal.Intrinsic;
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Internal
|
||||
{
|
||||
internal static unsafe partial class InternalIO
|
||||
{
|
||||
|
||||
private static readonly IntrinsicContext _intrinsicContext = new IntrinsicContext();
|
||||
|
||||
internal static IntrinsicContext Intrinsic
|
||||
{
|
||||
get => _intrinsicContext;
|
||||
}
|
||||
|
||||
internal static void InitIntrinsicContext()
|
||||
{
|
||||
int statCode;
|
||||
|
||||
fixed( IntrinsicContext* cptr = &_intrinsicContext ) {
|
||||
statCode = LoadIntrinsicFunction( cptr );
|
||||
}
|
||||
|
||||
switch( statCode )
|
||||
{
|
||||
case 0:
|
||||
|
||||
//Dialogue.PostError(new PlatformNotSupportedException("No SIMD instructions supported on current hardware platform"));
|
||||
Environment.Exit( -1 );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[LibraryImport( NativeLibName, EntryPoint = "load_intrinsic_function" )]
|
||||
[UnmanagedCallConv( CallConvs = [typeof( CallConvCdecl )] )]
|
||||
private static partial int LoadIntrinsicFunction( IntrinsicContext* context );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,959 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StructDefine.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/**/
|
||||
|
||||
namespace StgSharp.Internal
|
||||
{
|
||||
//rename types in style of GLFW
|
||||
|
||||
using GLFWbool = Boolean;
|
||||
|
||||
#region glad struct
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal struct GLsync
|
||||
{
|
||||
|
||||
public IntPtr Handle;
|
||||
|
||||
}
|
||||
|
||||
#endregion glad struct
|
||||
|
||||
//strucs defined in GLFW3.h
|
||||
|
||||
#region GLFW3 struct
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWcontext
|
||||
{
|
||||
|
||||
private delegate*<byte*> extensionSupported;
|
||||
private delegate*<delegate*<void>, void> getProcAddress;
|
||||
|
||||
/*
|
||||
void (* makeCurrent) (glfwWindow*);
|
||||
void (* swapBuffers) (glfwWindow*);
|
||||
void (* swapInterval) (int);
|
||||
int (* extensionSupported) (const byte*);
|
||||
delegate*<void>(*getProcAddress)(const byte*);
|
||||
void (* destroy) (glfwWindow*);
|
||||
*/
|
||||
|
||||
private delegate*<glfwWindow*> makeCurrent;
|
||||
private delegate*<glfwWindow*> swapBuffer;
|
||||
private delegate*<int> swapInterval;
|
||||
private GLFWbool forward, debug, noerror;
|
||||
|
||||
private int client;
|
||||
private int major, minor, revision;
|
||||
private int profile;
|
||||
private int release;
|
||||
private int robustness;
|
||||
private int source;
|
||||
private IntPtr destroy;
|
||||
|
||||
//PFNGLGETINTEGERVPROC GetIntegerv;
|
||||
private IntPtr GetIntegerv;
|
||||
|
||||
//PFNGLGETSTRINGPROC GetString;
|
||||
private IntPtr GetString;
|
||||
|
||||
//PFNGLGETSTRINGIPROC GetStringi;
|
||||
private IntPtr GetStringi;
|
||||
|
||||
internal struct egl
|
||||
{
|
||||
|
||||
private void* client;
|
||||
|
||||
/*
|
||||
EGLConfig config;
|
||||
EGLContext handle;
|
||||
EGLSurface surface;
|
||||
*/
|
||||
private void* config;
|
||||
private void* handle;
|
||||
private void* surface;
|
||||
|
||||
}
|
||||
|
||||
internal struct osmesa
|
||||
{
|
||||
|
||||
private void* buffer;
|
||||
|
||||
//OSMesaContext handle;
|
||||
private void* handle;
|
||||
private int height;
|
||||
|
||||
private int width;
|
||||
|
||||
}
|
||||
|
||||
// This is defined in platform.h
|
||||
//GLFW_PLATFORM_CONTEXT_STATE
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct glfwVideomode
|
||||
{
|
||||
/*! The refresh rate, in Hz, of the video mode.
|
||||
*/
|
||||
|
||||
private int refreshRate;
|
||||
/*! The bit depth of the blue channel of the video mode.
|
||||
*/
|
||||
public int blueBits;
|
||||
/*! The bit depth of the green channel of the video mode.
|
||||
*/
|
||||
public int greenBits;
|
||||
/*! The height, in screen coordinates, of the video mode.
|
||||
*/
|
||||
public int height;
|
||||
/*! The bit depth of the red channel of the video mode.
|
||||
*/
|
||||
public int redBits;
|
||||
|
||||
/*! The width, in screen coordinates, of the video mode.
|
||||
*/
|
||||
public int width;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct glfwGammaramp
|
||||
{
|
||||
/*! An array of value describing the response of the blue channel.
|
||||
*/
|
||||
|
||||
private ushort* blue;
|
||||
/*! An array of value describing the response of the green channel.
|
||||
*/
|
||||
private ushort* green;
|
||||
|
||||
/*! An array of value describing the response of the red channel.
|
||||
*/
|
||||
private ushort* red;
|
||||
/*! The number of elements in each array.
|
||||
*/
|
||||
private uint size;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWimage
|
||||
{
|
||||
/*! The pixel _data of this image, arranged left-to-right, top-to-bottom.
|
||||
*/
|
||||
|
||||
private byte* pixels;
|
||||
|
||||
/*! The height, in pixels, of this image.
|
||||
*/
|
||||
private int height;
|
||||
/*! The width, in pixels, of this image.
|
||||
*/
|
||||
private int width;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWgamepadstate
|
||||
{
|
||||
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
|
||||
* or `GLFW_RELEASE`.
|
||||
*/
|
||||
|
||||
public fixed byte buttons[ 15 ];
|
||||
|
||||
/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
|
||||
* to 1.0 inclusive.
|
||||
*/
|
||||
public fixed float axes[ 6 ];
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWallocator
|
||||
{
|
||||
|
||||
private void* user;
|
||||
|
||||
//GLFWallocatefun allocate;
|
||||
private IntPtr allocate;
|
||||
|
||||
//GLFWdeallocatefun deallocate;
|
||||
private IntPtr deallocate;
|
||||
|
||||
//GLFWreallocatefun reallocate;
|
||||
private IntPtr reallocate;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct glfwMonitor
|
||||
{
|
||||
|
||||
private glfwVideomode* modes;
|
||||
|
||||
private glfwWindow* window;
|
||||
|
||||
private fixed byte name[ 128 ];
|
||||
private glfwGammaramp currentRamp;
|
||||
|
||||
private glfwGammaramp originalRamp;
|
||||
private glfwVideomode currentMode;
|
||||
private int modeCount;
|
||||
|
||||
private int width, height;
|
||||
private IntPtr userPointer;
|
||||
|
||||
public glfwMonitor() { }
|
||||
|
||||
public unsafe string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
fixed( byte* cptr = name ) {
|
||||
return Marshal.PtrToStringAnsi( ( IntPtr )cptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct glfwWindow
|
||||
{
|
||||
|
||||
private glfwWindow* next;
|
||||
private void* userPointer;
|
||||
private bool rawMouseMotion;
|
||||
private Callbacks callbacks;
|
||||
|
||||
// Virtual cursor position when cursor is disabled
|
||||
private double virtualCursorPosX, virtualCursorPosY;
|
||||
private int autoIconify;
|
||||
private int cursorMode;
|
||||
private int decorated;
|
||||
private int doublebuffer;
|
||||
private int floating;
|
||||
private int focusOnShow;
|
||||
private int lockKeyMods;
|
||||
private int maxwidth, maxheight;
|
||||
|
||||
private int minwidth, minheight;
|
||||
private int mousePassthrough;
|
||||
private int numer, denom;
|
||||
|
||||
// Window settings and state
|
||||
private int resizable;
|
||||
private int shouldClose;
|
||||
|
||||
private int stickyKeys;
|
||||
private int stickyMouseButtons;
|
||||
private IntPtr cursor; // _GLFWcursor* cursor;
|
||||
// glfwVideomode videoMode; // 根据GLFWvidmode的定义转换
|
||||
private IntPtr monitor; // _GLFWmonitor* monitor;
|
||||
public fixed byte keys[ glConst.GLFW_KEY_LAST + 1 ];
|
||||
public fixed byte mouseButtons[ glConst.GLFW_MOUSE_BUTTON_LAST + 1 ];
|
||||
|
||||
// _GLFWcontext viewPortDisplay; // 根据_GLFWcontext的定义转换
|
||||
|
||||
// Callbacks are represented as IntPtr since we don't need the actual function pointers in C#
|
||||
internal struct Callbacks
|
||||
{
|
||||
|
||||
internal IntPtr character;
|
||||
internal IntPtr charmods;
|
||||
internal IntPtr close;
|
||||
internal IntPtr cursorEnter;
|
||||
internal IntPtr cursorPos;
|
||||
internal IntPtr drop;
|
||||
internal IntPtr fbsize;
|
||||
internal IntPtr focus;
|
||||
internal IntPtr iconify;
|
||||
internal IntPtr key;
|
||||
internal IntPtr maximize;
|
||||
internal IntPtr mouseButton;
|
||||
internal IntPtr pos;
|
||||
internal IntPtr refresh;
|
||||
internal IntPtr scale;
|
||||
internal IntPtr scroll;
|
||||
internal IntPtr size;
|
||||
|
||||
}
|
||||
|
||||
// GLFW_PLATFORM_WINDOW_STATE platformWindowState;
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public struct GLFWwindowCallback { }
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public struct GLFWcursor
|
||||
{
|
||||
|
||||
//GLFWcursor* next;
|
||||
private IntPtr next;
|
||||
|
||||
// This is defined in platform.h
|
||||
// not completed in tranformation
|
||||
// GLFW_PLATFORM_CURSOR_STATE;
|
||||
}
|
||||
|
||||
/*
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWerror
|
||||
{
|
||||
//GLFWerror* next;
|
||||
IntPtr next;
|
||||
int code;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)glConst.GLFW_MESSAGE_SIZE)]
|
||||
byte[] description = new byte[glConst.GLFW_MESSAGE_SIZE];
|
||||
|
||||
public GLFWerror()
|
||||
{
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWinitconfig
|
||||
{
|
||||
|
||||
private GLFWbool hatButtons;
|
||||
|
||||
private int angleType;
|
||||
private int platformID;
|
||||
|
||||
//PFN_vkGetInstanceProcAddr vulkanLoader;
|
||||
private IntPtr vulkanLoader;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWwndconfig
|
||||
{
|
||||
|
||||
private byte* title;
|
||||
|
||||
private GLFWbool autoIconify;
|
||||
private GLFWbool centerCursor;
|
||||
private GLFWbool decorated;
|
||||
private GLFWbool floating;
|
||||
private GLFWbool focused;
|
||||
private GLFWbool focusOnShow;
|
||||
private GLFWbool maximized;
|
||||
private GLFWbool mousePassthrough;
|
||||
private GLFWbool resizable;
|
||||
private GLFWbool scaleToMonitor;
|
||||
private GLFWbool visible;
|
||||
private int height;
|
||||
private int width;
|
||||
|
||||
private int xpos;
|
||||
private int ypos;
|
||||
|
||||
internal Ns ns = new Ns();
|
||||
|
||||
internal Win32 win32 = new Win32();
|
||||
|
||||
internal Wl wl = new Wl();
|
||||
|
||||
internal X11 x11 = new X11();
|
||||
|
||||
public GLFWwndconfig() { }
|
||||
|
||||
internal struct Ns
|
||||
{
|
||||
|
||||
private GLFWbool retina = false;
|
||||
public fixed byte frameName[ 256 ];
|
||||
|
||||
public Ns() { }
|
||||
|
||||
}
|
||||
|
||||
internal struct X11
|
||||
{
|
||||
|
||||
public fixed byte className[ 256 ];
|
||||
public fixed byte instanceName[ 256 ];
|
||||
|
||||
public X11() { }
|
||||
|
||||
}
|
||||
|
||||
internal struct Win32
|
||||
{
|
||||
|
||||
private GLFWbool keymenu;
|
||||
|
||||
}
|
||||
|
||||
internal struct Wl
|
||||
{
|
||||
|
||||
public fixed byte appId[ 256 ];
|
||||
|
||||
public Wl() { }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWctxconfig
|
||||
{
|
||||
|
||||
private GLFWbool debug;
|
||||
private GLFWbool forward;
|
||||
private GLFWbool noerror;
|
||||
|
||||
private int client;
|
||||
private int major;
|
||||
private int minor;
|
||||
private int profile;
|
||||
private int release;
|
||||
private int robustness;
|
||||
private int source;
|
||||
|
||||
//glfwWindow* share;
|
||||
private IntPtr share;
|
||||
|
||||
internal Nsgl nsgl = new Nsgl();
|
||||
|
||||
public GLFWctxconfig() { }
|
||||
|
||||
internal struct Nsgl
|
||||
{
|
||||
|
||||
private GLFWbool offline;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWfbconfig
|
||||
{
|
||||
|
||||
private GLFWbool doublebuffer;
|
||||
private GLFWbool sRGB;
|
||||
private GLFWbool stereo;
|
||||
private GLFWbool transparent;
|
||||
|
||||
private int accumAlphaBits;
|
||||
private int accumBlueBits;
|
||||
private int accumGreenBits;
|
||||
private int accumRedBits;
|
||||
private int alphaBits;
|
||||
private int auxBuffers;
|
||||
private int blueBits;
|
||||
private int depthBits;
|
||||
private int greenBits;
|
||||
|
||||
private int redBits;
|
||||
private int samples;
|
||||
private int stencilBits;
|
||||
private uintptr_t handle;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct GLFWlibrary
|
||||
{
|
||||
|
||||
[MarshalAs( UnmanagedType.ByValArray, SizeConst = glConst.GLFW_JOYSTICK_LAST + 1 )]
|
||||
private GLFWjoystick[] joysticks = new GLFWjoystick[glConst.GLFW_JOYSTICK_LAST + 1];
|
||||
|
||||
private GLFWallocator allocator;
|
||||
|
||||
private GLFWbool initialized;
|
||||
|
||||
private GLFWbool joysticksInitialized;
|
||||
private GLFWls contextSlot;
|
||||
|
||||
private GLFWls errorSlot;
|
||||
private GLFWmutex errorLock;
|
||||
|
||||
private GLFWplatform platform;
|
||||
|
||||
private int mappingCount;
|
||||
|
||||
private int monitorCount;
|
||||
|
||||
//GLFWcursor* cursorListHead;
|
||||
private IntPtr cursorListHead;
|
||||
|
||||
//GLFWerror* errorListHead;
|
||||
private IntPtr errorListHead;
|
||||
|
||||
//GLFWmapping* mappings;
|
||||
private IntPtr mappings;
|
||||
|
||||
//GLFWmonitor** monitors;
|
||||
private IntPtr monitors;
|
||||
|
||||
//glfwWindow* windowListHead;
|
||||
private IntPtr windowListHead;
|
||||
|
||||
internal Callbacks callbacks = new Callbacks();
|
||||
|
||||
internal Egl egl = new Egl();
|
||||
|
||||
internal Hints hints = new Hints();
|
||||
|
||||
internal Osmesa osmesa = new Osmesa();
|
||||
|
||||
public GLFWlibrary() { }
|
||||
|
||||
internal unsafe struct Hints
|
||||
{
|
||||
|
||||
private GLFWctxconfig context;
|
||||
private GLFWfbconfig framebuffer;
|
||||
|
||||
private GLFWinitconfig init;
|
||||
private GLFWwndconfig window;
|
||||
private int refreshRate;
|
||||
|
||||
}
|
||||
|
||||
internal unsafe struct timer
|
||||
{
|
||||
|
||||
private ulong offset;
|
||||
|
||||
// This is defined in platform.h
|
||||
|
||||
//not transformed function defination
|
||||
//GLFW_PLATFORM_LIBRARY_TIMER_STATE
|
||||
}
|
||||
|
||||
internal unsafe struct Egl
|
||||
{
|
||||
|
||||
internal void* display;
|
||||
|
||||
internal void* handle;
|
||||
|
||||
internal bool ANGLE_platform_angle;
|
||||
internal bool ANGLE_platform_angle_d3d;
|
||||
internal bool ANGLE_platform_angle_metal;
|
||||
internal bool ANGLE_platform_angle_opengl;
|
||||
internal bool ANGLE_platform_angle_vulkan;
|
||||
internal bool EXT_client_extensions;
|
||||
internal bool EXT_platform_base;
|
||||
internal bool EXT_platform_wayland;
|
||||
internal bool EXT_platform_x11;
|
||||
internal bool EXT_present_opaque;
|
||||
internal bool KHR_colorSpace;
|
||||
internal bool KHR_context_flush_control;
|
||||
|
||||
internal bool KHR_create_context;
|
||||
internal bool KHR_create_context_no_error;
|
||||
internal bool KHR_get_all_proc_addresses;
|
||||
internal bool prefix;
|
||||
internal int major, minor;
|
||||
|
||||
internal int platform;
|
||||
internal IntPtr BindAPI;
|
||||
internal IntPtr CreateContext;
|
||||
internal IntPtr CreatePlatformWindowSurfaceEXT;
|
||||
internal IntPtr CreateWindowSurface;
|
||||
internal IntPtr DestroyContext;
|
||||
internal IntPtr DestroySurface;
|
||||
|
||||
internal IntPtr GetConfigAttrib;
|
||||
internal IntPtr GetConfigs;
|
||||
internal IntPtr GetDisplay;
|
||||
internal IntPtr GetError;
|
||||
|
||||
internal IntPtr GetPlatformDisplayEXT;
|
||||
internal IntPtr GetProcAddress;
|
||||
internal IntPtr Initialize;
|
||||
internal IntPtr MakeCurrent;
|
||||
internal IntPtr QueryString;
|
||||
internal IntPtr SwapBuffers;
|
||||
internal IntPtr SwapInterval;
|
||||
internal IntPtr Terminate;
|
||||
|
||||
}
|
||||
|
||||
internal unsafe struct Osmesa
|
||||
{
|
||||
|
||||
private void* handle;
|
||||
|
||||
private IntPtr CreateContextAttribs;
|
||||
|
||||
private IntPtr CreateContextExt;
|
||||
private IntPtr DestroyContext;
|
||||
private IntPtr GetColorBuffer;
|
||||
private IntPtr GetDepthBuffer;
|
||||
private IntPtr GetProcAddress;
|
||||
private IntPtr MakeCurrent;
|
||||
|
||||
}
|
||||
|
||||
internal unsafe struct vk
|
||||
{
|
||||
|
||||
private void* handle;
|
||||
|
||||
private GLFWbool available;
|
||||
private GLFWbool EXT_metal_surface;
|
||||
private GLFWbool KHR_surface;
|
||||
private GLFWbool KHR_wayland_surface;
|
||||
private GLFWbool KHR_win32_surface;
|
||||
private GLFWbool KHR_xcb_surface;
|
||||
private GLFWbool KHR_xlib_surface;
|
||||
private GLFWbool MVK_macos_surface;
|
||||
private IntPtr GetInstanceProcAddr;
|
||||
private fixed ulong extensions[ 2 ];
|
||||
|
||||
public vk() { }
|
||||
|
||||
}
|
||||
|
||||
internal unsafe struct Callbacks
|
||||
{
|
||||
|
||||
private IntPtr joystick;
|
||||
|
||||
private IntPtr monitor;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWmapelement
|
||||
{
|
||||
|
||||
private byte index;
|
||||
|
||||
private byte type;
|
||||
|
||||
private sbyte axisOffset;
|
||||
private sbyte axisScale;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWmapping
|
||||
{
|
||||
|
||||
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 6 )]
|
||||
private GLFWmapelement[] axes = new GLFWmapelement[6];
|
||||
|
||||
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 15 )]
|
||||
private GLFWmapelement[] buttons = new GLFWmapelement[15];
|
||||
private fixed byte guid[ 33 ];
|
||||
|
||||
private fixed byte name[ 128 ];
|
||||
|
||||
public GLFWmapping() { }
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWjoystick
|
||||
{
|
||||
|
||||
private float* axes;
|
||||
private byte* buttons;
|
||||
private byte* hats;
|
||||
private void* userPointer;
|
||||
private fixed byte guid[ 33 ];
|
||||
private fixed byte name[ 128 ];
|
||||
|
||||
private GLFWbool allocated;
|
||||
private GLFWbool connected;
|
||||
private int axisCount;
|
||||
private int buttonCount;
|
||||
private int hatCount;
|
||||
|
||||
//GLFWmapping* mapping;
|
||||
private IntPtr mapping;
|
||||
|
||||
// This is defined in platform.h
|
||||
// not completed in transforming
|
||||
// GLFW_PLATFORM_JOYSTICK_STATE;
|
||||
|
||||
public GLFWjoystick() { }
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWls
|
||||
{
|
||||
|
||||
// This is defined in platform.h
|
||||
|
||||
//GLFW_PLATFORM_TLS_STATE
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWplatform
|
||||
{
|
||||
|
||||
private int platformID;
|
||||
|
||||
// init
|
||||
//GLFWbool(*init)(void);
|
||||
private IntPtr init;
|
||||
|
||||
//void (* terminate) (void);
|
||||
private IntPtr terminate;
|
||||
internal IntPtr createCursor;
|
||||
internal IntPtr createStandardCursor;
|
||||
|
||||
// window
|
||||
internal IntPtr createWindow;
|
||||
internal IntPtr destroyCursor;
|
||||
|
||||
internal IntPtr destroyWindow;
|
||||
internal IntPtr focusWindow;
|
||||
internal IntPtr framebufferTransparent;
|
||||
|
||||
// monitor
|
||||
internal IntPtr freeMonitor;
|
||||
internal IntPtr getClipboardString;
|
||||
|
||||
internal IntPtr getEGLNativeDisplay;
|
||||
internal IntPtr getEGLNativeWindow;
|
||||
|
||||
// EGL
|
||||
//EGLenum(*getEGLPlatform)(EGLint**);
|
||||
//EGLNativeDisplayType(*getEGLNativeDisplay)(void);
|
||||
//EGLNativeWindowType(*getEGLNativeWindow)(glfwWindow*);
|
||||
internal IntPtr getEGLPlatform;
|
||||
internal IntPtr getFramebufferSize;
|
||||
internal IntPtr getGammaRamp;
|
||||
internal IntPtr getKeyScancode;
|
||||
internal IntPtr getMappingName;
|
||||
internal IntPtr getMonitorContentScale;
|
||||
|
||||
internal IntPtr getMonitorPos;
|
||||
internal IntPtr getMonitorWorkarea;
|
||||
|
||||
// vulkan
|
||||
//void (* getRequiredInstanceExtensions) (byte**);
|
||||
//GLFWbool(*getPhysicalDevicePresentationSupport)(VkInstance, VkPhysicalDevice, uint32_t);
|
||||
//VkResult(*createWindowSurface)(VkInstance, glfwWindow*,const VkAllocationCallbacks*, VkSurfaceKHR*);
|
||||
internal IntPtr getRequiredInstanceExtensions;
|
||||
internal IntPtr getScancodeName;
|
||||
internal IntPtr getVideoMode;
|
||||
internal IntPtr getVideoModes;
|
||||
internal IntPtr getWindowContentScale;
|
||||
internal IntPtr getWindowFrameSize;
|
||||
internal IntPtr getWindowOpacity;
|
||||
internal IntPtr getWindowPos;
|
||||
internal IntPtr getWindowSize;
|
||||
internal IntPtr GLFWwindow;
|
||||
internal IntPtr hideWindow;
|
||||
internal IntPtr iconifyWindow;
|
||||
internal IntPtr initJoysticks;
|
||||
internal IntPtr maximizeWindow;
|
||||
internal IntPtr pollEvents;
|
||||
internal IntPtr pollJoystick;
|
||||
internal IntPtr postEmptyEvent;
|
||||
internal IntPtr rawMouseMotionSupported;
|
||||
internal IntPtr requestWindowAttention;
|
||||
internal IntPtr restoreWindow;
|
||||
internal IntPtr setClipboardString;
|
||||
internal IntPtr setCursor;
|
||||
internal IntPtr setCursorMode;
|
||||
|
||||
#region input
|
||||
|
||||
/* void (* getCursorPos) (glfwWindow*, double*, double*);
|
||||
void (* setCursorPos) (glfwWindow*, double, double);
|
||||
void (* setCursorMode) (glfwWindow*, int);
|
||||
void (* setRawMouseMotion) (glfwWindow*, GLFWbool);
|
||||
GLFWbool(*rawMouseMotionSupported)(void);
|
||||
GLFWbool(*createCursor)(GLFWcursor*,const GLFWimage*,int,int);
|
||||
GLFWbool(*createStandardCursor)(GLFWcursor*, int);
|
||||
void (* destroyCursor) (GLFWcursor*);
|
||||
void (* setCursor) (glfwWindow*, GLFWcursor*);
|
||||
const byte* (*getScancodeName)(int);
|
||||
int (* getKeyScancode) (int);
|
||||
void (* setClipboardString) (const byte*);
|
||||
const byte* (*getClipboardString)(void);
|
||||
GLFWbool(*initJoysticks)(void);
|
||||
void (* terminateJoysticks) (void);
|
||||
GLFWbool(*pollJoystick)(GLFWjoystick*, int);
|
||||
const byte* (*getMappingName)(void);
|
||||
void (* updateGamepadGUID) (byte*);
|
||||
// monitor
|
||||
void (* freeMonitor) (GLFWmonitor*);
|
||||
void (* getMonitorPos) (GLFWmonitor*, int*, int*);
|
||||
void (* getMonitorContentScale) (GLFWmonitor*, float*, float*);
|
||||
void (* getMonitorWorkarea) (GLFWmonitor*, int*, int*, int*, int*);
|
||||
glfwVideomode* (* getVideoModes) (GLFWmonitor*, int*);
|
||||
void (* getVideoMode) (GLFWmonitor*, glfwVideomode*);
|
||||
GLFWbool(*getGammaRamp)(GLFWmonitor*, glfwGammaramp*);
|
||||
void (* setGammaRamp) (GLFWmonitor*,const glfwGammaramp*);
|
||||
// window
|
||||
GLFWbool(*createWindow)(glfwWindow*,const GLFWwndconfig*,const GLFWctxconfig*,const GLFWfbconfig*);
|
||||
void (* destroyWindow) (glfwWindow*);
|
||||
void (* setWindowTitle) (glfwWindow*,const byte*);
|
||||
void (* setWindowIcon) (glfwWindow*, int,const GLFWimage*);
|
||||
void (* getWindowPos) (glfwWindow*, int*, int*);
|
||||
void (* setWindowPos) (glfwWindow*, int, int);
|
||||
void (* getWindowSize) (glfwWindow*, int*, int*);
|
||||
void (* setWindowSize) (glfwWindow*, int, int);
|
||||
void (* setWindowSizeLimits) (glfwWindow*, int, int, int, int);
|
||||
void (* setWindowAspectRatio) (glfwWindow*, int, int);
|
||||
void (* getFramebufferSize) (glfwWindow*, int*, int*);
|
||||
void (* getWindowFrameSize) (glfwWindow*, int*, int*, int*, int*);
|
||||
void (* getWindowContentScale) (glfwWindow*, float*, float*);
|
||||
void (* iconifyWindow) (glfwWindow*);
|
||||
void (* restoreWindow) (glfwWindow*);
|
||||
void (* maximizeWindow) (glfwWindow*);
|
||||
void (* showWindow) (glfwWindow*);
|
||||
void (* hideWindow) (glfwWindow*);
|
||||
void (* requestWindowAttention) (glfwWindow*);
|
||||
void (* focusWindow) (glfwWindow*);
|
||||
void (* setWindowMonitor) (glfwWindow*, GLFWmonitor*, int, int, int, int, int);
|
||||
GLFWbool(*windowFocused)(glfwWindow*);
|
||||
GLFWbool(*windowIconified)(glfwWindow*);
|
||||
GLFWbool(*windowVisible)(glfwWindow*);
|
||||
GLFWbool(*windowMaximized)(glfwWindow*);
|
||||
GLFWbool(*windowHovered)(glfwWindow*);
|
||||
GLFWbool(*framebufferTransparent)(glfwWindow*);
|
||||
float (* getWindowOpacity) (glfwWindow*);
|
||||
void (* setWindowResizable) (glfwWindow*, GLFWbool);
|
||||
void (* setWindowDecorated) (glfwWindow*, GLFWbool);
|
||||
void (* setWindowFloating) (glfwWindow*, GLFWbool);
|
||||
void (* setWindowOpacity) (glfwWindow*, float);
|
||||
void (* setWindowMousePassthrough) (glfwWindow*, GLFWbool);
|
||||
void (* pollEvents) (void);
|
||||
void (* waitEvents) (void);
|
||||
void (* waitEventsTimeout) (double);
|
||||
void (* postEmptyEvent) (void);
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
internal IntPtr setCursorPos;
|
||||
internal IntPtr setGammaRamp;
|
||||
internal IntPtr setRawMouseMotion;
|
||||
internal IntPtr setWindowAspectRatio;
|
||||
internal IntPtr setWindowDecorated;
|
||||
internal IntPtr setWindowFloating;
|
||||
internal IntPtr setWindowIcon;
|
||||
internal IntPtr setWindowMonitor;
|
||||
internal IntPtr setWindowMousePassthrough;
|
||||
internal IntPtr setWindowOpacity;
|
||||
internal IntPtr setWindowPos;
|
||||
internal IntPtr setWindowResizable;
|
||||
internal IntPtr setWindowSize;
|
||||
internal IntPtr setWindowSizeLimits;
|
||||
internal IntPtr setWindowTitle;
|
||||
internal IntPtr showWindow;
|
||||
internal IntPtr terminateJoysticks;
|
||||
internal IntPtr updateGamepadGUID;
|
||||
|
||||
internal IntPtr VkPhysicalDevice;
|
||||
internal IntPtr waitEvents;
|
||||
internal IntPtr waitEventsTimeout;
|
||||
internal IntPtr windowFocused;
|
||||
internal IntPtr windowHovered;
|
||||
internal IntPtr windowIconified;
|
||||
internal IntPtr windowMaximized;
|
||||
internal IntPtr windowVisible;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public unsafe struct GLFWmutex
|
||||
{
|
||||
|
||||
// This is defined in platform.h
|
||||
//GLFW_PLATFORM_MUTEX_STATE
|
||||
}
|
||||
|
||||
//public unsafe struct VkAllocationCallbacks { }
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct VkExtensionProperties
|
||||
{
|
||||
|
||||
private fixed byte extensionName[ 256 ];
|
||||
private uint specVersion;
|
||||
|
||||
public VkExtensionProperties() { }
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct GLFWerror
|
||||
{
|
||||
IntPtr next;
|
||||
int code;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
|
||||
byte[] description = new byte[1024];
|
||||
|
||||
public GLFWerror()
|
||||
{
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[StructLayout( LayoutKind.Explicit, Size = 16 )]
|
||||
public struct uintptr_t
|
||||
{
|
||||
|
||||
[FieldOffset( 0 )]
|
||||
private long part1;
|
||||
|
||||
[FieldOffset( 8 )]
|
||||
private long part2;
|
||||
|
||||
}
|
||||
|
||||
#endregion GLFW3 struct
|
||||
|
||||
}
|
||||
|
||||
/**/
|
||||
@@ -0,0 +1,829 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="glfw.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Internal
|
||||
{
|
||||
internal unsafe partial class InternalIO
|
||||
{
|
||||
|
||||
private static readonly GLFWFunction _glfw = new GLFWFunction();
|
||||
|
||||
public static GLFWFunction glfwContext => _glfw;
|
||||
|
||||
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
|
||||
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
|
||||
|
||||
internal static unsafe void LoadGlfw()
|
||||
{
|
||||
fixed (GLFWFunction* func = &_glfw) {
|
||||
glfwLoadLibrary(func);
|
||||
}
|
||||
}
|
||||
|
||||
#region api call
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwInit()
|
||||
{
|
||||
return _glfw.glfwInit();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwTerminate()
|
||||
{
|
||||
_glfw.glfwTerminate();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwInitHint(int hint, int value)
|
||||
{
|
||||
_glfw.glfwInitHint(hint, value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev)
|
||||
{
|
||||
_glfw.glfwGetVersion(major, minor, rev);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetVersionString()
|
||||
{
|
||||
return _glfw.glfwGetVersionString();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwGetError(byte** description)
|
||||
{
|
||||
return _glfw.glfwGetError(description);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<int, byte*, void> glfwSetErrorCallback(
|
||||
delegate* unmanaged[Cdecl]<int, byte*, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetErrorCallback(callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr* glfwGetMonitors(int* count)
|
||||
{
|
||||
return _glfw.glfwGetMonitors(count);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr glfwGetPrimaryMonitor()
|
||||
{
|
||||
return _glfw.glfwGetPrimaryMonitor();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos)
|
||||
{
|
||||
_glfw.glfwGetMonitorPos(monitor, xpos, ypos);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetMonitorWorkarea(
|
||||
IntPtr monitor,
|
||||
int* xpos,
|
||||
int* ypos,
|
||||
int* width,
|
||||
int* height)
|
||||
{
|
||||
_glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM)
|
||||
{
|
||||
_glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale)
|
||||
{
|
||||
_glfw.glfwGetMonitorContentScale(monitor, xscale, yscale);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetMonitorName(IntPtr monitor)
|
||||
{
|
||||
return _glfw.glfwGetMonitorName(monitor);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer)
|
||||
{
|
||||
_glfw.glfwSetMonitorUserPointer(monitor, pointer);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor)
|
||||
{
|
||||
return _glfw.glfwGetMonitorUserPointer(monitor);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetMonitorCallback(
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetMonitorCallback(callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count)
|
||||
{
|
||||
return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor)
|
||||
{
|
||||
return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma)
|
||||
{
|
||||
_glfw.glfwSetGamma(monitor, gamma);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor)
|
||||
{
|
||||
return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp)
|
||||
{
|
||||
_glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwDefaultWindowHints()
|
||||
{
|
||||
_glfw.glfwDefaultWindowHints();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwWindowHint(int hint, int value)
|
||||
{
|
||||
_glfw.glfwWindowHint(hint, value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwWindowHintString(int hint, byte* value)
|
||||
{
|
||||
_glfw.glfwWindowHintString(hint, value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr glfwCreateWindow(
|
||||
int width,
|
||||
int height,
|
||||
Span<byte> title,
|
||||
IntPtr monitor,
|
||||
IntPtr share)
|
||||
{
|
||||
fixed (byte* titlePtr = title) {
|
||||
return _glfw.glfwCreateWindow(width, height, titlePtr, monitor, share);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwDestroyWindow(IntPtr window)
|
||||
{
|
||||
_glfw.glfwDestroyWindow(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwWindowShouldClose(IntPtr window)
|
||||
{
|
||||
return _glfw.glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value)
|
||||
{
|
||||
_glfw.glfwSetWindowShouldClose(window, value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title)
|
||||
{
|
||||
_glfw.glfwSetWindowTitle(window, title);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images)
|
||||
{
|
||||
_glfw.glfwSetWindowIcon(window, count, (IntPtr)images);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos)
|
||||
{
|
||||
_glfw.glfwGetWindowPos(window, xpos, ypos);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos)
|
||||
{
|
||||
_glfw.glfwSetWindowPos(window, xpos, ypos);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height)
|
||||
{
|
||||
_glfw.glfwGetWindowSize(window, width, height);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowSizeLimits(
|
||||
IntPtr window,
|
||||
int minwidth,
|
||||
int minheight,
|
||||
int maxwidth,
|
||||
int maxheight)
|
||||
{
|
||||
_glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom)
|
||||
{
|
||||
_glfw.glfwSetWindowAspectRatio(window, numer, denom);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height)
|
||||
{
|
||||
_glfw.glfwSetWindowSize(window, width, height);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height)
|
||||
{
|
||||
_glfw.glfwGetFrameBufferSize(window, width, height);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom)
|
||||
{
|
||||
_glfw.glfwGetWindowFrameSize(window, left, top, right, bottom);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale)
|
||||
{
|
||||
_glfw.glfwGetWindowContentScale(window, xscale, yscale);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe float glfwGetWindowOpacity(IntPtr window)
|
||||
{
|
||||
return _glfw.glfwGetWindowOpacity(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity)
|
||||
{
|
||||
_glfw.glfwSetWindowOpacity(window, opacity);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwIconifyWindow(IntPtr window)
|
||||
{
|
||||
_glfw.glfwIconifyWindow(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwRestoreWindow(IntPtr window)
|
||||
{
|
||||
_glfw.glfwRestoreWindow(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwMaximizeWindow(IntPtr window)
|
||||
{
|
||||
_glfw.glfwMaximizeWindow(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwShowWindow(IntPtr window)
|
||||
{
|
||||
_glfw.glfwShowWindow(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwHideWindow(IntPtr window)
|
||||
{
|
||||
_glfw.glfwHideWindow(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwFocusWindow(IntPtr window)
|
||||
{
|
||||
_glfw.glfwFocusWindow(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwRequestWindowAttention(IntPtr window)
|
||||
{
|
||||
_glfw.glfwRequestWindowAttention(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window)
|
||||
{
|
||||
return _glfw.glfwGetWindowMonitor(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowMonitor(
|
||||
IntPtr window,
|
||||
IntPtr monitor,
|
||||
int xpos,
|
||||
int ypos,
|
||||
int width,
|
||||
int height,
|
||||
int refreshRate)
|
||||
{
|
||||
_glfw.glfwSetWindowMonitor(window, monitor, xpos, ypos, width, height, refreshRate);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib)
|
||||
{
|
||||
return _glfw.glfwGetWindowAttrib(window, attrib);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value)
|
||||
{
|
||||
_glfw.glfwSetWindowAttrib(window, attrib, value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer)
|
||||
{
|
||||
_glfw.glfwSetWindowUserPointer(window, pointer);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void* glfwGetWindowUserPointer(IntPtr window)
|
||||
{
|
||||
return _glfw.glfwGetWindowUserPointer(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowPosCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetWindowPosCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowSizeCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetWindowSizeCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowCloseCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetWindowCloseCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowRefreshCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetWindowRefreshCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowFocusCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetWindowFocusCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowIconifyCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetWindowIconifyCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowMaximizeCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetWindowMaximizeCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetFrameBufferSizeCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetFramebufferSizeCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, float, float, void> glfwSetWindowContentScaleCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, float, float, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetWindowContentScaleCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwPollEvents()
|
||||
{
|
||||
_glfw.glfwPollEvents();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwWaitEvents()
|
||||
{
|
||||
_glfw.glfwWaitEvents();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwWaitEventsTimeout(double timeout)
|
||||
{
|
||||
_glfw.glfwWaitEventsTimeout(timeout);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwPostEmptyEvent()
|
||||
{
|
||||
_glfw.glfwPostEmptyEvent();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwGetInputMode(IntPtr window, int mode)
|
||||
{
|
||||
return _glfw.glfwGetInputMode(window, mode);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value)
|
||||
{
|
||||
_glfw.glfwSetInputMode(window, mode, value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwRawMouseMotionSupported()
|
||||
{
|
||||
return _glfw.glfwRawMouseMotionSupported();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetKeyName(int key, int scancode)
|
||||
{
|
||||
return _glfw.glfwGetKeyName(key, scancode);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwGetKeyScancode(int key)
|
||||
{
|
||||
return _glfw.glfwGetKeyScancode(key);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key)
|
||||
{
|
||||
return _glfw.glfwGetKey(window, key);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwGetMouseButton(IntPtr window, int button)
|
||||
{
|
||||
return _glfw.glfwGetMouseButton(window, button);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos)
|
||||
{
|
||||
_glfw.glfwGetCursorPos(window, xpos, ypos);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos)
|
||||
{
|
||||
_glfw.glfwSetCursorPos(window, xpos, ypos);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot)
|
||||
{
|
||||
return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr glfwCreateStandardCursor(int shape)
|
||||
{
|
||||
return _glfw.glfwCreateStandardCursor(shape);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwDestroyCursor(IntPtr cursor)
|
||||
{
|
||||
_glfw.glfwDestroyCursor(cursor);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor)
|
||||
{
|
||||
_glfw.glfwSetCursor(window, cursor);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, int, int, int, void> glfwSetKeyCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, int, int, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetKeyCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, uint, void> glfwSetCharCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, uint, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetCharCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, uint, int, void> glfwSetCharModsCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, uint, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetCharModsCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, int, int, void> glfwSetMouseButtonCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, int, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetMouseButtonCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, double, double, void> glfwSetCursorPosCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, double, double, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetCursorPosCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetCursorEnterCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetCursorEnterCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, double, double, void> glfwSetScrollCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, double, double, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetScrollCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void> glfwSetDropCallback(
|
||||
IntPtr window,
|
||||
delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetDropCallback(window, callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwJoystickPresent(int jid)
|
||||
{
|
||||
return _glfw.glfwJoystickPresent(jid);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe float* glfwGetJoystickAxes(int jid, int* count)
|
||||
{
|
||||
return _glfw.glfwGetJoystickAxes(jid, count);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count)
|
||||
{
|
||||
return _glfw.glfwGetJoystickButtons(jid, count);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetJoystickHats(int jid, int* count)
|
||||
{
|
||||
return _glfw.glfwGetJoystickHats(jid, count);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetJoystickName(int jid)
|
||||
{
|
||||
return _glfw.glfwGetJoystickName(jid);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetJoystickGUID(int jid)
|
||||
{
|
||||
return _glfw.glfwGetJoystickGUID(jid);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer)
|
||||
{
|
||||
_glfw.glfwSetJoystickUserPointer(jid, pointer);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void* glfwGetJoystickUserPointer(int jid)
|
||||
{
|
||||
return _glfw.glfwGetJoystickUserPointer(jid);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwJoystickIsGamepad(int jid)
|
||||
{
|
||||
return _glfw.glfwJoystickIsGamePad(jid);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe delegate* unmanaged[Cdecl]<int, int, void> glfwSetJoystickCallback(
|
||||
delegate* unmanaged[Cdecl]<int, int, void> callback)
|
||||
{
|
||||
return _glfw.glfwSetJoystickCallback(callback);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwUpdateGamePadMappings(byte* str)
|
||||
{
|
||||
return _glfw.glfwUpdateGamePadMappings(str);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetGamePadName(int jid)
|
||||
{
|
||||
return _glfw.glfwGetGamepadName(jid);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwGetGamePadState(int jid, GLFWgamepadstate* state)
|
||||
{
|
||||
return _glfw.glfwGetGamepadState(jid, (IntPtr)state);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str)
|
||||
{
|
||||
_glfw.glfwSetClipboardString(window, str);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte* glfwGetClipboardString(IntPtr window)
|
||||
{
|
||||
return _glfw.glfwGetClipboardString(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe double glfwGetTime()
|
||||
{
|
||||
return _glfw.glfwGetTime();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSetTime(double time)
|
||||
{
|
||||
_glfw.glfwSetTime(time);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe ulong glfwGetTimerValue()
|
||||
{
|
||||
return _glfw.glfwGetTimerValue();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe ulong glfwGetTimerFrequency()
|
||||
{
|
||||
return _glfw.glfwGetTimerFrequency();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwMakeContextCurrent(IntPtr window)
|
||||
{
|
||||
_glfw.glfwMakeContextCurrent(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr glfwGetCurrentContext()
|
||||
{
|
||||
return _glfw.glfwGetCurrentContext();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSwapBuffers(IntPtr window)
|
||||
{
|
||||
_glfw.glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe void glfwSwapInterval(int interval)
|
||||
{
|
||||
_glfw.glfwSwapInterval(interval);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwExtensionSupported(byte* extension)
|
||||
{
|
||||
return _glfw.glfwExtensionSupported(extension);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr glfwGetProcAddress(string procName)
|
||||
{
|
||||
return glfwGetProcAddress(Encoding.UTF8.GetBytes(procName));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe IntPtr glfwGetProcAddress(Span<byte> procName)
|
||||
{
|
||||
fixed (byte* bPtr = procName) {
|
||||
return _glfw.glfwGetProcAddress(bPtr);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe int glfwVulkanSupported()
|
||||
{
|
||||
return _glfw.glfwVulkanSupported();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count)
|
||||
{
|
||||
return _glfw.glfwGetRequiredInstanceExtensions(count);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="glfwFunction.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the ¡°Software¡±), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED ¡°AS IS¡±,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Internal
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct GLFWFunction
|
||||
{
|
||||
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int, IntPtr> glfwCreateCursor;
|
||||
public delegate* unmanaged[Cdecl]<int, IntPtr> glfwCreateStandardCursor;
|
||||
public delegate* unmanaged[Cdecl]<int, int, byte*, IntPtr, IntPtr, IntPtr> glfwCreateWindow;
|
||||
public delegate* unmanaged[Cdecl]<void> glfwDefaultWindowHints;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwDestroyCursor;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwDestroyWindow;
|
||||
public delegate* unmanaged[Cdecl]<byte*, int> glfwExtensionSupported;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwFocusWindow;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, byte*> glfwGetClipboardString;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr> glfwGetCurrentContext;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, double*, double*, void> glfwGetCursorPos;
|
||||
public delegate* unmanaged[Cdecl]<byte**, int> glfwGetError;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetFrameBufferSize;
|
||||
public delegate* unmanaged[Cdecl]<int, byte*> glfwGetGamepadName;
|
||||
public delegate* unmanaged[Cdecl]<int, IntPtr, int> glfwGetGamepadState;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr> glfwGetGammaRamp;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int> glfwGetInputMode;
|
||||
public delegate* unmanaged[Cdecl]<int, int*, float*> glfwGetJoystickAxes;
|
||||
public delegate* unmanaged[Cdecl]<int, int*, byte*> glfwGetJoystickButtons;
|
||||
public delegate* unmanaged[Cdecl]<int, byte*> glfwGetJoystickGUID;
|
||||
public delegate* unmanaged[Cdecl]<int, int*, byte*> glfwGetJoystickHats;
|
||||
public delegate* unmanaged[Cdecl]<int, byte*> glfwGetJoystickName;
|
||||
public delegate* unmanaged[Cdecl]<int, void*> glfwGetJoystickUserPointer;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, KeyStatus> glfwGetKey;
|
||||
public delegate* unmanaged[Cdecl]<int, int, byte*> glfwGetKeyName;
|
||||
public delegate* unmanaged[Cdecl]<int, int> glfwGetKeyScancode;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, float*, float*, void> glfwGetMonitorContentScale;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, byte*> glfwGetMonitorName;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetMonitorPhysicalSize;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetMonitorPos;
|
||||
public delegate* unmanaged[Cdecl]<int*, IntPtr*> glfwGetMonitors;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void*> glfwGetMonitorUserPointer;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, int*, int*, void> glfwGetMonitorWorkarea;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int> glfwGetMouseButton;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr> glfwGetPrimaryMonitor;
|
||||
public delegate* unmanaged[Cdecl]<byte*, IntPtr> glfwGetProcAddress;
|
||||
public delegate* unmanaged[Cdecl]<uint*, byte**> glfwGetRequiredInstanceExtensions;
|
||||
public delegate* unmanaged[Cdecl]<double> glfwGetTime;
|
||||
public delegate* unmanaged[Cdecl]<ulong> glfwGetTimerFrequency;
|
||||
public delegate* unmanaged[Cdecl]<ulong> glfwGetTimerValue;
|
||||
public delegate* unmanaged[Cdecl]<int*, int*, int*, void> glfwGetVersion;
|
||||
public delegate* unmanaged[Cdecl]<byte*> glfwGetVersionString;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr> glfwGetVideoMode;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int*, IntPtr*> glfwGetVideoModes;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int> glfwGetWindowAttrib;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, float*, float*, void> glfwGetWindowContentScale;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, int*, int*, void> glfwGetWindowFrameSize;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr> glfwGetWindowMonitor;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, float> glfwGetWindowOpacity;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetWindowPos;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetWindowSize;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void*> glfwGetWindowUserPointer;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwHideWindow;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwIconifyWindow;
|
||||
public delegate* unmanaged[Cdecl]<int> glfwInit;
|
||||
public delegate* unmanaged[Cdecl]<int, int, void> glfwInitHint;
|
||||
public delegate* unmanaged[Cdecl]<int, int> glfwJoystickIsGamePad;
|
||||
public delegate* unmanaged[Cdecl]<int, int> glfwJoystickPresent;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwMakeContextCurrent;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwMaximizeWindow;
|
||||
public delegate* unmanaged[Cdecl]<void> glfwPollEvents;
|
||||
public delegate* unmanaged[Cdecl]<void> glfwPostEmptyEvent;
|
||||
public delegate* unmanaged[Cdecl]<int> glfwRawMouseMotionSupported;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwRequestWindowAttention;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwRestoreWindow;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, uint, void>, delegate* unmanaged[Cdecl]<IntPtr, uint, void>> glfwSetCharCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, uint, int, void>, delegate* unmanaged[Cdecl]<IntPtr, uint, int, void>> glfwSetCharModsCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, byte*, void> glfwSetClipboardString;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr, void> glfwSetCursor;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetCursorEnterCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, double, double, void> glfwSetCursorPos;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>> glfwSetCursorPosCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void>, delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void>> glfwSetDropCallback;
|
||||
public delegate* unmanaged[Cdecl]<delegate* unmanaged[Cdecl]<int, byte*, void>, delegate* unmanaged[Cdecl]<int, byte*, void>> glfwSetErrorCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>> glfwSetFramebufferSizeCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, float, void> glfwSetGamma;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr, void> glfwSetGammaRamp;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetInputMode;
|
||||
public delegate* unmanaged[Cdecl]<delegate* unmanaged[Cdecl]<int, int, void>, delegate* unmanaged[Cdecl]<int, int, void>> glfwSetJoystickCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void*, void> glfwSetJoystickUserPointer;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, int, int, void>> glfwSetKeyCallback;
|
||||
public delegate* unmanaged[Cdecl]<delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetMonitorCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void*, void> glfwSetMonitorUserPointer;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, int, void>> glfwSetMouseButtonCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>> glfwSetScrollCallback;
|
||||
public delegate* unmanaged[Cdecl]<double, void> glfwSetTime;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowAspectRatio;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowAttrib;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, void>, delegate* unmanaged[Cdecl]<IntPtr, void>> glfwSetWindowCloseCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, float, float, void>, delegate* unmanaged[Cdecl]<IntPtr, float, float, void>> glfwSetWindowContentScaleCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetWindowFocusCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, IntPtr, void> glfwSetWindowIcon;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetWindowIconifyCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetWindowMaximizeCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr, int, int, int, int, int, void> glfwSetWindowMonitor;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, float, void> glfwSetWindowOpacity;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowPos;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>> glfwSetWindowPosCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, void>, delegate* unmanaged[Cdecl]<IntPtr, void>> glfwSetWindowRefreshCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowShouldClose;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowSize;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>> glfwSetWindowSizeCallback;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int, int, int, int, void> glfwSetWindowSizeLimits;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, byte*, void> glfwSetWindowTitle;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void*, void> glfwSetWindowUserPointer;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwShowWindow;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwSwapBuffers;
|
||||
public delegate* unmanaged[Cdecl]<int, void> glfwSwapInterval;
|
||||
public delegate* unmanaged[Cdecl]<void> glfwTerminate;
|
||||
public delegate* unmanaged[Cdecl]<byte*, int> glfwUpdateGamePadMappings;
|
||||
public delegate* unmanaged[Cdecl]<int> glfwVulkanSupported;
|
||||
public delegate* unmanaged[Cdecl]<void> glfwWaitEvents;
|
||||
public delegate* unmanaged[Cdecl]<double, void> glfwWaitEventsTimeout;
|
||||
public delegate* unmanaged[Cdecl]<int, int, void> glfwWindowHint;
|
||||
public delegate* unmanaged[Cdecl]<int, byte*, void> glfwWindowHintString;
|
||||
public delegate* unmanaged[Cdecl]<IntPtr, int> glfwWindowShouldClose;
|
||||
|
||||
public GLFWFunction()
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="publicType.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public enum LogType
|
||||
{
|
||||
|
||||
Error,
|
||||
Warning,
|
||||
Info,
|
||||
InfoError,
|
||||
InfoWarning,
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user