add from giga-device, new branch added

This commit is contained in:
Nitload Youmu
2025-08-21 16:51:25 +08:00
commit 43bbc06bbb
1296 changed files with 264186 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.IntelliRush.Options.IntelliRushOptions">
<Options Language="Neutral">
<Enabled>True</Enabled>
<DisabledLanguages />
</Options>
</Root>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.CodeRush.VisualizePlugins.RightMarginLine.Options.RightMarginLineOptions">
<Options Language="Neutral">
<Enabled>True</Enabled>
</Options>
</Root>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.CodeRush.VSFeatures.SpellChecker.Options.SpellCheckerOptions">
<Options Language="Neutral">
<SupportedElements>XmlComments|Comments|Strings|VerbatimStrings|PublicIdentifiers|InternalIdentifiers|ProtectedInternalIdentifiers|ProtectedIdentifiers|PrivateIdentifiers|LocalIdentifiers|FileNames</SupportedElements>
</Options>
</Root>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.CodeRush.Foundation.CodePlaces.Options.FavoritesListContainer">
<Options Language="Neutral">
<Groups />
</Options>
</Root>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.CodeRush.VisualStudio.Services.Options.BuildEngineOptions">
<Options Language="Neutral">
<Enabled>True</Enabled>
</Options>
</Root>
+58
View File
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Root Type="DevExpress.CodeRush.Foundation.Shortcuts.ShortcutsOptions">
<Options Language="Neutral">
<RootFolder>
<SubFolders>
<Item Id="{01ea3896-6cc1-4912-824e-88c7c5a82a25}">
<Bindings>
<Item Id="{88959174-9ffa-429b-bef8-aeddb65b9c2a}" />
<Item Id="{975814d0-802e-4143-a979-22d3f975cfc2}" />
<Item Id="{0260c6ac-cfdb-4874-88c5-66bbf9b84e9b}" />
<Item Id="{dd4ceb84-80b3-4517-ac9b-170dcffe646f}" />
<Item Id="{a1f4a77e-b674-41bd-880f-195c3c0c1dfe}" />
<Item Id="{ee0b4600-2d2c-4700-8d4d-578027321f74}" />
<Item Id="{d37c2c40-a7c6-403f-8556-8fb690d4c656}">
<Enabled>False</Enabled>
</Item>
<Item Id="{baf8010d-02d7-4ac9-b644-0c670f796ce4}" />
<Item Id="{676742ae-19ea-4884-840d-2be66d9bb49c}" />
<Item Id="{43d481e0-19e4-405d-b7e3-687fc610050c}">
<Enabled>False</Enabled>
</Item>
<Item Id="{f1a06e4e-3241-438d-84e5-044e3e907492}" />
<Item Id="{3b8cae25-e23f-443c-98ff-83d38711f26e}" />
<Item Id="{491253a6-324c-4a0f-b4e5-aff443b00fb9}" />
<Item Id="{a06ba470-2048-47ac-b7af-93653ce09359}" />
<Item Id="{1562ccb9-7f21-492d-8c71-42d5ff7ecf9a}" />
<Item Id="{34c575e6-55c2-4d7f-a839-8167bfa1a831}" />
<Item Id="{b253a65c-b13a-42bd-8d59-4a790ce19f3a}" />
<Item Id="{011d4fb6-22ba-4d11-8a05-ed753b5dbd8a}" />
<Item Id="{804634ae-7823-4541-a8fe-d7da6c807b41}" />
<Item Id="{eb8a243c-8645-46cf-98ac-e73a6e32cf3e}" />
<Item Id="{5f2e52af-bb7d-46cc-819d-3f2a2860ba8c}" />
<Item Id="{9848d5d7-d513-4f1e-98aa-fcd21b3eb498}" />
</Bindings>
</Item>
<Item Id="{66d31aae-e1f0-43b9-8108-123cb59d73bd}" />
<Item Id="{4fcfb46a-6fd9-4ba4-a790-6447cb1cf0a5}" />
<Item Id="{55d41133-671c-49f1-a934-6c5d59c3f319}">
<SubFolders>
<Item Id="{4bc2f87d-6dc0-41b5-9b0b-251498b765df}">
<Bindings>
<Item Id="{d18a79d1-fff5-4b71-8301-fb8f2397e0ac}" />
<Item Id="{cc238591-6417-4f4c-bca3-08b8ecbb8a1b}">
<Enabled>False</Enabled>
</Item>
</Bindings>
</Item>
<Item Id="{0d070b5c-9bc8-4784-9071-548ab0ef93e9}" />
</SubFolders>
</Item>
<Item Id="{a3f2b3b4-9497-4db5-9f8b-c4b30a2240ac}" />
<Item Id="{318b8900-85af-4c66-b37f-8a86508e7a89}" />
<Item Id="{d33fb6fa-56b3-40a1-b169-71e855b2e3a2}" />
<Item Id="{4aa0656f-7150-440b-8585-509c548e9d7e}" />
</SubFolders>
</RootFolder>
</Options>
</Root>
+143
View File
@@ -0,0 +1,143 @@
# 禁用所有“代码样式”规则
dotnet_analyzer_diagnostic.category-Style.severity = none
# 禁用所有“命名”规则
dotnet_analyzer_diagnostic.category-Naming.severity = none
[*.cs]
# CS1591: 缺少对公共可见类型或成员的 XML 注释
dotnet_diagnostic.CS1591.severity = suggestion
[*.cs]
#### 命名样式 ####
# 命名规则
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# 符号规范
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# 命名样式
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
csharp_using_directive_placement = outside_namespace:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent
csharp_style_var_elsewhere = false:silent
csharp_prefer_simple_using_statement = false:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = false:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_static_local_function = true:suggestion
csharp_prefer_static_anonymous_function = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_space_around_binary_operators = before_and_after
csharp_indent_labels = one_less_than_current
[*.vb]
#### 命名样式 ####
# 命名规则
dotnet_naming_rule.interface_should_be_以_i_开始.severity = suggestion
dotnet_naming_rule.interface_should_be_以_i_开始.symbols = interface
dotnet_naming_rule.interface_should_be_以_i_开始.style = 以_i_开始
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.severity = suggestion
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.symbols = 类型
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.style = 帕斯卡拼写法
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.severity = suggestion
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.symbols = 非字段成员
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.style = 帕斯卡拼写法
# 符号规范
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.类型.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.类型.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.类型.required_modifiers =
dotnet_naming_symbols.非字段成员.applicable_kinds = property, event, method
dotnet_naming_symbols.非字段成员.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.非字段成员.required_modifiers =
# 命名样式
dotnet_naming_style.以_i_开始.required_prefix = I
dotnet_naming_style.以_i_开始.required_suffix =
dotnet_naming_style.以_i_开始.word_separator =
dotnet_naming_style.以_i_开始.capitalization = pascal_case
dotnet_naming_style.帕斯卡拼写法.required_prefix =
dotnet_naming_style.帕斯卡拼写法.required_suffix =
dotnet_naming_style.帕斯卡拼写法.word_separator =
dotnet_naming_style.帕斯卡拼写法.capitalization = pascal_case
dotnet_naming_style.帕斯卡拼写法.required_prefix =
dotnet_naming_style.帕斯卡拼写法.required_suffix =
dotnet_naming_style.帕斯卡拼写法.word_separator =
dotnet_naming_style.帕斯卡拼写法.capitalization = pascal_case
[*.{cs,vb}]
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
end_of_line = crlf
tab_width = 4
indent_size = 4
dotnet_style_operator_placement_when_wrapping = beginning_of_line
+3
View File
@@ -0,0 +1,3 @@
{
"help":"https://go.microsoft.com/fwlink/?linkid=866610"
}
+13
View File
@@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/.idea.StgSharpDevelop.iml
/contentModel.xml
/modules.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
+1
View File
@@ -0,0 +1 @@
StgSharpDevelop
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/StgSharp.Common/Stg/Bullet.cs" charset="UTF-8" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
@@ -0,0 +1,21 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit");
table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate");
table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint");
table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString");
table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError");
table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors");
table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor");
table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos");
table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow");
table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow");
table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose");
table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose");
table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents");
table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers");
table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress");
}
@@ -0,0 +1,3 @@
#include "StgSharpNative.h"
#include "glfw_function_table.h"
#include <string.h>
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,486 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
[LibraryImport(NativeLibName, EntryPoint = "glfwInit")]
internal static unsafe partial int glfwInit();
[LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")]
internal static unsafe partial void glfwTerminate();
[LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")]
internal static unsafe partial void glfwInitHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")]
internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")]
internal static unsafe partial byte* glfwGetVersionString();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetError")]
internal static unsafe partial int glfwGetError(byte** description);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")]
internal static unsafe partial delegate*<int,byte*,void> glfwSetErrorCallback(
delegate*<int,byte*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")]
internal static unsafe partial IntPtr* glfwGetMonitors(int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")]
internal static unsafe partial IntPtr glfwGetPrimaryMonitor();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")]
internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")]
internal static unsafe partial void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")]
internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")]
internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")]
internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")]
internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")]
internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetMonitorCallback(
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")]
internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")]
internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")]
internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")]
internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")]
internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp);
[LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")]
internal static unsafe partial void glfwDefaultWindowHints();
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")]
internal static unsafe partial void glfwWindowHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")]
internal static unsafe partial void glfwWindowHintString(int hint, byte* value);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")]
internal static unsafe partial IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")]
internal static unsafe partial void glfwDestroyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")]
internal static unsafe partial int glfwWindowShouldClose(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")]
internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")]
internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")]
internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")]
internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")]
internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")]
internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")]
internal static unsafe partial void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")]
internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")]
internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")]
internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")]
internal static unsafe partial void glfwGetWindowFrameSize(
IntPtr window,
int* left,
int* top,
int* right,
int* bottom);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")]
internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")]
internal static unsafe partial float glfwGetWindowOpacity(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")]
internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity);
[LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")]
internal static unsafe partial void glfwIconifyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")]
internal static unsafe partial void glfwRestoreWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")]
internal static unsafe partial void glfwMaximizeWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")]
internal static unsafe partial void glfwShowWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")]
internal static unsafe partial void glfwHideWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")]
internal static unsafe partial void glfwFocusWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")]
internal static unsafe partial void glfwRequestWindowAttention(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")]
internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")]
internal static unsafe partial void glfwSetWindowMonitor(
IntPtr window,
IntPtr monitor,
int xpos,
int ypos,
int width,
int height,
int refreshRate);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")]
internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")]
internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")]
internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")]
internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")]
internal static unsafe partial delegate*<glfwWindow*,void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")]
internal static unsafe partial delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")]
internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")]
internal static unsafe partial delegate*<glfwWindow*, float,float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float,float> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")]
internal static unsafe partial void glfwPollEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")]
internal static unsafe partial void glfwWaitEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")]
internal static unsafe partial void glfwWaitEventsTimeout(double timeout);
[LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")]
internal static unsafe partial void glfwPostEmptyEvent();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")]
internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")]
internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")]
internal static unsafe partial int glfwRawMouseMotionSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")]
internal static unsafe partial byte* glfwGetKeyName(int key, int scancode);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")]
internal static unsafe partial int glfwGetKeyScancode(int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")]
internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")]
internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")]
internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")]
internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")]
internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")]
internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")]
internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")]
internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,int,void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")]
internal static unsafe partial delegate*<glfwWindow*,uint,void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*,uint,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,byte**,void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*,int,byte**,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")]
internal static unsafe partial int glfwJoystickPresent(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")]
internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")]
internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")]
internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")]
internal static unsafe partial byte* glfwGetJoystickName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")]
internal static unsafe partial byte* glfwGetJoystickGUID(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")]
internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")]
internal static unsafe partial void* glfwGetJoystickUserPointer(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")]
internal static unsafe partial int glfwJoystickIsGamepad(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")]
internal static unsafe partial delegate*<int,int,void> glfwSetJoystickCallback(delegate*<int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")]
internal static unsafe partial int glfwUpdateGamepadMappings(byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")]
internal static unsafe partial byte* glfwGetGamepadName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")]
internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")]
internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")]
internal static unsafe partial byte* glfwGetClipboardString(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")]
internal static unsafe partial double glfwGetTime();
[LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")]
internal static unsafe partial void glfwSetTime(double time);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")]
internal static unsafe partial ulong* glfwGetTimerValue();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")]
internal static unsafe partial ulong* glfwGetTimerFrequency();
[LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")]
internal static unsafe partial void glfwMakeContextCurrent(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")]
internal static unsafe partial IntPtr glfwGetCurrentContext();
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")]
internal static unsafe partial void glfwSwapBuffers(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")]
internal static unsafe partial void glfwSwapInterval(int interval);
[LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")]
internal static unsafe partial int glfwExtensionSupported(byte* extension);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)]
internal static unsafe partial IntPtr glfwGetProcAddress(string procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")]
internal static unsafe partial int glfwVulkanSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")]
internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,156 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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]<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]<int, 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;
}
}
@@ -0,0 +1,57 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunctionTable
{
public delegate* unmanaged[Cdecl]<int, int, byte*, IntPtr, IntPtr, IntPtr> glfwCreateWindow;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwDestroyWindow;
public delegate* unmanaged[Cdecl]<byte**, int> glfwGetError;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetMonitorPos;
public delegate* unmanaged[Cdecl]<int*, IntPtr*> glfwGetMonitors;
public delegate* unmanaged[Cdecl]<IntPtr> glfwGetPrimaryMonitor;
public delegate* unmanaged[Cdecl]<byte*, IntPtr> glfwGetProcAddress;
public delegate* unmanaged[Cdecl]<byte*> glfwGetVersionString;
public delegate* unmanaged[Cdecl]<int> glfwInit;
public delegate* unmanaged[Cdecl]<int, int, void> glfwInitHint;
public delegate* unmanaged[Cdecl]<void> glfwPollEvents;
public delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowShouldClose;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwSwapBuffers;
public delegate* unmanaged[Cdecl]<void> glfwTerminate;
public delegate* unmanaged[Cdecl]<IntPtr, int> glfwWindowShouldClose;
}
}
@@ -0,0 +1,692 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
internal static unsafe int glfwInit()
{
return _glfw.glfwInit();
}
internal static unsafe void glfwTerminate()
{
_glfw.glfwTerminate();
}
internal static unsafe void glfwInitHint(int hint, int value)
{
_glfw.glfwInitHint(hint, value);
}
internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev)
{
_glfw.glfwGetVersion(major, minor, rev);
}
internal static unsafe byte* glfwGetVersionString()
{
return _glfw.glfwGetVersionString();
}
internal static unsafe int glfwGetError(byte** description)
{
return _glfw.glfwGetError(description);
}
internal static unsafe delegate* unmanaged[Cdecl]<int, byte*, void> glfwSetErrorCallback(
delegate* unmanaged[Cdecl]<int, byte*, void> callback)
{
return _glfw.glfwSetErrorCallback(callback);
}
internal static unsafe IntPtr* glfwGetMonitors(int* count)
{
return _glfw.glfwGetMonitors(count);
}
internal static unsafe IntPtr glfwGetPrimaryMonitor()
{
return _glfw.glfwGetPrimaryMonitor();
}
internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos)
{
_glfw.glfwGetMonitorPos(monitor, xpos, ypos);
}
internal static unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height)
{
_glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height);
}
internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM)
{
_glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM);
}
internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale)
{
_glfw.glfwGetMonitorContentScale(monitor, xscale, yscale);
}
internal static unsafe byte* glfwGetMonitorName(IntPtr monitor)
{
return _glfw.glfwGetMonitorName(monitor);
}
internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer)
{
_glfw.glfwSetMonitorUserPointer(monitor, pointer);
}
internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor)
{
return _glfw.glfwGetMonitorUserPointer(monitor);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetMonitorCallback(
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetMonitorCallback(callback);
}
internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count)
{
return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count);
}
internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor)
{
return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor);
}
internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma)
{
_glfw.glfwSetGamma(monitor, gamma);
}
internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor)
{
return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor);
}
internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp)
{
_glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp);
}
internal static unsafe void glfwDefaultWindowHints()
{
_glfw.glfwDefaultWindowHints();
}
internal static unsafe void glfwWindowHint(int hint, int value)
{
_glfw.glfwWindowHint(hint, value);
}
internal static unsafe void glfwWindowHintString(int hint, byte* value)
{
_glfw.glfwWindowHintString(hint, value);
}
internal static unsafe IntPtr glfwCreateWindow(int width, int height, byte* title, IntPtr monitor, IntPtr share)
{
return _glfw.glfwCreateWindow(width, height, title, monitor, share);
}
internal static unsafe void glfwDestroyWindow(IntPtr window)
{
_glfw.glfwDestroyWindow(window);
}
internal static unsafe int glfwWindowShouldClose(IntPtr window)
{
return _glfw.glfwWindowShouldClose(window);
}
internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value)
{
_glfw.glfwSetWindowShouldClose(window, value);
}
internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title)
{
_glfw.glfwSetWindowTitle(window, title);
}
internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images)
{
_glfw.glfwSetWindowIcon(window, count, (IntPtr)images);
}
internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos)
{
_glfw.glfwGetWindowPos(window, xpos, ypos);
}
internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos)
{
_glfw.glfwSetWindowPos(window, xpos, ypos);
}
internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height)
{
_glfw.glfwGetWindowSize(window, width, height);
}
internal static unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight)
{
_glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight);
}
internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom)
{
_glfw.glfwSetWindowAspectRatio(window, numer, denom);
}
internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height)
{
_glfw.glfwSetWindowSize(window, width, height);
}
internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height)
{
_glfw.glfwGetFramebufferSize(window, width, height);
}
internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom)
{
_glfw.glfwGetWindowFrameSize(window, left, top, right, bottom);
}
internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale)
{
_glfw.glfwGetWindowContentScale(window, xscale, yscale);
}
internal static unsafe float glfwGetWindowOpacity(IntPtr window)
{
return _glfw.glfwGetWindowOpacity(window);
}
internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity)
{
_glfw.glfwSetWindowOpacity(window, opacity);
}
internal static unsafe void glfwIconifyWindow(IntPtr window)
{
_glfw.glfwIconifyWindow(window);
}
internal static unsafe void glfwRestoreWindow(IntPtr window)
{
_glfw.glfwRestoreWindow(window);
}
internal static unsafe void glfwMaximizeWindow(IntPtr window)
{
_glfw.glfwMaximizeWindow(window);
}
internal static unsafe void glfwShowWindow(IntPtr window)
{
_glfw.glfwShowWindow(window);
}
internal static unsafe void glfwHideWindow(IntPtr window)
{
_glfw.glfwHideWindow(window);
}
internal static unsafe void glfwFocusWindow(IntPtr window)
{
_glfw.glfwFocusWindow(window);
}
internal static unsafe void glfwRequestWindowAttention(IntPtr window)
{
_glfw.glfwRequestWindowAttention(window);
}
internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window)
{
return _glfw.glfwGetWindowMonitor(window);
}
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);
}
internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib)
{
return _glfw.glfwGetWindowAttrib(window, attrib);
}
internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value)
{
_glfw.glfwSetWindowAttrib(window, attrib, value);
}
internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer)
{
_glfw.glfwSetWindowUserPointer(window, pointer);
}
internal static unsafe void* glfwGetWindowUserPointer(IntPtr window)
{
return _glfw.glfwGetWindowUserPointer(window);
}
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);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowCloseCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
{
return _glfw.glfwSetWindowCloseCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
{
return _glfw.glfwSetWindowRefreshCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowFocusCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowFocusCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowIconifyCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowMaximizeCallback(window, callback);
}
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);
}
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);
}
internal static unsafe void glfwPollEvents()
{
_glfw.glfwPollEvents();
}
internal static unsafe void glfwWaitEvents()
{
_glfw.glfwWaitEvents();
}
internal static unsafe void glfwWaitEventsTimeout(double timeout)
{
_glfw.glfwWaitEventsTimeout(timeout);
}
internal static unsafe void glfwPostEmptyEvent()
{
_glfw.glfwPostEmptyEvent();
}
internal static unsafe int glfwGetInputMode(IntPtr window, int mode)
{
return _glfw.glfwGetInputMode(window, mode);
}
internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value)
{
_glfw.glfwSetInputMode(window, mode, value);
}
internal static unsafe int glfwRawMouseMotionSupported()
{
return _glfw.glfwRawMouseMotionSupported();
}
internal static unsafe byte* glfwGetKeyName(int key, int scancode)
{
return _glfw.glfwGetKeyName(key, scancode);
}
internal static unsafe int glfwGetKeyScancode(int key)
{
return _glfw.glfwGetKeyScancode(key);
}
internal static unsafe int glfwGetKey(IntPtr window, int key)
{
return _glfw.glfwGetKey(window, key);
}
internal static unsafe int glfwGetMouseButton(IntPtr window, int button)
{
return _glfw.glfwGetMouseButton(window, button);
}
internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos)
{
_glfw.glfwGetCursorPos(window, xpos, ypos);
}
internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos)
{
_glfw.glfwSetCursorPos(window, xpos, ypos);
}
internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot)
{
return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot);
}
internal static unsafe IntPtr glfwCreateStandardCursor(int shape)
{
return _glfw.glfwCreateStandardCursor(shape);
}
internal static unsafe void glfwDestroyCursor(IntPtr cursor)
{
_glfw.glfwDestroyCursor(cursor);
}
internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor)
{
_glfw.glfwSetCursor(window, cursor);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, uint, void> glfwSetCharCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, uint, void> callback)
{
return _glfw.glfwSetCharCallback(window, callback);
}
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);
}
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);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetCursorEnterCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetCursorEnterCallback(window, callback);
}
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);
}
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);
}
internal static unsafe int glfwJoystickPresent(int jid)
{
return _glfw.glfwJoystickPresent(jid);
}
internal static unsafe float* glfwGetJoystickAxes(int jid, int* count)
{
return _glfw.glfwGetJoystickAxes(jid, count);
}
internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count)
{
return _glfw.glfwGetJoystickButtons(jid, count);
}
internal static unsafe byte* glfwGetJoystickHats(int jid, int* count)
{
return _glfw.glfwGetJoystickHats(jid, count);
}
internal static unsafe byte* glfwGetJoystickName(int jid)
{
return _glfw.glfwGetJoystickName(jid);
}
internal static unsafe byte* glfwGetJoystickGUID(int jid)
{
return _glfw.glfwGetJoystickGUID(jid);
}
internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer)
{
_glfw.glfwSetJoystickUserPointer(jid, pointer);
}
internal static unsafe void* glfwGetJoystickUserPointer(int jid)
{
return _glfw.glfwGetJoystickUserPointer(jid);
}
internal static unsafe int glfwJoystickIsGamepad(int jid)
{
return _glfw.glfwJoystickIsGamepad(jid);
}
internal static unsafe delegate* unmanaged[Cdecl]<int, int, void> glfwSetJoystickCallback(
delegate* unmanaged[Cdecl]<int, int, void> callback)
{
return _glfw.glfwSetJoystickCallback(callback);
}
internal static unsafe int glfwUpdateGamepadMappings(byte* str)
{
return _glfw.glfwUpdateGamepadMappings(str);
}
internal static unsafe byte* glfwGetGamepadName(int jid)
{
return _glfw.glfwGetGamepadName(jid);
}
internal static unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
{
return _glfw.glfwGetGamepadState(jid, (IntPtr)state);
}
internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str)
{
_glfw.glfwSetClipboardString(window, str);
}
internal static unsafe byte* glfwGetClipboardString(IntPtr window)
{
return _glfw.glfwGetClipboardString(window);
}
internal static unsafe double glfwGetTime()
{
return _glfw.glfwGetTime();
}
internal static unsafe void glfwSetTime(double time)
{
_glfw.glfwSetTime(time);
}
internal static unsafe ulong glfwGetTimerValue()
{
return _glfw.glfwGetTimerValue();
}
internal static unsafe ulong glfwGetTimerFrequency()
{
return _glfw.glfwGetTimerFrequency();
}
internal static unsafe void glfwMakeContextCurrent(IntPtr window)
{
_glfw.glfwMakeContextCurrent(window);
}
internal static unsafe IntPtr glfwGetCurrentContext()
{
return _glfw.glfwGetCurrentContext();
}
internal static unsafe void glfwSwapBuffers(IntPtr window)
{
_glfw.glfwSwapBuffers(window);
}
internal static unsafe void glfwSwapInterval(int interval)
{
_glfw.glfwSwapInterval(interval);
}
internal static unsafe int glfwExtensionSupported(byte* extension)
{
return _glfw.glfwExtensionSupported(extension);
}
internal static unsafe IntPtr glfwGetProcAddress(byte* procname)
{
return _glfw.glfwGetProcAddress(procname);
}
internal static unsafe int glfwVulkanSupported()
{
return _glfw.glfwVulkanSupported();
}
internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count)
{
return _glfw.glfwGetRequiredInstanceExtensions(count);
}
#endregion
@@ -0,0 +1,122 @@
#include "StgSharpNative.h"
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwInit = glfwInit;
table->glfwTerminate = glfwTerminate;
table->glfwInitHint = glfwInitHint;
table->glfwGetVersion = glfwGetVersion;
table->glfwGetVersionString = glfwGetVersionString;
table->glfwGetError = glfwGetError;
table->glfwSetErrorCallback = glfwSetErrorCallback;
table->glfwGetMonitors = glfwGetMonitors;
table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor;
table->glfwGetMonitorPos = glfwGetMonitorPos;
table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea;
table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize;
table->glfwGetMonitorContentScale = glfwGetMonitorContentScale;
table->glfwGetMonitorName = glfwGetMonitorName;
table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer;
table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer;
table->glfwSetMonitorCallback = glfwSetMonitorCallback;
table->glfwGetVideoModes = glfwGetVideoModes;
table->glfwGetVideoMode = glfwGetVideoMode;
table->glfwSetGamma = glfwSetGamma;
table->glfwGetGammaRamp = glfwGetGammaRamp;
table->glfwSetGammaRamp = glfwSetGammaRamp;
table->glfwDefaultWindowHints = glfwDefaultWindowHints;
table->glfwWindowHint = glfwWindowHint;
table->glfwWindowHintString = glfwWindowHintString;
table->glfwCreateWindow = glfwCreateWindow;
table->glfwDestroyWindow = glfwDestroyWindow;
table->glfwWindowShouldClose = glfwWindowShouldClose;
table->glfwSetWindowShouldClose = glfwSetWindowShouldClose;
table->glfwSetWindowTitle = glfwSetWindowTitle;
table->glfwSetWindowIcon = glfwSetWindowIcon;
table->glfwGetWindowPos = glfwGetWindowPos;
table->glfwSetWindowPos = glfwSetWindowPos;
table->glfwGetWindowSize = glfwGetWindowSize;
table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits;
table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio;
table->glfwSetWindowSize = glfwSetWindowSize;
table->glfwGetFramebufferSize = glfwGetFramebufferSize;
table->glfwGetWindowFrameSize = glfwGetWindowFrameSize;
table->glfwGetWindowContentScale = glfwGetWindowContentScale;
table->glfwGetWindowOpacity = glfwGetWindowOpacity;
table->glfwSetWindowOpacity = glfwSetWindowOpacity;
table->glfwIconifyWindow = glfwIconifyWindow;
table->glfwRestoreWindow = glfwRestoreWindow;
table->glfwMaximizeWindow = glfwMaximizeWindow;
table->glfwShowWindow = glfwShowWindow;
table->glfwHideWindow = glfwHideWindow;
table->glfwFocusWindow = glfwFocusWindow;
table->glfwRequestWindowAttention = glfwRequestWindowAttention;
table->glfwGetWindowMonitor = glfwGetWindowMonitor;
table->glfwSetWindowMonitor = glfwSetWindowMonitor;
table->glfwGetWindowAttrib = glfwGetWindowAttrib;
table->glfwSetWindowAttrib = glfwSetWindowAttrib;
table->glfwSetWindowUserPointer = glfwSetWindowUserPointer;
table->glfwGetWindowUserPointer = glfwGetWindowUserPointer;
table->glfwSetWindowPosCallback = glfwSetWindowPosCallback;
table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback;
table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback;
table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback;
table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback;
table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback;
table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback;
table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback;
table->glfwPollEvents = glfwPollEvents;
table->glfwWaitEvents = glfwWaitEvents;
table->glfwWaitEventsTimeout = glfwWaitEventsTimeout;
table->glfwPostEmptyEvent = glfwPostEmptyEvent;
table->glfwGetInputMode = glfwGetInputMode;
table->glfwSetInputMode = glfwSetInputMode;
table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported;
table->glfwGetKeyName = glfwGetKeyName;
table->glfwGetKeyScancode = glfwGetKeyScancode;
table->glfwGetKey = glfwGetKey;
table->glfwGetMouseButton = glfwGetMouseButton;
table->glfwGetCursorPos = glfwGetCursorPos;
table->glfwSetCursorPos = glfwSetCursorPos;
table->glfwCreateCursor = glfwCreateCursor;
table->glfwCreateStandardCursor = glfwCreateStandardCursor;
table->glfwDestroyCursor = glfwDestroyCursor;
table->glfwSetCursor = glfwSetCursor;
table->glfwSetKeyCallback = glfwSetKeyCallback;
table->glfwSetCharCallback = glfwSetCharCallback;
table->glfwSetCharModsCallback = glfwSetCharModsCallback;
table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback;
table->glfwSetCursorPosCallback = glfwSetCursorPosCallback;
table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback;
table->glfwSetScrollCallback = glfwSetScrollCallback;
table->glfwSetDropCallback = glfwSetDropCallback;
table->glfwJoystickPresent = glfwJoystickPresent;
table->glfwGetJoystickAxes = glfwGetJoystickAxes;
table->glfwGetJoystickButtons = glfwGetJoystickButtons;
table->glfwGetJoystickGUID = glfwGetJoystickGUID;
table->glfwGetJoystickHats = glfwGetJoystickHats;
table->glfwGetJoystickName = glfwGetJoystickName;
table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer;
table->glfwJoystickIsGamepad = glfwJoystickIsGamepad;
table->glfwSetJoystickCallback = glfwSetJoystickCallback;
table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings;
table->glfwGetGamepadName = glfwGetGamepadName;
table->glfwGetGamepadState = glfwGetGamepadState;
table->glfwSetClipboardString = glfwSetClipboardString;
table->glfwGetClipboardString = glfwGetClipboardString;
table->glfwGetTime = glfwGetTime;
table->glfwSetTime = glfwSetTime;
table->glfwGetTimerValue = glfwGetTimerValue;
table->glfwGetTimerFrequency = glfwGetTimerFrequency;
table->glfwMakeContextCurrent = glfwMakeContextCurrent;
table->glfwGetCurrentContext = glfwGetCurrentContext;
table->glfwSwapBuffers = glfwSwapBuffers;
table->glfwSwapInterval = glfwSwapInterval;
table->glfwExtensionSupported = glfwExtensionSupported;
table->glfwGetProcAddress = glfwGetProcAddress;
table->glfwVulkanSupported = glfwVulkanSupported;
table->glfwGetRequiredInstanceExtensions = glfwGetRequiredInstanceExtensions;
}
@@ -0,0 +1,132 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwGetVersion)(int* major, int* minor, int* rev);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
void* (*glfwSetErrorCallback)(void* callback);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);
void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);
void* (*glfwSetMonitorCallback)(void* callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void* (*glfwSetWindowPosCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowSizeCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowCloseCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowRefreshCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowFocusCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowIconifyCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, void* callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
void* (*glfwSetKeyCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetCharCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetCharModsCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetMouseButtonCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetCursorPosCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetCursorEnterCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetScrollCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetDropCallback)(GLFWwindow* window, void* callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
void* (*glfwSetJoystickCallback)(void* callback);
int (*glfwUpdateGamepadMappings)(const char* str);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* str);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
unsigned long long (*glfwGetTimerValue)(void);
unsigned long long (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
void* (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count);
} GLFWFunctionTable;
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,366 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
internal static unsafe int glfwInit() => _glfw.glfwInit();
internal static unsafe void glfwTerminate() => _glfw.glfwTerminate();
internal static unsafe void glfwInitHint(int hint, int value) => _glfw.glfwInitHint(hint, value);
internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) => _glfw.glfwGetVersion(major, minor, rev);
internal static unsafe byte* glfwGetVersionString() => _glfw.glfwGetVersionString();
internal static unsafe int glfwGetError(byte** description) => _glfw.glfwGetError(description);
internal static unsafe delegate*<int, byte*, void> glfwSetErrorCallback(delegate*<int, byte*, void> callback) => _glfw.glfwSetErrorCallback(callback);
internal static unsafe IntPtr* glfwGetMonitors(int* count) => _glfw.glfwGetMonitors(count);
internal static unsafe IntPtr glfwGetPrimaryMonitor() => _glfw.glfwGetPrimaryMonitor();
internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) => _glfw.glfwGetMonitorPos(monitor, xpos, ypos);
internal static unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height)
{
_glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height);
}
internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) => _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM);
internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) => _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale);
internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) => _glfw.glfwGetMonitorName(monitor);
internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) => _glfw.glfwSetMonitorUserPointer(monitor, pointer);
internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) => _glfw.glfwGetMonitorUserPointer(monitor);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetMonitorCallback(
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetMonitorCallback(callback);
internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) => _glfw.glfwGetVideoModes(monitor, count);
internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) => _glfw.glfwGetVideoMode(monitor);
internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) => _glfw.glfwSetGamma(monitor, gamma);
internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) => _glfw.glfwGetGammaRamp(monitor);
internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) => _glfw.glfwSetGammaRamp(monitor, ramp);
internal static unsafe void glfwDefaultWindowHints() => _glfw.glfwDefaultWindowHints();
internal static unsafe void glfwWindowHint(int hint, int value) => _glfw.glfwWindowHint(hint, value);
internal static unsafe void glfwWindowHintString(int hint, byte* value) => _glfw.glfwWindowHintString(hint, value);
internal static unsafe IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share) => _glfw.glfwCreateWindow(width, height, title, monitor, share);
internal static unsafe void glfwDestroyWindow(IntPtr window) => _glfw.glfwDestroyWindow(window);
internal static unsafe int glfwWindowShouldClose(IntPtr window) => _glfw.glfwWindowShouldClose(window);
internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) => _glfw.glfwSetWindowShouldClose(window, value);
internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) => _glfw.glfwSetWindowTitle(window, title);
internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) => _glfw.glfwSetWindowIcon(window, count, images);
internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) => _glfw.glfwGetWindowPos(window, xpos, ypos);
internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) => _glfw.glfwSetWindowPos(window, xpos, ypos);
internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) => _glfw.glfwGetWindowSize(window, width, height);
internal static unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight) => _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight);
internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) => _glfw.glfwSetWindowAspectRatio(window, numer, denom);
internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) => _glfw.glfwSetWindowSize(window, width, height);
internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) => _glfw.glfwGetFramebufferSize(window, width, height);
internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) => _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom);
internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) => _glfw.glfwGetWindowContentScale(window, xscale, yscale);
internal static unsafe float glfwGetWindowOpacity(IntPtr window) => _glfw.glfwGetWindowOpacity(window);
internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) => _glfw.glfwSetWindowOpacity(window, opacity);
internal static unsafe void glfwIconifyWindow(IntPtr window) => _glfw.glfwIconifyWindow(window);
internal static unsafe void glfwRestoreWindow(IntPtr window) => _glfw.glfwRestoreWindow(window);
internal static unsafe void glfwMaximizeWindow(IntPtr window) => _glfw.glfwMaximizeWindow(window);
internal static unsafe void glfwShowWindow(IntPtr window) => _glfw.glfwShowWindow(window);
internal static unsafe void glfwHideWindow(IntPtr window) => _glfw.glfwHideWindow(window);
internal static unsafe void glfwFocusWindow(IntPtr window) => _glfw.glfwFocusWindow(window);
internal static unsafe void glfwRequestWindowAttention(IntPtr window) => _glfw.glfwRequestWindowAttention(window);
internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) => _glfw.glfwGetWindowMonitor(window);
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);
internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) => _glfw.glfwGetWindowAttrib(window, attrib);
internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) => _glfw.glfwSetWindowAttrib(window, attrib, value);
internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) => _glfw.glfwSetWindowUserPointer(window, pointer);
internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) => _glfw.glfwGetWindowUserPointer(window);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback) => _glfw.glfwSetWindowPosCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, void> callback) => _glfw.glfwSetWindowSizeCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback) => _glfw.glfwSetWindowCloseCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback) => _glfw.glfwSetWindowRefreshCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowFocusCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowIconifyCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowMaximizeCallback(window, callback);
internal static unsafe FrameBufferSizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback) => _glfw.glfwSetFramebufferSizeCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, float, float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float, float> callback) => _glfw.glfwSetWindowContentScaleCallback(window, callback);
internal static unsafe void glfwPollEvents() => _glfw.glfwPollEvents();
internal static unsafe void glfwWaitEvents() => _glfw.glfwWaitEvents();
internal static unsafe void glfwWaitEventsTimeout(double timeout) => _glfw.glfwWaitEventsTimeout(timeout);
internal static unsafe void glfwPostEmptyEvent() => _glfw.glfwPostEmptyEvent();
internal static unsafe int glfwGetInputMode(IntPtr window, int mode) => _glfw.glfwGetInputMode(window, mode);
internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) => _glfw.glfwSetInputMode(window, mode, value);
internal static unsafe int glfwRawMouseMotionSupported() => _glfw.glfwRawMouseMotionSupported();
internal static unsafe byte* glfwGetKeyName(int key, int scancode) => _glfw.glfwGetKeyName(key, scancode);
internal static unsafe int glfwGetKeyScancode(int key) => _glfw.glfwGetKeyScancode(key);
internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) => _glfw.glfwGetKey(window, key);
internal static unsafe int glfwGetMouseButton(IntPtr window, int button) => _glfw.glfwGetMouseButton(window, button);
internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) => _glfw.glfwGetCursorPos(window, xpos, ypos);
internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) => _glfw.glfwSetCursorPos(window, xpos, ypos);
internal static unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot) => _glfw.glfwCreateCursor(image, xhot, yhot);
internal static unsafe GLFWcursor* glfwCreateStandardCursor(int shape) => _glfw.glfwCreateStandardCursor(shape);
internal static unsafe void glfwDestroyCursor(GLFWcursor* cursor) => _glfw.glfwDestroyCursor(cursor);
internal static unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor) => _glfw.glfwSetCursor(window, cursor);
internal static unsafe delegate*<glfwWindow*, int, int, int, int, void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, int, int, void> callback) => _glfw.glfwSetKeyCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, uint, void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*, uint, void> callback) => _glfw.glfwSetCharCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, void> callback) => _glfw.glfwSetCharModsCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, int, void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, int, void> callback) => _glfw.glfwSetMouseButtonCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, double, double, void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*, double, double, void> callback) => _glfw.glfwSetCursorPosCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetCursorEnterCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, double, double, void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*, double, double, void> callback) => _glfw.glfwSetScrollCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, byte**, void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*, int, byte**, void> callback) => _glfw.glfwSetDropCallback(window, callback);
internal static unsafe int glfwJoystickPresent(int jid) => _glfw.glfwJoystickPresent(jid);
internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) => _glfw.glfwGetJoystickAxes(jid, count);
internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) => _glfw.glfwGetJoystickButtons(jid, count);
internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) => _glfw.glfwGetJoystickHats(jid, count);
internal static unsafe byte* glfwGetJoystickName(int jid) => _glfw.glfwGetJoystickName(jid);
internal static unsafe byte* glfwGetJoystickGUID(int jid) => _glfw.glfwGetJoystickGUID(jid);
internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) => _glfw.glfwSetJoystickUserPointer(jid, pointer);
internal static unsafe void* glfwGetJoystickUserPointer(int jid) => _glfw.glfwGetJoystickUserPointer(jid);
internal static unsafe int glfwJoystickIsGamepad(int jid) => _glfw.glfwJoystickIsGamepad(jid);
internal static unsafe delegate*<int, int, void> glfwSetJoystickCallback(delegate*<int, int, void> callback) => _glfw.glfwSetJoystickCallback(callback);
internal static unsafe int glfwUpdateGamepadMappings(byte* str) => _glfw.glfwUpdateGamepadMappings(str);
internal static unsafe byte* glfwGetGamepadName(int jid) => _glfw.glfwGetGamepadName(jid);
internal static unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state) => _glfw.glfwGetGamepadState(jid, state);
internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) => _glfw.glfwSetClipboardString(window, str);
internal static unsafe byte* glfwGetClipboardString(IntPtr window) => _glfw.glfwGetClipboardString(window);
internal static unsafe double glfwGetTime() => _glfw.glfwGetTime();
internal static unsafe void glfwSetTime(double time) => _glfw.glfwSetTime(time);
internal static unsafe ulong* glfwGetTimerValue() => _glfw.glfwGetTimerValue();
internal static unsafe ulong* glfwGetTimerFrequency() => _glfw.glfwGetTimerFrequency();
internal static unsafe void glfwMakeContextCurrent(IntPtr window) => _glfw.glfwMakeContextCurrent(window);
internal static unsafe IntPtr glfwGetCurrentContext() => _glfw.glfwGetCurrentContext();
internal static unsafe void glfwSwapBuffers(IntPtr window) => _glfw.glfwSwapBuffers(window);
internal static unsafe void glfwSwapInterval(int interval) => _glfw.glfwSwapInterval(interval);
internal static unsafe int glfwExtensionSupported(byte* extension) => _glfw.glfwExtensionSupported(extension);
internal static unsafe IntPtr glfwGetProcAddress(string procname) => _glfw.glfwGetProcAddress(procname);
internal static unsafe int glfwVulkanSupported() => _glfw.glfwVulkanSupported();
internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) => _glfw.glfwGetRequiredInstanceExtensions(count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,157 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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, 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;
}
}}
@@ -0,0 +1,132 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwGetVersion)(int* major, int* minor, int* rev);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
void* (*glfwSetErrorCallback)(void* callback);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);
void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);
void* (*glfwSetMonitorCallback)(void* callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void* (*glfwSetWindowPosCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowSizeCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowCloseCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowRefreshCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowFocusCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowIconifyCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, void* callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
void* (*glfwSetKeyCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetCharCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetCharModsCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetMouseButtonCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetCursorPosCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetCursorEnterCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetScrollCallback)(GLFWwindow* window, void* callback);
void* (*glfwSetDropCallback)(GLFWwindow* window, void* callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
void* (*glfwSetJoystickCallback)(void* callback);
int (*glfwUpdateGamepadMappings)(const char* str);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* str);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
unsigned long long (*glfwGetTimerValue)(void);
unsigned long long (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
void* (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count);
} GLFWFunctionTable;
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,123 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
void (*glfwCreateCursor)(GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDefaultWindowHints)(void);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwDestroyWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
int (*glfwGetError)(const char** description);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwGetKey)(GLFWwindow* window, int key);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
GLFWmonitor** (*glfwGetMonitors)(int* count);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
double (*glfwGetTime)(void);
uint64_t (*glfwGetTimerFrequency)(void);
uint64_t (*glfwGetTimerValue)(void);
const char* (*glfwGetVersionString)(void);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwIconifyWindow)(GLFWwindow* window);
int (*glfwInit)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwPollEvents)(void);
void (*glfwPostEmptyEvent)(void);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
int (*glfwRawMouseMotionSupported)(void);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
void (*glfwSetTime)(double time);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
void (*glfwTerminate)(void);
int (*glfwUpdateGamepadMappings)(const char* string);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
int (*glfwVulkanSupported)(void);
int (*glfwWindowShouldClose)(GLFWwindow* window);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,123 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
void (*glfwCreateCursor)(GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDefaultWindowHints)(void);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwDestroyWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
int (*glfwGetError)(const char** description);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwGetKey)(GLFWwindow* window, int key);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
GLFWmonitor** (*glfwGetMonitors)(int* count);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
double (*glfwGetTime)(void);
uint64_t (*glfwGetTimerFrequency)(void);
uint64_t (*glfwGetTimerValue)(void);
const char* (*glfwGetVersionString)(void);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwIconifyWindow)(GLFWwindow* window);
int (*glfwInit)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwPollEvents)(void);
void (*glfwPostEmptyEvent)(void);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
int (*glfwRawMouseMotionSupported)(void);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
void (*glfwSetTime)(double time);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
void (*glfwTerminate)(void);
int (*glfwUpdateGamepadMappings)(const char* string);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
int (*glfwVulkanSupported)(void);
int (*glfwWindowShouldClose)(GLFWwindow* window);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,3 @@
#include "StgSharpNative.h"
#include "glfw_function_table.h"
#include <string.h>
@@ -0,0 +1,156 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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]<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]<int, 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;
}
}
@@ -0,0 +1,3 @@
#include "StgSharpNative.h"
#include "glfw_function_table.h"
#include <string.h>
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,132 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwGetVersion)(int* major, int* minor, int* rev);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
int (*glfwUpdateGamepadMappings)(const char* str);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* str);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
unsigned long long (*glfwGetTimerValue)(void);
unsigned long long (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
GLFWglproc (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count);
} GLFWFunctionTable;
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,366 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
internal static unsafe int glfwInit() => _glfw.glfwInit();
internal static unsafe void glfwTerminate() => _glfw.glfwTerminate();
internal static unsafe void glfwInitHint(int hint, int value) => _glfw.glfwInitHint(hint, value);
internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) => _glfw.glfwGetVersion(major, minor, rev);
internal static unsafe byte* glfwGetVersionString() => _glfw.glfwGetVersionString();
internal static unsafe int glfwGetError(byte** description) => _glfw.glfwGetError(description);
internal static unsafe delegate*<int, byte*, void> glfwSetErrorCallback(delegate*<int, byte*, void> callback) => _glfw.glfwSetErrorCallback(callback);
internal static unsafe IntPtr* glfwGetMonitors(int* count) => _glfw.glfwGetMonitors(count);
internal static unsafe IntPtr glfwGetPrimaryMonitor() => _glfw.glfwGetPrimaryMonitor();
internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) => _glfw.glfwGetMonitorPos(monitor, xpos, ypos);
internal static unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height)
{
_glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height);
}
internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) => _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM);
internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) => _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale);
internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) => _glfw.glfwGetMonitorName(monitor);
internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) => _glfw.glfwSetMonitorUserPointer(monitor, pointer);
internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) => _glfw.glfwGetMonitorUserPointer(monitor);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetMonitorCallback(
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetMonitorCallback(callback);
internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) => _glfw.glfwGetVideoModes(monitor, count);
internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) => _glfw.glfwGetVideoMode(monitor);
internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) => _glfw.glfwSetGamma(monitor, gamma);
internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) => _glfw.glfwGetGammaRamp(monitor);
internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) => _glfw.glfwSetGammaRamp(monitor, ramp);
internal static unsafe void glfwDefaultWindowHints() => _glfw.glfwDefaultWindowHints();
internal static unsafe void glfwWindowHint(int hint, int value) => _glfw.glfwWindowHint(hint, value);
internal static unsafe void glfwWindowHintString(int hint, byte* value) => _glfw.glfwWindowHintString(hint, value);
internal static unsafe IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share) => _glfw.glfwCreateWindow(width, height, title, monitor, share);
internal static unsafe void glfwDestroyWindow(IntPtr window) => _glfw.glfwDestroyWindow(window);
internal static unsafe int glfwWindowShouldClose(IntPtr window) => _glfw.glfwWindowShouldClose(window);
internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) => _glfw.glfwSetWindowShouldClose(window, value);
internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) => _glfw.glfwSetWindowTitle(window, title);
internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) => _glfw.glfwSetWindowIcon(window, count, images);
internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) => _glfw.glfwGetWindowPos(window, xpos, ypos);
internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) => _glfw.glfwSetWindowPos(window, xpos, ypos);
internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) => _glfw.glfwGetWindowSize(window, width, height);
internal static unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight) => _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight);
internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) => _glfw.glfwSetWindowAspectRatio(window, numer, denom);
internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) => _glfw.glfwSetWindowSize(window, width, height);
internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) => _glfw.glfwGetFramebufferSize(window, width, height);
internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) => _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom);
internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) => _glfw.glfwGetWindowContentScale(window, xscale, yscale);
internal static unsafe float glfwGetWindowOpacity(IntPtr window) => _glfw.glfwGetWindowOpacity(window);
internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) => _glfw.glfwSetWindowOpacity(window, opacity);
internal static unsafe void glfwIconifyWindow(IntPtr window) => _glfw.glfwIconifyWindow(window);
internal static unsafe void glfwRestoreWindow(IntPtr window) => _glfw.glfwRestoreWindow(window);
internal static unsafe void glfwMaximizeWindow(IntPtr window) => _glfw.glfwMaximizeWindow(window);
internal static unsafe void glfwShowWindow(IntPtr window) => _glfw.glfwShowWindow(window);
internal static unsafe void glfwHideWindow(IntPtr window) => _glfw.glfwHideWindow(window);
internal static unsafe void glfwFocusWindow(IntPtr window) => _glfw.glfwFocusWindow(window);
internal static unsafe void glfwRequestWindowAttention(IntPtr window) => _glfw.glfwRequestWindowAttention(window);
internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) => _glfw.glfwGetWindowMonitor(window);
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);
internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) => _glfw.glfwGetWindowAttrib(window, attrib);
internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) => _glfw.glfwSetWindowAttrib(window, attrib, value);
internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) => _glfw.glfwSetWindowUserPointer(window, pointer);
internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) => _glfw.glfwGetWindowUserPointer(window);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback) => _glfw.glfwSetWindowPosCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, void> callback) => _glfw.glfwSetWindowSizeCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback) => _glfw.glfwSetWindowCloseCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback) => _glfw.glfwSetWindowRefreshCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowFocusCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowIconifyCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowMaximizeCallback(window, callback);
internal static unsafe FrameBufferSizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback) => _glfw.glfwSetFramebufferSizeCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, float, float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float, float> callback) => _glfw.glfwSetWindowContentScaleCallback(window, callback);
internal static unsafe void glfwPollEvents() => _glfw.glfwPollEvents();
internal static unsafe void glfwWaitEvents() => _glfw.glfwWaitEvents();
internal static unsafe void glfwWaitEventsTimeout(double timeout) => _glfw.glfwWaitEventsTimeout(timeout);
internal static unsafe void glfwPostEmptyEvent() => _glfw.glfwPostEmptyEvent();
internal static unsafe int glfwGetInputMode(IntPtr window, int mode) => _glfw.glfwGetInputMode(window, mode);
internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) => _glfw.glfwSetInputMode(window, mode, value);
internal static unsafe int glfwRawMouseMotionSupported() => _glfw.glfwRawMouseMotionSupported();
internal static unsafe byte* glfwGetKeyName(int key, int scancode) => _glfw.glfwGetKeyName(key, scancode);
internal static unsafe int glfwGetKeyScancode(int key) => _glfw.glfwGetKeyScancode(key);
internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) => _glfw.glfwGetKey(window, key);
internal static unsafe int glfwGetMouseButton(IntPtr window, int button) => _glfw.glfwGetMouseButton(window, button);
internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) => _glfw.glfwGetCursorPos(window, xpos, ypos);
internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) => _glfw.glfwSetCursorPos(window, xpos, ypos);
internal static unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot) => _glfw.glfwCreateCursor(image, xhot, yhot);
internal static unsafe GLFWcursor* glfwCreateStandardCursor(int shape) => _glfw.glfwCreateStandardCursor(shape);
internal static unsafe void glfwDestroyCursor(GLFWcursor* cursor) => _glfw.glfwDestroyCursor(cursor);
internal static unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor) => _glfw.glfwSetCursor(window, cursor);
internal static unsafe delegate*<glfwWindow*, int, int, int, int, void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, int, int, void> callback) => _glfw.glfwSetKeyCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, uint, void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*, uint, void> callback) => _glfw.glfwSetCharCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, void> callback) => _glfw.glfwSetCharModsCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, int, void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, int, void> callback) => _glfw.glfwSetMouseButtonCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, double, double, void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*, double, double, void> callback) => _glfw.glfwSetCursorPosCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetCursorEnterCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, double, double, void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*, double, double, void> callback) => _glfw.glfwSetScrollCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, byte**, void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*, int, byte**, void> callback) => _glfw.glfwSetDropCallback(window, callback);
internal static unsafe int glfwJoystickPresent(int jid) => _glfw.glfwJoystickPresent(jid);
internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) => _glfw.glfwGetJoystickAxes(jid, count);
internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) => _glfw.glfwGetJoystickButtons(jid, count);
internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) => _glfw.glfwGetJoystickHats(jid, count);
internal static unsafe byte* glfwGetJoystickName(int jid) => _glfw.glfwGetJoystickName(jid);
internal static unsafe byte* glfwGetJoystickGUID(int jid) => _glfw.glfwGetJoystickGUID(jid);
internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) => _glfw.glfwSetJoystickUserPointer(jid, pointer);
internal static unsafe void* glfwGetJoystickUserPointer(int jid) => _glfw.glfwGetJoystickUserPointer(jid);
internal static unsafe int glfwJoystickIsGamepad(int jid) => _glfw.glfwJoystickIsGamepad(jid);
internal static unsafe delegate*<int, int, void> glfwSetJoystickCallback(delegate*<int, int, void> callback) => _glfw.glfwSetJoystickCallback(callback);
internal static unsafe int glfwUpdateGamepadMappings(byte* str) => _glfw.glfwUpdateGamepadMappings(str);
internal static unsafe byte* glfwGetGamepadName(int jid) => _glfw.glfwGetGamepadName(jid);
internal static unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state) => _glfw.glfwGetGamepadState(jid, state);
internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) => _glfw.glfwSetClipboardString(window, str);
internal static unsafe byte* glfwGetClipboardString(IntPtr window) => _glfw.glfwGetClipboardString(window);
internal static unsafe double glfwGetTime() => _glfw.glfwGetTime();
internal static unsafe void glfwSetTime(double time) => _glfw.glfwSetTime(time);
internal static unsafe ulong* glfwGetTimerValue() => _glfw.glfwGetTimerValue();
internal static unsafe ulong* glfwGetTimerFrequency() => _glfw.glfwGetTimerFrequency();
internal static unsafe void glfwMakeContextCurrent(IntPtr window) => _glfw.glfwMakeContextCurrent(window);
internal static unsafe IntPtr glfwGetCurrentContext() => _glfw.glfwGetCurrentContext();
internal static unsafe void glfwSwapBuffers(IntPtr window) => _glfw.glfwSwapBuffers(window);
internal static unsafe void glfwSwapInterval(int interval) => _glfw.glfwSwapInterval(interval);
internal static unsafe int glfwExtensionSupported(byte* extension) => _glfw.glfwExtensionSupported(extension);
internal static unsafe IntPtr glfwGetProcAddress(string procname) => _glfw.glfwGetProcAddress(procname);
internal static unsafe int glfwVulkanSupported() => _glfw.glfwVulkanSupported();
internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) => _glfw.glfwGetRequiredInstanceExtensions(count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,156 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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]<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]<int, 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;
}
}
@@ -0,0 +1,133 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "glfw3_no_comments.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
const char* (*glfwGetJoystickGUID)(int jid);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
int (*glfwUpdateGamepadMappings)(const char* string);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
uint64_t (*glfwGetTimerValue)(void);
uint64_t (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
GLFWglproc (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(uint32_t* count);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,120 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "glfw3_no_comments.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
void (*glfwDefaultWindowHints)(void);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwDestroyWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
int (*glfwGetError)(const char** description);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwGetKey)(GLFWwindow* window, int key);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
GLFWmonitor** (*glfwGetMonitors)(int* count);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
double (*glfwGetTime)(void);
uint64_t (*glfwGetTimerFrequency)(void);
uint64_t (*glfwGetTimerValue)(void);
const char* (*glfwGetVersionString)(void);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwIconifyWindow)(GLFWwindow* window);
int (*glfwInit)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwPollEvents)(void);
void (*glfwPostEmptyEvent)(void);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
int (*glfwRawMouseMotionSupported)(void);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
void (*glfwSetTime)(double time);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
void (*glfwTerminate)(void);
int (*glfwUpdateGamepadMappings)(const char* string);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
int (*glfwVulkanSupported)(void);
int (*glfwWindowShouldClose)(GLFWwindow* window);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,3 @@
#include "StgSharpNative.h"
#include "glfw_function_table.h"
#include <string.h>
@@ -0,0 +1,158 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunctionTable
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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, 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]<int, 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]<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 delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>, delegate* unmanaged<Cdecl]<IntPtr,
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void>, delegate* unmanaged<Cdecl]<IntPtr,
double, double, void>> glfwSetScrollCallback;
int, byte**, void>> glfwSetDropCallback;
}
}
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,120 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit");
table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate");
table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint");
table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString");
table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError");
table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors");
table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor");
table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos");
table->glfwGetMonitorWorkarea = (void (*)(GLFWmonitor*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetMonitorWorkarea");
table->glfwGetMonitorPhysicalSize = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPhysicalSize");
table->glfwGetMonitorContentScale = (void (*)(GLFWmonitor*, float*, float*))glfwGetProcAddress("glfwGetMonitorContentScale");
table->glfwGetMonitorName = (const char* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorName");
table->glfwSetMonitorUserPointer = (void (*)(GLFWmonitor*, void*))glfwGetProcAddress("glfwSetMonitorUserPointer");
table->glfwGetMonitorUserPointer = (void* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorUserPointer");
table->glfwSetMonitorCallback = (GLFWmonitorfun (*)(GLFWmonitorfun))glfwGetProcAddress("glfwSetMonitorCallback");
table->glfwGetVideoModes = (const GLFWvidmode* (*)(GLFWmonitor*, int*))glfwGetProcAddress("glfwGetVideoModes");
table->glfwGetVideoMode = (const GLFWvidmode* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetVideoMode");
table->glfwSetGamma = (void (*)(GLFWmonitor*, float))glfwGetProcAddress("glfwSetGamma");
table->glfwGetGammaRamp = (const GLFWgammaramp* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetGammaRamp");
table->glfwSetGammaRamp = (void (*)(GLFWmonitor*, const GLFWgammaramp*))glfwGetProcAddress("glfwSetGammaRamp");
table->glfwDefaultWindowHints = (void (*)(void))glfwGetProcAddress("glfwDefaultWindowHints");
table->glfwWindowHint = (void (*)(int, int))glfwGetProcAddress("glfwWindowHint");
table->glfwWindowHintString = (void (*)(int, const char*))glfwGetProcAddress("glfwWindowHintString");
table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow");
table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow");
table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose");
table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose");
table->glfwSetWindowTitle = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetWindowTitle");
table->glfwSetWindowIcon = (void (*)(GLFWwindow*, int, const GLFWimage*))glfwGetProcAddress("glfwSetWindowIcon");
table->glfwGetWindowPos = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowPos");
table->glfwSetWindowPos = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowPos");
table->glfwGetWindowSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowSize");
table->glfwSetWindowSizeLimits = (void (*)(GLFWwindow*, int, int, int, int))glfwGetProcAddress("glfwSetWindowSizeLimits");
table->glfwSetWindowAspectRatio = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAspectRatio");
table->glfwSetWindowSize = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowSize");
table->glfwGetFramebufferSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetFramebufferSize");
table->glfwGetWindowFrameSize = (void (*)(GLFWwindow*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetWindowFrameSize");
table->glfwGetWindowContentScale = (void (*)(GLFWwindow*, float*, float*))glfwGetProcAddress("glfwGetWindowContentScale");
table->glfwGetWindowOpacity = (float (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowOpacity");
table->glfwSetWindowOpacity = (void (*)(GLFWwindow*, float))glfwGetProcAddress("glfwSetWindowOpacity");
table->glfwIconifyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwIconifyWindow");
table->glfwRestoreWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRestoreWindow");
table->glfwMaximizeWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMaximizeWindow");
table->glfwShowWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwShowWindow");
table->glfwHideWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwHideWindow");
table->glfwFocusWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwFocusWindow");
table->glfwRequestWindowAttention = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRequestWindowAttention");
table->glfwGetWindowMonitor = (GLFWmonitor* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowMonitor");
table->glfwSetWindowMonitor = (void (*)(GLFWwindow*, GLFWmonitor*, int, int, int, int, int))glfwGetProcAddress("glfwSetWindowMonitor");
table->glfwGetWindowAttrib = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetWindowAttrib");
table->glfwSetWindowAttrib = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAttrib");
table->glfwSetWindowUserPointer = (void (*)(GLFWwindow*, void*))glfwGetProcAddress("glfwSetWindowUserPointer");
table->glfwGetWindowUserPointer = (void* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowUserPointer");
table->glfwSetWindowPosCallback = (GLFWwindowposfun (*)(GLFWwindow*, GLFWwindowposfun))glfwGetProcAddress("glfwSetWindowPosCallback");
table->glfwSetWindowSizeCallback = (GLFWwindowsizefun (*)(GLFWwindow*, GLFWwindowsizefun))glfwGetProcAddress("glfwSetWindowSizeCallback");
table->glfwSetWindowCloseCallback = (GLFWwindowclosefun (*)(GLFWwindow*, GLFWwindowclosefun))glfwGetProcAddress("glfwSetWindowCloseCallback");
table->glfwSetWindowRefreshCallback = (GLFWwindowrefreshfun (*)(GLFWwindow*, GLFWwindowrefreshfun))glfwGetProcAddress("glfwSetWindowRefreshCallback");
table->glfwSetWindowFocusCallback = (GLFWwindowfocusfun (*)(GLFWwindow*, GLFWwindowfocusfun))glfwGetProcAddress("glfwSetWindowFocusCallback");
table->glfwSetWindowIconifyCallback = (GLFWwindowiconifyfun (*)(GLFWwindow*, GLFWwindowiconifyfun))glfwGetProcAddress("glfwSetWindowIconifyCallback");
table->glfwSetWindowMaximizeCallback = (GLFWwindowmaximizefun (*)(GLFWwindow*, GLFWwindowmaximizefun))glfwGetProcAddress("glfwSetWindowMaximizeCallback");
table->glfwSetFramebufferSizeCallback = (GLFWframebuffersizefun (*)(GLFWwindow*, GLFWframebuffersizefun))glfwGetProcAddress("glfwSetFramebufferSizeCallback");
table->glfwSetWindowContentScaleCallback = (GLFWwindowcontentscalefun (*)(GLFWwindow*, GLFWwindowcontentscalefun))glfwGetProcAddress("glfwSetWindowContentScaleCallback");
table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents");
table->glfwWaitEvents = (void (*)(void))glfwGetProcAddress("glfwWaitEvents");
table->glfwWaitEventsTimeout = (void (*)(double))glfwGetProcAddress("glfwWaitEventsTimeout");
table->glfwPostEmptyEvent = (void (*)(void))glfwGetProcAddress("glfwPostEmptyEvent");
table->glfwGetInputMode = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetInputMode");
table->glfwSetInputMode = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetInputMode");
table->glfwRawMouseMotionSupported = (int (*)(void))glfwGetProcAddress("glfwRawMouseMotionSupported");
table->glfwGetKeyName = (const char* (*)(int, int))glfwGetProcAddress("glfwGetKeyName");
table->glfwGetKeyScancode = (int (*)(int))glfwGetProcAddress("glfwGetKeyScancode");
table->glfwGetKey = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetKey");
table->glfwGetMouseButton = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetMouseButton");
table->glfwGetCursorPos = (void (*)(GLFWwindow*, double*, double*))glfwGetProcAddress("glfwGetCursorPos");
table->glfwSetCursorPos = (void (*)(GLFWwindow*, double, double))glfwGetProcAddress("glfwSetCursorPos");
table->glfwCreateCursor = (GLFWcursor* (*)(const GLFWimage*, int, int))glfwGetProcAddress("glfwCreateCursor");
table->glfwCreateStandardCursor = (GLFWcursor* (*)(int))glfwGetProcAddress("glfwCreateStandardCursor");
table->glfwDestroyCursor = (void (*)(GLFWcursor*))glfwGetProcAddress("glfwDestroyCursor");
table->glfwSetCursor = (void (*)(GLFWwindow*, GLFWcursor*))glfwGetProcAddress("glfwSetCursor");
table->glfwSetKeyCallback = (GLFWkeyfun (*)(GLFWwindow*, GLFWkeyfun))glfwGetProcAddress("glfwSetKeyCallback");
table->glfwSetCharCallback = (GLFWcharfun (*)(GLFWwindow*, GLFWcharfun))glfwGetProcAddress("glfwSetCharCallback");
table->glfwSetCharModsCallback = (GLFWcharmodsfun (*)(GLFWwindow*, GLFWcharmodsfun))glfwGetProcAddress("glfwSetCharModsCallback");
table->glfwSetMouseButtonCallback = (GLFWmousebuttonfun (*)(GLFWwindow*, GLFWmousebuttonfun))glfwGetProcAddress("glfwSetMouseButtonCallback");
table->glfwSetCursorPosCallback = (GLFWcursorposfun (*)(GLFWwindow*, GLFWcursorposfun))glfwGetProcAddress("glfwSetCursorPosCallback");
table->glfwSetCursorEnterCallback = (GLFWcursorenterfun (*)(GLFWwindow*, GLFWcursorenterfun))glfwGetProcAddress("glfwSetCursorEnterCallback");
table->glfwSetScrollCallback = (GLFWscrollfun (*)(GLFWwindow*, GLFWscrollfun))glfwGetProcAddress("glfwSetScrollCallback");
table->glfwSetDropCallback = (GLFWdropfun (*)(GLFWwindow*, GLFWdropfun))glfwGetProcAddress("glfwSetDropCallback");
table->glfwJoystickPresent = (int (*)(int))glfwGetProcAddress("glfwJoystickPresent");
table->glfwGetJoystickAxes = (const float* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickAxes");
table->glfwGetJoystickButtons = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickButtons");
table->glfwGetJoystickHats = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickHats");
table->glfwGetJoystickName = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickName");
table->glfwGetJoystickGUID = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickGUID");
table->glfwSetJoystickUserPointer = (void (*)(int, void*))glfwGetProcAddress("glfwSetJoystickUserPointer");
table->glfwGetJoystickUserPointer = (void* (*)(int))glfwGetProcAddress("glfwGetJoystickUserPointer");
table->glfwJoystickIsGamepad = (int (*)(int))glfwGetProcAddress("glfwJoystickIsGamepad");
table->glfwSetJoystickCallback = (GLFWjoystickfun (*)(GLFWjoystickfun))glfwGetProcAddress("glfwSetJoystickCallback");
table->glfwUpdateGamepadMappings = (int (*)(const char*))glfwGetProcAddress("glfwUpdateGamepadMappings");
table->glfwGetGamepadName = (const char* (*)(int))glfwGetProcAddress("glfwGetGamepadName");
table->glfwGetGamepadState = (int (*)(int, GLFWgamepadstate*))glfwGetProcAddress("glfwGetGamepadState");
table->glfwSetClipboardString = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetClipboardString");
table->glfwGetClipboardString = (const char* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetClipboardString");
table->glfwGetTime = (double (*)(void))glfwGetProcAddress("glfwGetTime");
table->glfwSetTime = (void (*)(double))glfwGetProcAddress("glfwSetTime");
table->glfwGetTimerValue = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerValue");
table->glfwGetTimerFrequency = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerFrequency");
table->glfwMakeContextCurrent = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMakeContextCurrent");
table->glfwGetCurrentContext = (GLFWwindow* (*)(void))glfwGetProcAddress("glfwGetCurrentContext");
table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers");
table->glfwSwapInterval = (void (*)(int))glfwGetProcAddress("glfwSwapInterval");
table->glfwExtensionSupported = (int (*)(const char*))glfwGetProcAddress("glfwExtensionSupported");
table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress");
table->glfwVulkanSupported = (int (*)(void))glfwGetProcAddress("glfwVulkanSupported");
table->glfwGetRequiredInstanceExtensions = (const char** (*)(uint32_t*))glfwGetProcAddress("glfwGetRequiredInstanceExtensions");
}
@@ -0,0 +1,486 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
[LibraryImport(NativeLibName, EntryPoint = "glfwInit")]
internal static unsafe partial int glfwInit();
[LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")]
internal static unsafe partial void glfwTerminate();
[LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")]
internal static unsafe partial void glfwInitHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")]
internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")]
internal static unsafe partial byte* glfwGetVersionString();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetError")]
internal static unsafe partial int glfwGetError(byte** description);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")]
internal static unsafe partial delegate*<int,byte*,void> glfwSetErrorCallback(
delegate*<int,byte*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")]
internal static unsafe partial IntPtr* glfwGetMonitors(int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")]
internal static unsafe partial IntPtr glfwGetPrimaryMonitor();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")]
internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")]
internal static unsafe partial void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")]
internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")]
internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")]
internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")]
internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")]
internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetMonitorCallback(
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")]
internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")]
internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")]
internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")]
internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")]
internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp);
[LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")]
internal static unsafe partial void glfwDefaultWindowHints();
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")]
internal static unsafe partial void glfwWindowHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")]
internal static unsafe partial void glfwWindowHintString(int hint, byte* value);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")]
internal static unsafe partial IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")]
internal static unsafe partial void glfwDestroyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")]
internal static unsafe partial int glfwWindowShouldClose(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")]
internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")]
internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")]
internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")]
internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")]
internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")]
internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")]
internal static unsafe partial void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")]
internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")]
internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")]
internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")]
internal static unsafe partial void glfwGetWindowFrameSize(
IntPtr window,
int* left,
int* top,
int* right,
int* bottom);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")]
internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")]
internal static unsafe partial float glfwGetWindowOpacity(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")]
internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity);
[LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")]
internal static unsafe partial void glfwIconifyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")]
internal static unsafe partial void glfwRestoreWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")]
internal static unsafe partial void glfwMaximizeWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")]
internal static unsafe partial void glfwShowWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")]
internal static unsafe partial void glfwHideWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")]
internal static unsafe partial void glfwFocusWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")]
internal static unsafe partial void glfwRequestWindowAttention(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")]
internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")]
internal static unsafe partial void glfwSetWindowMonitor(
IntPtr window,
IntPtr monitor,
int xpos,
int ypos,
int width,
int height,
int refreshRate);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")]
internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")]
internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")]
internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")]
internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")]
internal static unsafe partial delegate*<glfwWindow*,void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")]
internal static unsafe partial delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")]
internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")]
internal static unsafe partial delegate*<glfwWindow*, float,float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float,float> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")]
internal static unsafe partial void glfwPollEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")]
internal static unsafe partial void glfwWaitEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")]
internal static unsafe partial void glfwWaitEventsTimeout(double timeout);
[LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")]
internal static unsafe partial void glfwPostEmptyEvent();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")]
internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")]
internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")]
internal static unsafe partial int glfwRawMouseMotionSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")]
internal static unsafe partial byte* glfwGetKeyName(int key, int scancode);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")]
internal static unsafe partial int glfwGetKeyScancode(int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")]
internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")]
internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")]
internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")]
internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")]
internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")]
internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")]
internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")]
internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,int,void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")]
internal static unsafe partial delegate*<glfwWindow*,uint,void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*,uint,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,byte**,void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*,int,byte**,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")]
internal static unsafe partial int glfwJoystickPresent(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")]
internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")]
internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")]
internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")]
internal static unsafe partial byte* glfwGetJoystickName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")]
internal static unsafe partial byte* glfwGetJoystickGUID(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")]
internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")]
internal static unsafe partial void* glfwGetJoystickUserPointer(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")]
internal static unsafe partial int glfwJoystickIsGamepad(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")]
internal static unsafe partial delegate*<int,int,void> glfwSetJoystickCallback(delegate*<int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")]
internal static unsafe partial int glfwUpdateGamepadMappings(byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")]
internal static unsafe partial byte* glfwGetGamepadName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")]
internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")]
internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")]
internal static unsafe partial byte* glfwGetClipboardString(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")]
internal static unsafe partial double glfwGetTime();
[LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")]
internal static unsafe partial void glfwSetTime(double time);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")]
internal static unsafe partial ulong* glfwGetTimerValue();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")]
internal static unsafe partial ulong* glfwGetTimerFrequency();
[LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")]
internal static unsafe partial void glfwMakeContextCurrent(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")]
internal static unsafe partial IntPtr glfwGetCurrentContext();
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")]
internal static unsafe partial void glfwSwapBuffers(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")]
internal static unsafe partial void glfwSwapInterval(int interval);
[LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")]
internal static unsafe partial int glfwExtensionSupported(byte* extension);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)]
internal static unsafe partial IntPtr glfwGetProcAddress(string procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")]
internal static unsafe partial int glfwVulkanSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")]
internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,133 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "glfw3_no_comments.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
const char* (*glfwGetJoystickGUID)(int jid);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
int (*glfwUpdateGamepadMappings)(const char* string);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
uint64_t (*glfwGetTimerValue)(void);
uint64_t (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
GLFWglproc (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(uint32_t* count);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,107 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwDefaultWindowHints = glfwDefaultWindowHints;
table->glfwDestroyCursor = glfwDestroyCursor;
table->glfwDestroyWindow = glfwDestroyWindow;
table->glfwFocusWindow = glfwFocusWindow;
table->glfwGetClipboardString = glfwGetClipboardString;
table->glfwGetCurrentContext = glfwGetCurrentContext;
table->glfwGetCursorPos = glfwGetCursorPos;
table->glfwGetError = glfwGetError;
table->glfwGetFramebufferSize = glfwGetFramebufferSize;
table->glfwGetGamepadName = glfwGetGamepadName;
table->glfwGetGamepadState = glfwGetGamepadState;
table->glfwGetGammaRamp = glfwGetGammaRamp;
table->glfwGetInputMode = glfwGetInputMode;
table->glfwGetJoystickAxes = glfwGetJoystickAxes;
table->glfwGetJoystickButtons = glfwGetJoystickButtons;
table->glfwGetJoystickGUID = glfwGetJoystickGUID;
table->glfwGetJoystickHats = glfwGetJoystickHats;
table->glfwGetJoystickName = glfwGetJoystickName;
table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer;
table->glfwGetKey = glfwGetKey;
table->glfwGetKeyName = glfwGetKeyName;
table->glfwGetKeyScancode = glfwGetKeyScancode;
table->glfwGetMonitorContentScale = glfwGetMonitorContentScale;
table->glfwGetMonitorName = glfwGetMonitorName;
table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize;
table->glfwGetMonitorPos = glfwGetMonitorPos;
table->glfwGetMonitors = glfwGetMonitors;
table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer;
table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea;
table->glfwGetMouseButton = glfwGetMouseButton;
table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor;
table->glfwGetTime = glfwGetTime;
table->glfwGetTimerFrequency = glfwGetTimerFrequency;
table->glfwGetTimerValue = glfwGetTimerValue;
table->glfwGetVersionString = glfwGetVersionString;
table->glfwGetVideoMode = glfwGetVideoMode;
table->glfwGetVideoModes = glfwGetVideoModes;
table->glfwGetWindowAttrib = glfwGetWindowAttrib;
table->glfwGetWindowContentScale = glfwGetWindowContentScale;
table->glfwGetWindowFrameSize = glfwGetWindowFrameSize;
table->glfwGetWindowMonitor = glfwGetWindowMonitor;
table->glfwGetWindowOpacity = glfwGetWindowOpacity;
table->glfwGetWindowPos = glfwGetWindowPos;
table->glfwGetWindowSize = glfwGetWindowSize;
table->glfwGetWindowUserPointer = glfwGetWindowUserPointer;
table->glfwHideWindow = glfwHideWindow;
table->glfwIconifyWindow = glfwIconifyWindow;
table->glfwInit = glfwInit;
table->glfwInitHint = glfwInitHint;
table->glfwMakeContextCurrent = glfwMakeContextCurrent;
table->glfwMaximizeWindow = glfwMaximizeWindow;
table->glfwPollEvents = glfwPollEvents;
table->glfwPostEmptyEvent = glfwPostEmptyEvent;
table->glfwRequestWindowAttention = glfwRequestWindowAttention;
table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported;
table->glfwRestoreWindow = glfwRestoreWindow;
table->glfwSetClipboardString = glfwSetClipboardString;
table->glfwSetCharCallback = glfwSetCharCallback;
table->glfwSetCharModsCallback = glfwSetCharModsCallback;
table->glfwSetCursor = glfwSetCursor;
table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback;
table->glfwSetCursorPos = glfwSetCursorPos;
table->glfwSetCursorPosCallback = glfwSetCursorPosCallback;
table->glfwSetDropCallback = glfwSetDropCallback;
table->glfwSetGammaRamp = glfwSetGammaRamp;
table->glfwSetJoystickCallback = glfwSetJoystickCallback;
table->glfwSetJoystickUserPointer = glfwSetJoystickUserPointer;
table->glfwSetKeyCallback = glfwSetKeyCallback;
table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer;
table->glfwSetMonitorCallback = glfwSetMonitorCallback;
table->glfwSetTime = glfwSetTime;
table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio;
table->glfwSetWindowAttrib = glfwSetWindowAttrib;
table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback;
table->glfwSetWindowIcon = glfwSetWindowIcon;
table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback;
table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback;
table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback;
table->glfwSetWindowMonitor = glfwSetWindowMonitor;
table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback;
table->glfwSetWindowOpacity = glfwSetWindowOpacity;
table->glfwSetWindowPosCallback = glfwSetWindowPosCallback;
table->glfwSetWindowPos = glfwSetWindowPos;
table->glfwSetScrollCallback = glfwSetScrollCallback;
table->glfwSetWindowShouldClose = glfwSetWindowShouldClose;
table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits;
table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback;
table->glfwSetWindowSize = glfwSetWindowSize;
table->glfwSetWindowTitle = glfwSetWindowTitle;
table->glfwSetWindowUserPointer = glfwSetWindowUserPointer;
table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback;
table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback;
table->glfwSwapBuffers = glfwSwapBuffers;
table->glfwSwapInterval = glfwSwapInterval;
table->glfwTerminate = glfwTerminate;
table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings;
table->glfwWaitEvents = glfwWaitEvents;
table->glfwWaitEventsTimeout = glfwWaitEventsTimeout;
table->glfwVulkanSupported = glfwVulkanSupported;
table->glfwWindowShouldClose = glfwWindowShouldClose;
}
@@ -0,0 +1,120 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit");
table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate");
table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint");
table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString");
table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError");
table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors");
table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor");
table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos");
table->glfwGetMonitorWorkarea = (void (*)(GLFWmonitor*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetMonitorWorkarea");
table->glfwGetMonitorPhysicalSize = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPhysicalSize");
table->glfwGetMonitorContentScale = (void (*)(GLFWmonitor*, float*, float*))glfwGetProcAddress("glfwGetMonitorContentScale");
table->glfwGetMonitorName = (const char* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorName");
table->glfwSetMonitorUserPointer = (void (*)(GLFWmonitor*, void*))glfwGetProcAddress("glfwSetMonitorUserPointer");
table->glfwGetMonitorUserPointer = (void* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorUserPointer");
table->glfwSetMonitorCallback = (GLFWmonitorfun (*)(GLFWmonitorfun))glfwGetProcAddress("glfwSetMonitorCallback");
table->glfwGetVideoModes = (const GLFWvidmode* (*)(GLFWmonitor*, int*))glfwGetProcAddress("glfwGetVideoModes");
table->glfwGetVideoMode = (const GLFWvidmode* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetVideoMode");
table->glfwSetGamma = (void (*)(GLFWmonitor*, float))glfwGetProcAddress("glfwSetGamma");
table->glfwGetGammaRamp = (const GLFWgammaramp* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetGammaRamp");
table->glfwSetGammaRamp = (void (*)(GLFWmonitor*, const GLFWgammaramp*))glfwGetProcAddress("glfwSetGammaRamp");
table->glfwDefaultWindowHints = (void (*)(void))glfwGetProcAddress("glfwDefaultWindowHints");
table->glfwWindowHint = (void (*)(int, int))glfwGetProcAddress("glfwWindowHint");
table->glfwWindowHintString = (void (*)(int, const char*))glfwGetProcAddress("glfwWindowHintString");
table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow");
table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow");
table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose");
table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose");
table->glfwSetWindowTitle = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetWindowTitle");
table->glfwSetWindowIcon = (void (*)(GLFWwindow*, int, const GLFWimage*))glfwGetProcAddress("glfwSetWindowIcon");
table->glfwGetWindowPos = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowPos");
table->glfwSetWindowPos = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowPos");
table->glfwGetWindowSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowSize");
table->glfwSetWindowSizeLimits = (void (*)(GLFWwindow*, int, int, int, int))glfwGetProcAddress("glfwSetWindowSizeLimits");
table->glfwSetWindowAspectRatio = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAspectRatio");
table->glfwSetWindowSize = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowSize");
table->glfwGetFramebufferSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetFramebufferSize");
table->glfwGetWindowFrameSize = (void (*)(GLFWwindow*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetWindowFrameSize");
table->glfwGetWindowContentScale = (void (*)(GLFWwindow*, float*, float*))glfwGetProcAddress("glfwGetWindowContentScale");
table->glfwGetWindowOpacity = (float (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowOpacity");
table->glfwSetWindowOpacity = (void (*)(GLFWwindow*, float))glfwGetProcAddress("glfwSetWindowOpacity");
table->glfwIconifyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwIconifyWindow");
table->glfwRestoreWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRestoreWindow");
table->glfwMaximizeWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMaximizeWindow");
table->glfwShowWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwShowWindow");
table->glfwHideWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwHideWindow");
table->glfwFocusWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwFocusWindow");
table->glfwRequestWindowAttention = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRequestWindowAttention");
table->glfwGetWindowMonitor = (GLFWmonitor* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowMonitor");
table->glfwSetWindowMonitor = (void (*)(GLFWwindow*, GLFWmonitor*, int, int, int, int, int))glfwGetProcAddress("glfwSetWindowMonitor");
table->glfwGetWindowAttrib = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetWindowAttrib");
table->glfwSetWindowAttrib = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAttrib");
table->glfwSetWindowUserPointer = (void (*)(GLFWwindow*, void*))glfwGetProcAddress("glfwSetWindowUserPointer");
table->glfwGetWindowUserPointer = (void* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowUserPointer");
table->glfwSetWindowPosCallback = (GLFWwindowposfun (*)(GLFWwindow*, GLFWwindowposfun))glfwGetProcAddress("glfwSetWindowPosCallback");
table->glfwSetWindowSizeCallback = (GLFWwindowsizefun (*)(GLFWwindow*, GLFWwindowsizefun))glfwGetProcAddress("glfwSetWindowSizeCallback");
table->glfwSetWindowCloseCallback = (GLFWwindowclosefun (*)(GLFWwindow*, GLFWwindowclosefun))glfwGetProcAddress("glfwSetWindowCloseCallback");
table->glfwSetWindowRefreshCallback = (GLFWwindowrefreshfun (*)(GLFWwindow*, GLFWwindowrefreshfun))glfwGetProcAddress("glfwSetWindowRefreshCallback");
table->glfwSetWindowFocusCallback = (GLFWwindowfocusfun (*)(GLFWwindow*, GLFWwindowfocusfun))glfwGetProcAddress("glfwSetWindowFocusCallback");
table->glfwSetWindowIconifyCallback = (GLFWwindowiconifyfun (*)(GLFWwindow*, GLFWwindowiconifyfun))glfwGetProcAddress("glfwSetWindowIconifyCallback");
table->glfwSetWindowMaximizeCallback = (GLFWwindowmaximizefun (*)(GLFWwindow*, GLFWwindowmaximizefun))glfwGetProcAddress("glfwSetWindowMaximizeCallback");
table->glfwSetFramebufferSizeCallback = (GLFWframebuffersizefun (*)(GLFWwindow*, GLFWframebuffersizefun))glfwGetProcAddress("glfwSetFramebufferSizeCallback");
table->glfwSetWindowContentScaleCallback = (GLFWwindowcontentscalefun (*)(GLFWwindow*, GLFWwindowcontentscalefun))glfwGetProcAddress("glfwSetWindowContentScaleCallback");
table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents");
table->glfwWaitEvents = (void (*)(void))glfwGetProcAddress("glfwWaitEvents");
table->glfwWaitEventsTimeout = (void (*)(double))glfwGetProcAddress("glfwWaitEventsTimeout");
table->glfwPostEmptyEvent = (void (*)(void))glfwGetProcAddress("glfwPostEmptyEvent");
table->glfwGetInputMode = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetInputMode");
table->glfwSetInputMode = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetInputMode");
table->glfwRawMouseMotionSupported = (int (*)(void))glfwGetProcAddress("glfwRawMouseMotionSupported");
table->glfwGetKeyName = (const char* (*)(int, int))glfwGetProcAddress("glfwGetKeyName");
table->glfwGetKeyScancode = (int (*)(int))glfwGetProcAddress("glfwGetKeyScancode");
table->glfwGetKey = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetKey");
table->glfwGetMouseButton = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetMouseButton");
table->glfwGetCursorPos = (void (*)(GLFWwindow*, double*, double*))glfwGetProcAddress("glfwGetCursorPos");
table->glfwSetCursorPos = (void (*)(GLFWwindow*, double, double))glfwGetProcAddress("glfwSetCursorPos");
table->glfwCreateCursor = (GLFWcursor* (*)(const GLFWimage*, int, int))glfwGetProcAddress("glfwCreateCursor");
table->glfwCreateStandardCursor = (GLFWcursor* (*)(int))glfwGetProcAddress("glfwCreateStandardCursor");
table->glfwDestroyCursor = (void (*)(GLFWcursor*))glfwGetProcAddress("glfwDestroyCursor");
table->glfwSetCursor = (void (*)(GLFWwindow*, GLFWcursor*))glfwGetProcAddress("glfwSetCursor");
table->glfwSetKeyCallback = (GLFWkeyfun (*)(GLFWwindow*, GLFWkeyfun))glfwGetProcAddress("glfwSetKeyCallback");
table->glfwSetCharCallback = (GLFWcharfun (*)(GLFWwindow*, GLFWcharfun))glfwGetProcAddress("glfwSetCharCallback");
table->glfwSetCharModsCallback = (GLFWcharmodsfun (*)(GLFWwindow*, GLFWcharmodsfun))glfwGetProcAddress("glfwSetCharModsCallback");
table->glfwSetMouseButtonCallback = (GLFWmousebuttonfun (*)(GLFWwindow*, GLFWmousebuttonfun))glfwGetProcAddress("glfwSetMouseButtonCallback");
table->glfwSetCursorPosCallback = (GLFWcursorposfun (*)(GLFWwindow*, GLFWcursorposfun))glfwGetProcAddress("glfwSetCursorPosCallback");
table->glfwSetCursorEnterCallback = (GLFWcursorenterfun (*)(GLFWwindow*, GLFWcursorenterfun))glfwGetProcAddress("glfwSetCursorEnterCallback");
table->glfwSetScrollCallback = (GLFWscrollfun (*)(GLFWwindow*, GLFWscrollfun))glfwGetProcAddress("glfwSetScrollCallback");
table->glfwSetDropCallback = (GLFWdropfun (*)(GLFWwindow*, GLFWdropfun))glfwGetProcAddress("glfwSetDropCallback");
table->glfwJoystickPresent = (int (*)(int))glfwGetProcAddress("glfwJoystickPresent");
table->glfwGetJoystickAxes = (const float* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickAxes");
table->glfwGetJoystickButtons = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickButtons");
table->glfwGetJoystickHats = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickHats");
table->glfwGetJoystickName = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickName");
table->glfwGetJoystickGUID = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickGUID");
table->glfwSetJoystickUserPointer = (void (*)(int, void*))glfwGetProcAddress("glfwSetJoystickUserPointer");
table->glfwGetJoystickUserPointer = (void* (*)(int))glfwGetProcAddress("glfwGetJoystickUserPointer");
table->glfwJoystickIsGamepad = (int (*)(int))glfwGetProcAddress("glfwJoystickIsGamepad");
table->glfwSetJoystickCallback = (GLFWjoystickfun (*)(GLFWjoystickfun))glfwGetProcAddress("glfwSetJoystickCallback");
table->glfwUpdateGamepadMappings = (int (*)(const char*))glfwGetProcAddress("glfwUpdateGamepadMappings");
table->glfwGetGamepadName = (const char* (*)(int))glfwGetProcAddress("glfwGetGamepadName");
table->glfwGetGamepadState = (int (*)(int, GLFWgamepadstate*))glfwGetProcAddress("glfwGetGamepadState");
table->glfwSetClipboardString = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetClipboardString");
table->glfwGetClipboardString = (const char* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetClipboardString");
table->glfwGetTime = (double (*)(void))glfwGetProcAddress("glfwGetTime");
table->glfwSetTime = (void (*)(double))glfwGetProcAddress("glfwSetTime");
table->glfwGetTimerValue = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerValue");
table->glfwGetTimerFrequency = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerFrequency");
table->glfwMakeContextCurrent = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMakeContextCurrent");
table->glfwGetCurrentContext = (GLFWwindow* (*)(void))glfwGetProcAddress("glfwGetCurrentContext");
table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers");
table->glfwSwapInterval = (void (*)(int))glfwGetProcAddress("glfwSwapInterval");
table->glfwExtensionSupported = (int (*)(const char*))glfwGetProcAddress("glfwExtensionSupported");
table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress");
table->glfwVulkanSupported = (int (*)(void))glfwGetProcAddress("glfwVulkanSupported");
table->glfwGetRequiredInstanceExtensions = (const char** (*)(uint32_t*))glfwGetProcAddress("glfwGetRequiredInstanceExtensions");
}
@@ -0,0 +1,156 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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]<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]<int, 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;
}
}
@@ -0,0 +1,123 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
void (*glfwCreateCursor)(GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDefaultWindowHints)(void);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwDestroyWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
int (*glfwGetError)(const char** description);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwGetKey)(GLFWwindow* window, int key);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
GLFWmonitor** (*glfwGetMonitors)(int* count);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
double (*glfwGetTime)(void);
uint64_t (*glfwGetTimerFrequency)(void);
uint64_t (*glfwGetTimerValue)(void);
const char* (*glfwGetVersionString)(void);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwIconifyWindow)(GLFWwindow* window);
int (*glfwInit)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwPollEvents)(void);
void (*glfwPostEmptyEvent)(void);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
int (*glfwRawMouseMotionSupported)(void);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
void (*glfwSetTime)(double time);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
void (*glfwTerminate)(void);
int (*glfwUpdateGamepadMappings)(const char* string);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
int (*glfwVulkanSupported)(void);
int (*glfwWindowShouldClose)(GLFWwindow* window);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,3 @@
#include "StgSharpNative.h"
#include "glfw_function_table.h"
#include <string.h>
@@ -0,0 +1,486 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
[LibraryImport(NativeLibName, EntryPoint = "glfwInit")]
internal static unsafe partial int glfwInit();
[LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")]
internal static unsafe partial void glfwTerminate();
[LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")]
internal static unsafe partial void glfwInitHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")]
internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")]
internal static unsafe partial byte* glfwGetVersionString();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetError")]
internal static unsafe partial int glfwGetError(byte** description);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")]
internal static unsafe partial delegate*<int,byte*,void> glfwSetErrorCallback(
delegate*<int,byte*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")]
internal static unsafe partial IntPtr* glfwGetMonitors(int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")]
internal static unsafe partial IntPtr glfwGetPrimaryMonitor();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")]
internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")]
internal static unsafe partial void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")]
internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")]
internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")]
internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")]
internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")]
internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetMonitorCallback(
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")]
internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")]
internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")]
internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")]
internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")]
internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp);
[LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")]
internal static unsafe partial void glfwDefaultWindowHints();
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")]
internal static unsafe partial void glfwWindowHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")]
internal static unsafe partial void glfwWindowHintString(int hint, byte* value);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")]
internal static unsafe partial IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")]
internal static unsafe partial void glfwDestroyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")]
internal static unsafe partial int glfwWindowShouldClose(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")]
internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")]
internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")]
internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")]
internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")]
internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")]
internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")]
internal static unsafe partial void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")]
internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")]
internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")]
internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")]
internal static unsafe partial void glfwGetWindowFrameSize(
IntPtr window,
int* left,
int* top,
int* right,
int* bottom);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")]
internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")]
internal static unsafe partial float glfwGetWindowOpacity(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")]
internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity);
[LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")]
internal static unsafe partial void glfwIconifyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")]
internal static unsafe partial void glfwRestoreWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")]
internal static unsafe partial void glfwMaximizeWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")]
internal static unsafe partial void glfwShowWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")]
internal static unsafe partial void glfwHideWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")]
internal static unsafe partial void glfwFocusWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")]
internal static unsafe partial void glfwRequestWindowAttention(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")]
internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")]
internal static unsafe partial void glfwSetWindowMonitor(
IntPtr window,
IntPtr monitor,
int xpos,
int ypos,
int width,
int height,
int refreshRate);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")]
internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")]
internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")]
internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")]
internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")]
internal static unsafe partial delegate*<glfwWindow*,void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")]
internal static unsafe partial delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")]
internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")]
internal static unsafe partial delegate*<glfwWindow*, float,float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float,float> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")]
internal static unsafe partial void glfwPollEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")]
internal static unsafe partial void glfwWaitEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")]
internal static unsafe partial void glfwWaitEventsTimeout(double timeout);
[LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")]
internal static unsafe partial void glfwPostEmptyEvent();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")]
internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")]
internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")]
internal static unsafe partial int glfwRawMouseMotionSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")]
internal static unsafe partial byte* glfwGetKeyName(int key, int scancode);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")]
internal static unsafe partial int glfwGetKeyScancode(int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")]
internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")]
internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")]
internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")]
internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")]
internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")]
internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")]
internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")]
internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,int,void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")]
internal static unsafe partial delegate*<glfwWindow*,uint,void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*,uint,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,byte**,void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*,int,byte**,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")]
internal static unsafe partial int glfwJoystickPresent(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")]
internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")]
internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")]
internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")]
internal static unsafe partial byte* glfwGetJoystickName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")]
internal static unsafe partial byte* glfwGetJoystickGUID(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")]
internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")]
internal static unsafe partial void* glfwGetJoystickUserPointer(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")]
internal static unsafe partial int glfwJoystickIsGamepad(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")]
internal static unsafe partial delegate*<int,int,void> glfwSetJoystickCallback(delegate*<int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")]
internal static unsafe partial int glfwUpdateGamepadMappings(byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")]
internal static unsafe partial byte* glfwGetGamepadName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")]
internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")]
internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")]
internal static unsafe partial byte* glfwGetClipboardString(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")]
internal static unsafe partial double glfwGetTime();
[LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")]
internal static unsafe partial void glfwSetTime(double time);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")]
internal static unsafe partial ulong* glfwGetTimerValue();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")]
internal static unsafe partial ulong* glfwGetTimerFrequency();
[LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")]
internal static unsafe partial void glfwMakeContextCurrent(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")]
internal static unsafe partial IntPtr glfwGetCurrentContext();
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")]
internal static unsafe partial void glfwSwapBuffers(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")]
internal static unsafe partial void glfwSwapInterval(int interval);
[LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")]
internal static unsafe partial int glfwExtensionSupported(byte* extension);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)]
internal static unsafe partial IntPtr glfwGetProcAddress(string procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")]
internal static unsafe partial int glfwVulkanSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")]
internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,486 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
[LibraryImport(NativeLibName, EntryPoint = "glfwInit")]
internal static unsafe partial int glfwInit();
[LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")]
internal static unsafe partial void glfwTerminate();
[LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")]
internal static unsafe partial void glfwInitHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")]
internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")]
internal static unsafe partial byte* glfwGetVersionString();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetError")]
internal static unsafe partial int glfwGetError(byte** description);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")]
internal static unsafe partial delegate*<int,byte*,void> glfwSetErrorCallback(
delegate*<int,byte*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")]
internal static unsafe partial IntPtr* glfwGetMonitors(int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")]
internal static unsafe partial IntPtr glfwGetPrimaryMonitor();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")]
internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")]
internal static unsafe partial void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")]
internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")]
internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")]
internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")]
internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")]
internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetMonitorCallback(
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")]
internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")]
internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")]
internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")]
internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")]
internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp);
[LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")]
internal static unsafe partial void glfwDefaultWindowHints();
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")]
internal static unsafe partial void glfwWindowHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")]
internal static unsafe partial void glfwWindowHintString(int hint, byte* value);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")]
internal static unsafe partial IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")]
internal static unsafe partial void glfwDestroyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")]
internal static unsafe partial int glfwWindowShouldClose(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")]
internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")]
internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")]
internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")]
internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")]
internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")]
internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")]
internal static unsafe partial void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")]
internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")]
internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")]
internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")]
internal static unsafe partial void glfwGetWindowFrameSize(
IntPtr window,
int* left,
int* top,
int* right,
int* bottom);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")]
internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")]
internal static unsafe partial float glfwGetWindowOpacity(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")]
internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity);
[LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")]
internal static unsafe partial void glfwIconifyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")]
internal static unsafe partial void glfwRestoreWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")]
internal static unsafe partial void glfwMaximizeWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")]
internal static unsafe partial void glfwShowWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")]
internal static unsafe partial void glfwHideWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")]
internal static unsafe partial void glfwFocusWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")]
internal static unsafe partial void glfwRequestWindowAttention(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")]
internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")]
internal static unsafe partial void glfwSetWindowMonitor(
IntPtr window,
IntPtr monitor,
int xpos,
int ypos,
int width,
int height,
int refreshRate);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")]
internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")]
internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")]
internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")]
internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")]
internal static unsafe partial delegate*<glfwWindow*,void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")]
internal static unsafe partial delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")]
internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")]
internal static unsafe partial delegate*<glfwWindow*, float,float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float,float> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")]
internal static unsafe partial void glfwPollEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")]
internal static unsafe partial void glfwWaitEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")]
internal static unsafe partial void glfwWaitEventsTimeout(double timeout);
[LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")]
internal static unsafe partial void glfwPostEmptyEvent();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")]
internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")]
internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")]
internal static unsafe partial int glfwRawMouseMotionSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")]
internal static unsafe partial byte* glfwGetKeyName(int key, int scancode);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")]
internal static unsafe partial int glfwGetKeyScancode(int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")]
internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")]
internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")]
internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")]
internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")]
internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")]
internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")]
internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")]
internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,int,void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")]
internal static unsafe partial delegate*<glfwWindow*,uint,void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*,uint,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,byte**,void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*,int,byte**,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")]
internal static unsafe partial int glfwJoystickPresent(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")]
internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")]
internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")]
internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")]
internal static unsafe partial byte* glfwGetJoystickName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")]
internal static unsafe partial byte* glfwGetJoystickGUID(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")]
internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")]
internal static unsafe partial void* glfwGetJoystickUserPointer(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")]
internal static unsafe partial int glfwJoystickIsGamepad(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")]
internal static unsafe partial delegate*<int,int,void> glfwSetJoystickCallback(delegate*<int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")]
internal static unsafe partial int glfwUpdateGamepadMappings(byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")]
internal static unsafe partial byte* glfwGetGamepadName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")]
internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")]
internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")]
internal static unsafe partial byte* glfwGetClipboardString(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")]
internal static unsafe partial double glfwGetTime();
[LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")]
internal static unsafe partial void glfwSetTime(double time);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")]
internal static unsafe partial ulong* glfwGetTimerValue();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")]
internal static unsafe partial ulong* glfwGetTimerFrequency();
[LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")]
internal static unsafe partial void glfwMakeContextCurrent(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")]
internal static unsafe partial IntPtr glfwGetCurrentContext();
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")]
internal static unsafe partial void glfwSwapBuffers(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")]
internal static unsafe partial void glfwSwapInterval(int interval);
[LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")]
internal static unsafe partial int glfwExtensionSupported(byte* extension);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)]
internal static unsafe partial IntPtr glfwGetProcAddress(string procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")]
internal static unsafe partial int glfwVulkanSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")]
internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,363 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
internal static unsafe int glfwInit() => _glfw.glfwInit();
internal static unsafe void glfwTerminate() => _glfw.glfwTerminate();
internal static unsafe void glfwInitHint(int hint, int value) => _glfw.glfwInitHint(hint, value);
internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) => _glfw.glfwGetVersion(major, minor, rev);
internal static unsafe byte* glfwGetVersionString() => _glfw.glfwGetVersionString();
internal static unsafe int glfwGetError(byte** description) => _glfw.glfwGetError(description);
internal static unsafe delegate*<int, byte*, void> glfwSetErrorCallback(delegate*<int, byte*, void> callback) => _glfw.glfwSetErrorCallback(callback);
internal static unsafe IntPtr* glfwGetMonitors(int* count) => _glfw.glfwGetMonitors(count);
internal static unsafe IntPtr glfwGetPrimaryMonitor() => _glfw.glfwGetPrimaryMonitor();
internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) => _glfw.glfwGetMonitorPos(monitor, xpos, ypos);
internal static unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height) => _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height);
internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) => _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM);
internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) => _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale);
internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) => _glfw.glfwGetMonitorName(monitor);
internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) => _glfw.glfwSetMonitorUserPointer(monitor, pointer);
internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) => _glfw.glfwGetMonitorUserPointer(monitor);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetMonitorCallback(
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetMonitorCallback(callback);
internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) => _glfw.glfwGetVideoModes(monitor, count);
internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) => _glfw.glfwGetVideoMode(monitor);
internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) => _glfw.glfwSetGamma(monitor, gamma);
internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) => _glfw.glfwGetGammaRamp(monitor);
internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) => _glfw.glfwSetGammaRamp(monitor, ramp);
internal static unsafe void glfwDefaultWindowHints() => _glfw.glfwDefaultWindowHints();
internal static unsafe void glfwWindowHint(int hint, int value) => _glfw.glfwWindowHint(hint, value);
internal static unsafe void glfwWindowHintString(int hint, byte* value) => _glfw.glfwWindowHintString(hint, value);
internal static unsafe IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share) => _glfw.glfwCreateWindow(width, height, title, monitor, share);
internal static unsafe void glfwDestroyWindow(IntPtr window) => _glfw.glfwDestroyWindow(window);
internal static unsafe int glfwWindowShouldClose(IntPtr window) => _glfw.glfwWindowShouldClose(window);
internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) => _glfw.glfwSetWindowShouldClose(window, value);
internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) => _glfw.glfwSetWindowTitle(window, title);
internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) => _glfw.glfwSetWindowIcon(window, count, images);
internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) => _glfw.glfwGetWindowPos(window, xpos, ypos);
internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) => _glfw.glfwSetWindowPos(window, xpos, ypos);
internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) => _glfw.glfwGetWindowSize(window, width, height);
internal static unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight) => _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight);
internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) => _glfw.glfwSetWindowAspectRatio(window, numer, denom);
internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) => _glfw.glfwSetWindowSize(window, width, height);
internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) => _glfw.glfwGetFramebufferSize(window, width, height);
internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) => _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom);
internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) => _glfw.glfwGetWindowContentScale(window, xscale, yscale);
internal static unsafe float glfwGetWindowOpacity(IntPtr window) => _glfw.glfwGetWindowOpacity(window);
internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) => _glfw.glfwSetWindowOpacity(window, opacity);
internal static unsafe void glfwIconifyWindow(IntPtr window) => _glfw.glfwIconifyWindow(window);
internal static unsafe void glfwRestoreWindow(IntPtr window) => _glfw.glfwRestoreWindow(window);
internal static unsafe void glfwMaximizeWindow(IntPtr window) => _glfw.glfwMaximizeWindow(window);
internal static unsafe void glfwShowWindow(IntPtr window) => _glfw.glfwShowWindow(window);
internal static unsafe void glfwHideWindow(IntPtr window) => _glfw.glfwHideWindow(window);
internal static unsafe void glfwFocusWindow(IntPtr window) => _glfw.glfwFocusWindow(window);
internal static unsafe void glfwRequestWindowAttention(IntPtr window) => _glfw.glfwRequestWindowAttention(window);
internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) => _glfw.glfwGetWindowMonitor(window);
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);
internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) => _glfw.glfwGetWindowAttrib(window, attrib);
internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) => _glfw.glfwSetWindowAttrib(window, attrib, value);
internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) => _glfw.glfwSetWindowUserPointer(window, pointer);
internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) => _glfw.glfwGetWindowUserPointer(window);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback) => _glfw.glfwSetWindowPosCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, void> callback) => _glfw.glfwSetWindowSizeCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback) => _glfw.glfwSetWindowCloseCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback) => _glfw.glfwSetWindowRefreshCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowFocusCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowIconifyCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetWindowMaximizeCallback(window, callback);
internal static unsafe FrameBufferSizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback) => _glfw.glfwSetFramebufferSizeCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, float, float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float, float> callback) => _glfw.glfwSetWindowContentScaleCallback(window, callback);
internal static unsafe void glfwPollEvents() => _glfw.glfwPollEvents();
internal static unsafe void glfwWaitEvents() => _glfw.glfwWaitEvents();
internal static unsafe void glfwWaitEventsTimeout(double timeout) => _glfw.glfwWaitEventsTimeout(timeout);
internal static unsafe void glfwPostEmptyEvent() => _glfw.glfwPostEmptyEvent();
internal static unsafe int glfwGetInputMode(IntPtr window, int mode) => _glfw.glfwGetInputMode(window, mode);
internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) => _glfw.glfwSetInputMode(window, mode, value);
internal static unsafe int glfwRawMouseMotionSupported() => _glfw.glfwRawMouseMotionSupported();
internal static unsafe byte* glfwGetKeyName(int key, int scancode) => _glfw.glfwGetKeyName(key, scancode);
internal static unsafe int glfwGetKeyScancode(int key) => _glfw.glfwGetKeyScancode(key);
internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) => _glfw.glfwGetKey(window, key);
internal static unsafe int glfwGetMouseButton(IntPtr window, int button) => _glfw.glfwGetMouseButton(window, button);
internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) => _glfw.glfwGetCursorPos(window, xpos, ypos);
internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) => _glfw.glfwSetCursorPos(window, xpos, ypos);
internal static unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot) => _glfw.glfwCreateCursor(image, xhot, yhot);
internal static unsafe GLFWcursor* glfwCreateStandardCursor(int shape) => _glfw.glfwCreateStandardCursor(shape);
internal static unsafe void glfwDestroyCursor(GLFWcursor* cursor) => _glfw.glfwDestroyCursor(cursor);
internal static unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor) => _glfw.glfwSetCursor(window, cursor);
internal static unsafe delegate*<glfwWindow*, int, int, int, int, void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, int, int, void> callback) => _glfw.glfwSetKeyCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, uint, void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*, uint, void> callback) => _glfw.glfwSetCharCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, void> callback) => _glfw.glfwSetCharModsCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, int, int, void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*, int, int, int, void> callback) => _glfw.glfwSetMouseButtonCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, double, double, void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*, double, double, void> callback) => _glfw.glfwSetCursorPosCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*, int, void> callback) => _glfw.glfwSetCursorEnterCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, double, double, void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*, double, double, void> callback) => _glfw.glfwSetScrollCallback(window, callback);
internal static unsafe delegate*<glfwWindow*, int, byte**, void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*, int, byte**, void> callback) => _glfw.glfwSetDropCallback(window, callback);
internal static unsafe int glfwJoystickPresent(int jid) => _glfw.glfwJoystickPresent(jid);
internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) => _glfw.glfwGetJoystickAxes(jid, count);
internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) => _glfw.glfwGetJoystickButtons(jid, count);
internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) => _glfw.glfwGetJoystickHats(jid, count);
internal static unsafe byte* glfwGetJoystickName(int jid) => _glfw.glfwGetJoystickName(jid);
internal static unsafe byte* glfwGetJoystickGUID(int jid) => _glfw.glfwGetJoystickGUID(jid);
internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) => _glfw.glfwSetJoystickUserPointer(jid, pointer);
internal static unsafe void* glfwGetJoystickUserPointer(int jid) => _glfw.glfwGetJoystickUserPointer(jid);
internal static unsafe int glfwJoystickIsGamepad(int jid) => _glfw.glfwJoystickIsGamepad(jid);
internal static unsafe delegate*<int, int, void> glfwSetJoystickCallback(delegate*<int, int, void> callback) => _glfw.glfwSetJoystickCallback(callback);
internal static unsafe int glfwUpdateGamepadMappings(byte* str) => _glfw.glfwUpdateGamepadMappings(str);
internal static unsafe byte* glfwGetGamepadName(int jid) => _glfw.glfwGetGamepadName(jid);
internal static unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state) => _glfw.glfwGetGamepadState(jid, state);
internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) => _glfw.glfwSetClipboardString(window, str);
internal static unsafe byte* glfwGetClipboardString(IntPtr window) => _glfw.glfwGetClipboardString(window);
internal static unsafe double glfwGetTime() => _glfw.glfwGetTime();
internal static unsafe void glfwSetTime(double time) => _glfw.glfwSetTime(time);
internal static unsafe ulong* glfwGetTimerValue() => _glfw.glfwGetTimerValue();
internal static unsafe ulong* glfwGetTimerFrequency() => _glfw.glfwGetTimerFrequency();
internal static unsafe void glfwMakeContextCurrent(IntPtr window) => _glfw.glfwMakeContextCurrent(window);
internal static unsafe IntPtr glfwGetCurrentContext() => _glfw.glfwGetCurrentContext();
internal static unsafe void glfwSwapBuffers(IntPtr window) => _glfw.glfwSwapBuffers(window);
internal static unsafe void glfwSwapInterval(int interval) => _glfw.glfwSwapInterval(interval);
internal static unsafe int glfwExtensionSupported(byte* extension) => _glfw.glfwExtensionSupported(extension);
internal static unsafe IntPtr glfwGetProcAddress(string procname) => _glfw.glfwGetProcAddress(procname);
internal static unsafe int glfwVulkanSupported() => _glfw.glfwVulkanSupported();
internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) => _glfw.glfwGetRequiredInstanceExtensions(count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,156 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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]<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]<int, 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;
}
}
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -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.C";
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 SemaphoreSlim(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,132 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwGetVersion)(int* major, int* minor, int* rev);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
int (*glfwUpdateGamepadMappings)(const char* str);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* str);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
unsigned long long (*glfwGetTimerValue)(void);
unsigned long long (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
GLFWglproc (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count);
} GLFWFunctionTable;
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,132 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwGetVersion)(int* major, int* minor, int* rev);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
int (*glfwUpdateGamepadMappings)(const char* str);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* str);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
unsigned long long (*glfwGetTimerValue)(void);
unsigned long long (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
GLFWglproc (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count);
} GLFWFunctionTable;
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,711 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.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
internal static unsafe int glfwInit()
{
return _glfw.glfwInit();
}
internal static unsafe void glfwTerminate()
{
_glfw.glfwTerminate();
}
internal static unsafe void glfwInitHint(int hint, int value)
{
_glfw.glfwInitHint(hint, value);
}
internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev)
{
_glfw.glfwGetVersion(major, minor, rev);
}
internal static unsafe byte* glfwGetVersionString()
{
return _glfw.glfwGetVersionString();
}
internal static unsafe int glfwGetError(byte** description)
{
return _glfw.glfwGetError(description);
}
internal static unsafe delegate* unmanaged[Cdecl]<int, byte*, void> glfwSetErrorCallback(
delegate* unmanaged[Cdecl]<int, byte*, void> callback)
{
return _glfw.glfwSetErrorCallback(callback);
}
internal static unsafe IntPtr* glfwGetMonitors(int* count)
{
return _glfw.glfwGetMonitors(count);
}
internal static unsafe IntPtr glfwGetPrimaryMonitor()
{
return _glfw.glfwGetPrimaryMonitor();
}
internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos)
{
_glfw.glfwGetMonitorPos(monitor, xpos, ypos);
}
internal static unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height)
{
_glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height);
}
internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM)
{
_glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM);
}
internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale)
{
_glfw.glfwGetMonitorContentScale(monitor, xscale, yscale);
}
internal static unsafe byte* glfwGetMonitorName(IntPtr monitor)
{
return _glfw.glfwGetMonitorName(monitor);
}
internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer)
{
_glfw.glfwSetMonitorUserPointer(monitor, pointer);
}
internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor)
{
return _glfw.glfwGetMonitorUserPointer(monitor);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetMonitorCallback(
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetMonitorCallback(callback);
}
internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count)
{
return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count);
}
internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor)
{
return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor);
}
internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma)
{
_glfw.glfwSetGamma(monitor, gamma);
}
internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor)
{
return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor);
}
internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp)
{
_glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp);
}
internal static unsafe void glfwDefaultWindowHints()
{
_glfw.glfwDefaultWindowHints();
}
internal static unsafe void glfwWindowHint(int hint, int value)
{
_glfw.glfwWindowHint(hint, value);
}
internal static unsafe void glfwWindowHintString(int hint, byte* value)
{
_glfw.glfwWindowHintString(hint, value);
}
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);
}
}
internal static unsafe void glfwDestroyWindow(IntPtr window)
{
_glfw.glfwDestroyWindow(window);
}
internal static unsafe int glfwWindowShouldClose(IntPtr window)
{
return _glfw.glfwWindowShouldClose(window);
}
internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value)
{
_glfw.glfwSetWindowShouldClose(window, value);
}
internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title)
{
_glfw.glfwSetWindowTitle(window, title);
}
internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images)
{
_glfw.glfwSetWindowIcon(window, count, (IntPtr)images);
}
internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos)
{
_glfw.glfwGetWindowPos(window, xpos, ypos);
}
internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos)
{
_glfw.glfwSetWindowPos(window, xpos, ypos);
}
internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height)
{
_glfw.glfwGetWindowSize(window, width, height);
}
internal static unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight)
{
_glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight);
}
internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom)
{
_glfw.glfwSetWindowAspectRatio(window, numer, denom);
}
internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height)
{
_glfw.glfwSetWindowSize(window, width, height);
}
internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height)
{
_glfw.glfwGetFrameBufferSize(window, width, height);
}
internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom)
{
_glfw.glfwGetWindowFrameSize(window, left, top, right, bottom);
}
internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale)
{
_glfw.glfwGetWindowContentScale(window, xscale, yscale);
}
internal static unsafe float glfwGetWindowOpacity(IntPtr window)
{
return _glfw.glfwGetWindowOpacity(window);
}
internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity)
{
_glfw.glfwSetWindowOpacity(window, opacity);
}
internal static unsafe void glfwIconifyWindow(IntPtr window)
{
_glfw.glfwIconifyWindow(window);
}
internal static unsafe void glfwRestoreWindow(IntPtr window)
{
_glfw.glfwRestoreWindow(window);
}
internal static unsafe void glfwMaximizeWindow(IntPtr window)
{
_glfw.glfwMaximizeWindow(window);
}
internal static unsafe void glfwShowWindow(IntPtr window)
{
_glfw.glfwShowWindow(window);
}
internal static unsafe void glfwHideWindow(IntPtr window)
{
_glfw.glfwHideWindow(window);
}
internal static unsafe void glfwFocusWindow(IntPtr window)
{
_glfw.glfwFocusWindow(window);
}
internal static unsafe void glfwRequestWindowAttention(IntPtr window)
{
_glfw.glfwRequestWindowAttention(window);
}
internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window)
{
return _glfw.glfwGetWindowMonitor(window);
}
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);
}
internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib)
{
return _glfw.glfwGetWindowAttrib(window, attrib);
}
internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value)
{
_glfw.glfwSetWindowAttrib(window, attrib, value);
}
internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer)
{
_glfw.glfwSetWindowUserPointer(window, pointer);
}
internal static unsafe void* glfwGetWindowUserPointer(IntPtr window)
{
return _glfw.glfwGetWindowUserPointer(window);
}
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);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowCloseCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
{
return _glfw.glfwSetWindowCloseCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
{
return _glfw.glfwSetWindowRefreshCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowFocusCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowFocusCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowIconifyCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowMaximizeCallback(window, callback);
}
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);
}
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);
}
internal static unsafe void glfwPollEvents()
{
_glfw.glfwPollEvents();
}
internal static unsafe void glfwWaitEvents()
{
_glfw.glfwWaitEvents();
}
internal static unsafe void glfwWaitEventsTimeout(double timeout)
{
_glfw.glfwWaitEventsTimeout(timeout);
}
internal static unsafe void glfwPostEmptyEvent()
{
_glfw.glfwPostEmptyEvent();
}
internal static unsafe int glfwGetInputMode(IntPtr window, int mode)
{
return _glfw.glfwGetInputMode(window, mode);
}
internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value)
{
_glfw.glfwSetInputMode(window, mode, value);
}
internal static unsafe int glfwRawMouseMotionSupported()
{
return _glfw.glfwRawMouseMotionSupported();
}
internal static unsafe byte* glfwGetKeyName(int key, int scancode)
{
return _glfw.glfwGetKeyName(key, scancode);
}
internal static unsafe int glfwGetKeyScancode(int key)
{
return _glfw.glfwGetKeyScancode(key);
}
internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key)
{
return _glfw.glfwGetKey(window, key);
}
internal static unsafe int glfwGetMouseButton(IntPtr window, int button)
{
return _glfw.glfwGetMouseButton(window, button);
}
internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos)
{
_glfw.glfwGetCursorPos(window, xpos, ypos);
}
internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos)
{
_glfw.glfwSetCursorPos(window, xpos, ypos);
}
internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot)
{
return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot);
}
internal static unsafe IntPtr glfwCreateStandardCursor(int shape)
{
return _glfw.glfwCreateStandardCursor(shape);
}
internal static unsafe void glfwDestroyCursor(IntPtr cursor)
{
_glfw.glfwDestroyCursor(cursor);
}
internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor)
{
_glfw.glfwSetCursor(window, cursor);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, uint, void> glfwSetCharCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, uint, void> callback)
{
return _glfw.glfwSetCharCallback(window, callback);
}
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);
}
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);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetCursorEnterCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetCursorEnterCallback(window, callback);
}
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);
}
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);
}
internal static unsafe int glfwJoystickPresent(int jid)
{
return _glfw.glfwJoystickPresent(jid);
}
internal static unsafe float* glfwGetJoystickAxes(int jid, int* count)
{
return _glfw.glfwGetJoystickAxes(jid, count);
}
internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count)
{
return _glfw.glfwGetJoystickButtons(jid, count);
}
internal static unsafe byte* glfwGetJoystickHats(int jid, int* count)
{
return _glfw.glfwGetJoystickHats(jid, count);
}
internal static unsafe byte* glfwGetJoystickName(int jid)
{
return _glfw.glfwGetJoystickName(jid);
}
internal static unsafe byte* glfwGetJoystickGUID(int jid)
{
return _glfw.glfwGetJoystickGUID(jid);
}
internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer)
{
_glfw.glfwSetJoystickUserPointer(jid, pointer);
}
internal static unsafe void* glfwGetJoystickUserPointer(int jid)
{
return _glfw.glfwGetJoystickUserPointer(jid);
}
internal static unsafe int glfwJoystickIsGamepad(int jid)
{
return _glfw.glfwJoystickIsGamePad(jid);
}
internal static unsafe delegate* unmanaged[Cdecl]<int, int, void> glfwSetJoystickCallback(
delegate* unmanaged[Cdecl]<int, int, void> callback)
{
return _glfw.glfwSetJoystickCallback(callback);
}
internal static unsafe int glfwUpdateGamePadMappings(byte* str)
{
return _glfw.glfwUpdateGamePadMappings(str);
}
internal static unsafe byte* glfwGetGamePadName(int jid)
{
return _glfw.glfwGetGamepadName(jid);
}
internal static unsafe int glfwGetGamePadState(int jid, GLFWgamepadstate* state)
{
return _glfw.glfwGetGamepadState(jid, (IntPtr)state);
}
internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str)
{
_glfw.glfwSetClipboardString(window, str);
}
internal static unsafe byte* glfwGetClipboardString(IntPtr window)
{
return _glfw.glfwGetClipboardString(window);
}
internal static unsafe double glfwGetTime()
{
return _glfw.glfwGetTime();
}
internal static unsafe void glfwSetTime(double time)
{
_glfw.glfwSetTime(time);
}
internal static unsafe ulong glfwGetTimerValue()
{
return _glfw.glfwGetTimerValue();
}
internal static unsafe ulong glfwGetTimerFrequency()
{
return _glfw.glfwGetTimerFrequency();
}
internal static unsafe void glfwMakeContextCurrent(IntPtr window)
{
_glfw.glfwMakeContextCurrent(window);
}
internal static unsafe IntPtr glfwGetCurrentContext()
{
return _glfw.glfwGetCurrentContext();
}
internal static unsafe void glfwSwapBuffers(IntPtr window)
{
_glfw.glfwSwapBuffers(window);
}
internal static unsafe void glfwSwapInterval(int interval)
{
_glfw.glfwSwapInterval(interval);
}
internal static unsafe int glfwExtensionSupported(byte* extension)
{
return _glfw.glfwExtensionSupported(extension);
}
internal static unsafe IntPtr glfwGetProcAddress(string procName)
{
return glfwGetProcAddress(Encoding.UTF8.GetBytes(procName));
}
internal static unsafe IntPtr glfwGetProcAddress(Span<byte> procName)
{
fixed (byte* bPtr = procName) {
return _glfw.glfwGetProcAddress(bPtr);
}
}
internal static unsafe int glfwVulkanSupported()
{
return _glfw.glfwVulkanSupported();
}
internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count)
{
return _glfw.glfwGetRequiredInstanceExtensions(count);
}
}
}
#endregion
@@ -0,0 +1,132 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "../glfw/glfw3.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwGetVersion)(int* major, int* minor, int* rev);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
int (*glfwUpdateGamepadMappings)(const char* str);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* str);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
unsigned long long (*glfwGetTimerValue)(void);
unsigned long long (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
GLFWglproc (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count);
} GLFWFunctionTable;
#ifdef __cplusplus
}
#endif
#endif
@@ -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,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,711 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.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
internal static unsafe int glfwInit()
{
return _glfw.glfwInit();
}
internal static unsafe void glfwTerminate()
{
_glfw.glfwTerminate();
}
internal static unsafe void glfwInitHint(int hint, int value)
{
_glfw.glfwInitHint(hint, value);
}
internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev)
{
_glfw.glfwGetVersion(major, minor, rev);
}
internal static unsafe byte* glfwGetVersionString()
{
return _glfw.glfwGetVersionString();
}
internal static unsafe int glfwGetError(byte** description)
{
return _glfw.glfwGetError(description);
}
internal static unsafe delegate* unmanaged[Cdecl]<int, byte*, void> glfwSetErrorCallback(
delegate* unmanaged[Cdecl]<int, byte*, void> callback)
{
return _glfw.glfwSetErrorCallback(callback);
}
internal static unsafe IntPtr* glfwGetMonitors(int* count)
{
return _glfw.glfwGetMonitors(count);
}
internal static unsafe IntPtr glfwGetPrimaryMonitor()
{
return _glfw.glfwGetPrimaryMonitor();
}
internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos)
{
_glfw.glfwGetMonitorPos(monitor, xpos, ypos);
}
internal static unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height)
{
_glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height);
}
internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM)
{
_glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM);
}
internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale)
{
_glfw.glfwGetMonitorContentScale(monitor, xscale, yscale);
}
internal static unsafe byte* glfwGetMonitorName(IntPtr monitor)
{
return _glfw.glfwGetMonitorName(monitor);
}
internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer)
{
_glfw.glfwSetMonitorUserPointer(monitor, pointer);
}
internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor)
{
return _glfw.glfwGetMonitorUserPointer(monitor);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetMonitorCallback(
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetMonitorCallback(callback);
}
internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count)
{
return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count);
}
internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor)
{
return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor);
}
internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma)
{
_glfw.glfwSetGamma(monitor, gamma);
}
internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor)
{
return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor);
}
internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp)
{
_glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp);
}
internal static unsafe void glfwDefaultWindowHints()
{
_glfw.glfwDefaultWindowHints();
}
internal static unsafe void glfwWindowHint(int hint, int value)
{
_glfw.glfwWindowHint(hint, value);
}
internal static unsafe void glfwWindowHintString(int hint, byte* value)
{
_glfw.glfwWindowHintString(hint, value);
}
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);
}
}
internal static unsafe void glfwDestroyWindow(IntPtr window)
{
_glfw.glfwDestroyWindow(window);
}
internal static unsafe int glfwWindowShouldClose(IntPtr window)
{
return _glfw.glfwWindowShouldClose(window);
}
internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value)
{
_glfw.glfwSetWindowShouldClose(window, value);
}
internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title)
{
_glfw.glfwSetWindowTitle(window, title);
}
internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images)
{
_glfw.glfwSetWindowIcon(window, count, (IntPtr)images);
}
internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos)
{
_glfw.glfwGetWindowPos(window, xpos, ypos);
}
internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos)
{
_glfw.glfwSetWindowPos(window, xpos, ypos);
}
internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height)
{
_glfw.glfwGetWindowSize(window, width, height);
}
internal static unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight)
{
_glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight);
}
internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom)
{
_glfw.glfwSetWindowAspectRatio(window, numer, denom);
}
internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height)
{
_glfw.glfwSetWindowSize(window, width, height);
}
internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height)
{
_glfw.glfwGetFrameBufferSize(window, width, height);
}
internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom)
{
_glfw.glfwGetWindowFrameSize(window, left, top, right, bottom);
}
internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale)
{
_glfw.glfwGetWindowContentScale(window, xscale, yscale);
}
internal static unsafe float glfwGetWindowOpacity(IntPtr window)
{
return _glfw.glfwGetWindowOpacity(window);
}
internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity)
{
_glfw.glfwSetWindowOpacity(window, opacity);
}
internal static unsafe void glfwIconifyWindow(IntPtr window)
{
_glfw.glfwIconifyWindow(window);
}
internal static unsafe void glfwRestoreWindow(IntPtr window)
{
_glfw.glfwRestoreWindow(window);
}
internal static unsafe void glfwMaximizeWindow(IntPtr window)
{
_glfw.glfwMaximizeWindow(window);
}
internal static unsafe void glfwShowWindow(IntPtr window)
{
_glfw.glfwShowWindow(window);
}
internal static unsafe void glfwHideWindow(IntPtr window)
{
_glfw.glfwHideWindow(window);
}
internal static unsafe void glfwFocusWindow(IntPtr window)
{
_glfw.glfwFocusWindow(window);
}
internal static unsafe void glfwRequestWindowAttention(IntPtr window)
{
_glfw.glfwRequestWindowAttention(window);
}
internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window)
{
return _glfw.glfwGetWindowMonitor(window);
}
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);
}
internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib)
{
return _glfw.glfwGetWindowAttrib(window, attrib);
}
internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value)
{
_glfw.glfwSetWindowAttrib(window, attrib, value);
}
internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer)
{
_glfw.glfwSetWindowUserPointer(window, pointer);
}
internal static unsafe void* glfwGetWindowUserPointer(IntPtr window)
{
return _glfw.glfwGetWindowUserPointer(window);
}
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);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowCloseCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
{
return _glfw.glfwSetWindowCloseCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
{
return _glfw.glfwSetWindowRefreshCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowFocusCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowFocusCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowIconifyCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowMaximizeCallback(window, callback);
}
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);
}
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);
}
internal static unsafe void glfwPollEvents()
{
_glfw.glfwPollEvents();
}
internal static unsafe void glfwWaitEvents()
{
_glfw.glfwWaitEvents();
}
internal static unsafe void glfwWaitEventsTimeout(double timeout)
{
_glfw.glfwWaitEventsTimeout(timeout);
}
internal static unsafe void glfwPostEmptyEvent()
{
_glfw.glfwPostEmptyEvent();
}
internal static unsafe int glfwGetInputMode(IntPtr window, int mode)
{
return _glfw.glfwGetInputMode(window, mode);
}
internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value)
{
_glfw.glfwSetInputMode(window, mode, value);
}
internal static unsafe int glfwRawMouseMotionSupported()
{
return _glfw.glfwRawMouseMotionSupported();
}
internal static unsafe byte* glfwGetKeyName(int key, int scancode)
{
return _glfw.glfwGetKeyName(key, scancode);
}
internal static unsafe int glfwGetKeyScancode(int key)
{
return _glfw.glfwGetKeyScancode(key);
}
internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key)
{
return _glfw.glfwGetKey(window, key);
}
internal static unsafe int glfwGetMouseButton(IntPtr window, int button)
{
return _glfw.glfwGetMouseButton(window, button);
}
internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos)
{
_glfw.glfwGetCursorPos(window, xpos, ypos);
}
internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos)
{
_glfw.glfwSetCursorPos(window, xpos, ypos);
}
internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot)
{
return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot);
}
internal static unsafe IntPtr glfwCreateStandardCursor(int shape)
{
return _glfw.glfwCreateStandardCursor(shape);
}
internal static unsafe void glfwDestroyCursor(IntPtr cursor)
{
_glfw.glfwDestroyCursor(cursor);
}
internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor)
{
_glfw.glfwSetCursor(window, cursor);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, uint, void> glfwSetCharCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, uint, void> callback)
{
return _glfw.glfwSetCharCallback(window, callback);
}
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);
}
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);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetCursorEnterCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetCursorEnterCallback(window, callback);
}
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);
}
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);
}
internal static unsafe int glfwJoystickPresent(int jid)
{
return _glfw.glfwJoystickPresent(jid);
}
internal static unsafe float* glfwGetJoystickAxes(int jid, int* count)
{
return _glfw.glfwGetJoystickAxes(jid, count);
}
internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count)
{
return _glfw.glfwGetJoystickButtons(jid, count);
}
internal static unsafe byte* glfwGetJoystickHats(int jid, int* count)
{
return _glfw.glfwGetJoystickHats(jid, count);
}
internal static unsafe byte* glfwGetJoystickName(int jid)
{
return _glfw.glfwGetJoystickName(jid);
}
internal static unsafe byte* glfwGetJoystickGUID(int jid)
{
return _glfw.glfwGetJoystickGUID(jid);
}
internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer)
{
_glfw.glfwSetJoystickUserPointer(jid, pointer);
}
internal static unsafe void* glfwGetJoystickUserPointer(int jid)
{
return _glfw.glfwGetJoystickUserPointer(jid);
}
internal static unsafe int glfwJoystickIsGamepad(int jid)
{
return _glfw.glfwJoystickIsGamePad(jid);
}
internal static unsafe delegate* unmanaged[Cdecl]<int, int, void> glfwSetJoystickCallback(
delegate* unmanaged[Cdecl]<int, int, void> callback)
{
return _glfw.glfwSetJoystickCallback(callback);
}
internal static unsafe int glfwUpdateGamePadMappings(byte* str)
{
return _glfw.glfwUpdateGamePadMappings(str);
}
internal static unsafe byte* glfwGetGamePadName(int jid)
{
return _glfw.glfwGetGamepadName(jid);
}
internal static unsafe int glfwGetGamePadState(int jid, GLFWgamepadstate* state)
{
return _glfw.glfwGetGamepadState(jid, (IntPtr)state);
}
internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str)
{
_glfw.glfwSetClipboardString(window, str);
}
internal static unsafe byte* glfwGetClipboardString(IntPtr window)
{
return _glfw.glfwGetClipboardString(window);
}
internal static unsafe double glfwGetTime()
{
return _glfw.glfwGetTime();
}
internal static unsafe void glfwSetTime(double time)
{
_glfw.glfwSetTime(time);
}
internal static unsafe ulong glfwGetTimerValue()
{
return _glfw.glfwGetTimerValue();
}
internal static unsafe ulong glfwGetTimerFrequency()
{
return _glfw.glfwGetTimerFrequency();
}
internal static unsafe void glfwMakeContextCurrent(IntPtr window)
{
_glfw.glfwMakeContextCurrent(window);
}
internal static unsafe IntPtr glfwGetCurrentContext()
{
return _glfw.glfwGetCurrentContext();
}
internal static unsafe void glfwSwapBuffers(IntPtr window)
{
_glfw.glfwSwapBuffers(window);
}
internal static unsafe void glfwSwapInterval(int interval)
{
_glfw.glfwSwapInterval(interval);
}
internal static unsafe int glfwExtensionSupported(byte* extension)
{
return _glfw.glfwExtensionSupported(extension);
}
internal static unsafe IntPtr glfwGetProcAddress(string procName)
{
return glfwGetProcAddress(Encoding.UTF8.GetBytes(procName));
}
internal static unsafe IntPtr glfwGetProcAddress(Span<byte> procName)
{
fixed (byte* bPtr = procName) {
return _glfw.glfwGetProcAddress(bPtr);
}
}
internal static unsafe int glfwVulkanSupported()
{
return _glfw.glfwVulkanSupported();
}
internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count)
{
return _glfw.glfwGetRequiredInstanceExtensions(count);
}
}
}
#endregion
@@ -0,0 +1,711 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.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
internal static unsafe int glfwInit()
{
return _glfw.glfwInit();
}
internal static unsafe void glfwTerminate()
{
_glfw.glfwTerminate();
}
internal static unsafe void glfwInitHint(int hint, int value)
{
_glfw.glfwInitHint(hint, value);
}
internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev)
{
_glfw.glfwGetVersion(major, minor, rev);
}
internal static unsafe byte* glfwGetVersionString()
{
return _glfw.glfwGetVersionString();
}
internal static unsafe int glfwGetError(byte** description)
{
return _glfw.glfwGetError(description);
}
internal static unsafe delegate* unmanaged[Cdecl]<int, byte*, void> glfwSetErrorCallback(
delegate* unmanaged[Cdecl]<int, byte*, void> callback)
{
return _glfw.glfwSetErrorCallback(callback);
}
internal static unsafe IntPtr* glfwGetMonitors(int* count)
{
return _glfw.glfwGetMonitors(count);
}
internal static unsafe IntPtr glfwGetPrimaryMonitor()
{
return _glfw.glfwGetPrimaryMonitor();
}
internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos)
{
_glfw.glfwGetMonitorPos(monitor, xpos, ypos);
}
internal static unsafe void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height)
{
_glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height);
}
internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM)
{
_glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM);
}
internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale)
{
_glfw.glfwGetMonitorContentScale(monitor, xscale, yscale);
}
internal static unsafe byte* glfwGetMonitorName(IntPtr monitor)
{
return _glfw.glfwGetMonitorName(monitor);
}
internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer)
{
_glfw.glfwSetMonitorUserPointer(monitor, pointer);
}
internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor)
{
return _glfw.glfwGetMonitorUserPointer(monitor);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetMonitorCallback(
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetMonitorCallback(callback);
}
internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count)
{
return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count);
}
internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor)
{
return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor);
}
internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma)
{
_glfw.glfwSetGamma(monitor, gamma);
}
internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor)
{
return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor);
}
internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp)
{
_glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp);
}
internal static unsafe void glfwDefaultWindowHints()
{
_glfw.glfwDefaultWindowHints();
}
internal static unsafe void glfwWindowHint(int hint, int value)
{
_glfw.glfwWindowHint(hint, value);
}
internal static unsafe void glfwWindowHintString(int hint, byte* value)
{
_glfw.glfwWindowHintString(hint, value);
}
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);
}
}
internal static unsafe void glfwDestroyWindow(IntPtr window)
{
_glfw.glfwDestroyWindow(window);
}
internal static unsafe int glfwWindowShouldClose(IntPtr window)
{
return _glfw.glfwWindowShouldClose(window);
}
internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value)
{
_glfw.glfwSetWindowShouldClose(window, value);
}
internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title)
{
_glfw.glfwSetWindowTitle(window, title);
}
internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images)
{
_glfw.glfwSetWindowIcon(window, count, (IntPtr)images);
}
internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos)
{
_glfw.glfwGetWindowPos(window, xpos, ypos);
}
internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos)
{
_glfw.glfwSetWindowPos(window, xpos, ypos);
}
internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height)
{
_glfw.glfwGetWindowSize(window, width, height);
}
internal static unsafe void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight)
{
_glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight);
}
internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom)
{
_glfw.glfwSetWindowAspectRatio(window, numer, denom);
}
internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height)
{
_glfw.glfwSetWindowSize(window, width, height);
}
internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height)
{
_glfw.glfwGetFrameBufferSize(window, width, height);
}
internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom)
{
_glfw.glfwGetWindowFrameSize(window, left, top, right, bottom);
}
internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale)
{
_glfw.glfwGetWindowContentScale(window, xscale, yscale);
}
internal static unsafe float glfwGetWindowOpacity(IntPtr window)
{
return _glfw.glfwGetWindowOpacity(window);
}
internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity)
{
_glfw.glfwSetWindowOpacity(window, opacity);
}
internal static unsafe void glfwIconifyWindow(IntPtr window)
{
_glfw.glfwIconifyWindow(window);
}
internal static unsafe void glfwRestoreWindow(IntPtr window)
{
_glfw.glfwRestoreWindow(window);
}
internal static unsafe void glfwMaximizeWindow(IntPtr window)
{
_glfw.glfwMaximizeWindow(window);
}
internal static unsafe void glfwShowWindow(IntPtr window)
{
_glfw.glfwShowWindow(window);
}
internal static unsafe void glfwHideWindow(IntPtr window)
{
_glfw.glfwHideWindow(window);
}
internal static unsafe void glfwFocusWindow(IntPtr window)
{
_glfw.glfwFocusWindow(window);
}
internal static unsafe void glfwRequestWindowAttention(IntPtr window)
{
_glfw.glfwRequestWindowAttention(window);
}
internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window)
{
return _glfw.glfwGetWindowMonitor(window);
}
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);
}
internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib)
{
return _glfw.glfwGetWindowAttrib(window, attrib);
}
internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value)
{
_glfw.glfwSetWindowAttrib(window, attrib, value);
}
internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer)
{
_glfw.glfwSetWindowUserPointer(window, pointer);
}
internal static unsafe void* glfwGetWindowUserPointer(IntPtr window)
{
return _glfw.glfwGetWindowUserPointer(window);
}
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);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowCloseCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
{
return _glfw.glfwSetWindowCloseCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, void> callback)
{
return _glfw.glfwSetWindowRefreshCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowFocusCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowFocusCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowIconifyCallback(window, callback);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetWindowMaximizeCallback(window, callback);
}
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);
}
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);
}
internal static unsafe void glfwPollEvents()
{
_glfw.glfwPollEvents();
}
internal static unsafe void glfwWaitEvents()
{
_glfw.glfwWaitEvents();
}
internal static unsafe void glfwWaitEventsTimeout(double timeout)
{
_glfw.glfwWaitEventsTimeout(timeout);
}
internal static unsafe void glfwPostEmptyEvent()
{
_glfw.glfwPostEmptyEvent();
}
internal static unsafe int glfwGetInputMode(IntPtr window, int mode)
{
return _glfw.glfwGetInputMode(window, mode);
}
internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value)
{
_glfw.glfwSetInputMode(window, mode, value);
}
internal static unsafe int glfwRawMouseMotionSupported()
{
return _glfw.glfwRawMouseMotionSupported();
}
internal static unsafe byte* glfwGetKeyName(int key, int scancode)
{
return _glfw.glfwGetKeyName(key, scancode);
}
internal static unsafe int glfwGetKeyScancode(int key)
{
return _glfw.glfwGetKeyScancode(key);
}
internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key)
{
return _glfw.glfwGetKey(window, key);
}
internal static unsafe int glfwGetMouseButton(IntPtr window, int button)
{
return _glfw.glfwGetMouseButton(window, button);
}
internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos)
{
_glfw.glfwGetCursorPos(window, xpos, ypos);
}
internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos)
{
_glfw.glfwSetCursorPos(window, xpos, ypos);
}
internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot)
{
return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot);
}
internal static unsafe IntPtr glfwCreateStandardCursor(int shape)
{
return _glfw.glfwCreateStandardCursor(shape);
}
internal static unsafe void glfwDestroyCursor(IntPtr cursor)
{
_glfw.glfwDestroyCursor(cursor);
}
internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor)
{
_glfw.glfwSetCursor(window, cursor);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, uint, void> glfwSetCharCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, uint, void> callback)
{
return _glfw.glfwSetCharCallback(window, callback);
}
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);
}
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);
}
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);
}
internal static unsafe delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetCursorEnterCallback(
IntPtr window,
delegate* unmanaged[Cdecl]<IntPtr, int, void> callback)
{
return _glfw.glfwSetCursorEnterCallback(window, callback);
}
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);
}
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);
}
internal static unsafe int glfwJoystickPresent(int jid)
{
return _glfw.glfwJoystickPresent(jid);
}
internal static unsafe float* glfwGetJoystickAxes(int jid, int* count)
{
return _glfw.glfwGetJoystickAxes(jid, count);
}
internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count)
{
return _glfw.glfwGetJoystickButtons(jid, count);
}
internal static unsafe byte* glfwGetJoystickHats(int jid, int* count)
{
return _glfw.glfwGetJoystickHats(jid, count);
}
internal static unsafe byte* glfwGetJoystickName(int jid)
{
return _glfw.glfwGetJoystickName(jid);
}
internal static unsafe byte* glfwGetJoystickGUID(int jid)
{
return _glfw.glfwGetJoystickGUID(jid);
}
internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer)
{
_glfw.glfwSetJoystickUserPointer(jid, pointer);
}
internal static unsafe void* glfwGetJoystickUserPointer(int jid)
{
return _glfw.glfwGetJoystickUserPointer(jid);
}
internal static unsafe int glfwJoystickIsGamepad(int jid)
{
return _glfw.glfwJoystickIsGamePad(jid);
}
internal static unsafe delegate* unmanaged[Cdecl]<int, int, void> glfwSetJoystickCallback(
delegate* unmanaged[Cdecl]<int, int, void> callback)
{
return _glfw.glfwSetJoystickCallback(callback);
}
internal static unsafe int glfwUpdateGamePadMappings(byte* str)
{
return _glfw.glfwUpdateGamePadMappings(str);
}
internal static unsafe byte* glfwGetGamePadName(int jid)
{
return _glfw.glfwGetGamepadName(jid);
}
internal static unsafe int glfwGetGamePadState(int jid, GLFWgamepadstate* state)
{
return _glfw.glfwGetGamepadState(jid, (IntPtr)state);
}
internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str)
{
_glfw.glfwSetClipboardString(window, str);
}
internal static unsafe byte* glfwGetClipboardString(IntPtr window)
{
return _glfw.glfwGetClipboardString(window);
}
internal static unsafe double glfwGetTime()
{
return _glfw.glfwGetTime();
}
internal static unsafe void glfwSetTime(double time)
{
_glfw.glfwSetTime(time);
}
internal static unsafe ulong glfwGetTimerValue()
{
return _glfw.glfwGetTimerValue();
}
internal static unsafe ulong glfwGetTimerFrequency()
{
return _glfw.glfwGetTimerFrequency();
}
internal static unsafe void glfwMakeContextCurrent(IntPtr window)
{
_glfw.glfwMakeContextCurrent(window);
}
internal static unsafe IntPtr glfwGetCurrentContext()
{
return _glfw.glfwGetCurrentContext();
}
internal static unsafe void glfwSwapBuffers(IntPtr window)
{
_glfw.glfwSwapBuffers(window);
}
internal static unsafe void glfwSwapInterval(int interval)
{
_glfw.glfwSwapInterval(interval);
}
internal static unsafe int glfwExtensionSupported(byte* extension)
{
return _glfw.glfwExtensionSupported(extension);
}
internal static unsafe IntPtr glfwGetProcAddress(string procName)
{
return glfwGetProcAddress(Encoding.UTF8.GetBytes(procName));
}
internal static unsafe IntPtr glfwGetProcAddress(Span<byte> procName)
{
fixed (byte* bPtr = procName) {
return _glfw.glfwGetProcAddress(bPtr);
}
}
internal static unsafe int glfwVulkanSupported()
{
return _glfw.glfwVulkanSupported();
}
internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count)
{
return _glfw.glfwGetRequiredInstanceExtensions(count);
}
}
}
#endregion
@@ -0,0 +1,20 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit");
table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate");
table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint");
table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString");
table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError");
table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors");
table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor");
table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos");
table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow");
table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow");
table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose");
table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose");
table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents");
table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers");
table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress");
}
@@ -0,0 +1,158 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunctionTable
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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, 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]<int, 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]<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 delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>, delegate* unmanaged<Cdecl]<IntPtr,
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void>, delegate* unmanaged<Cdecl]<IntPtr,
double, double, void>> glfwSetScrollCallback;
int, byte**, void>> glfwSetDropCallback;
}
}
@@ -0,0 +1,120 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit");
table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate");
table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint");
table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString");
table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError");
table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors");
table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor");
table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos");
table->glfwGetMonitorWorkarea = (void (*)(GLFWmonitor*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetMonitorWorkarea");
table->glfwGetMonitorPhysicalSize = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPhysicalSize");
table->glfwGetMonitorContentScale = (void (*)(GLFWmonitor*, float*, float*))glfwGetProcAddress("glfwGetMonitorContentScale");
table->glfwGetMonitorName = (const char* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorName");
table->glfwSetMonitorUserPointer = (void (*)(GLFWmonitor*, void*))glfwGetProcAddress("glfwSetMonitorUserPointer");
table->glfwGetMonitorUserPointer = (void* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorUserPointer");
table->glfwSetMonitorCallback = (GLFWmonitorfun (*)(GLFWmonitorfun))glfwGetProcAddress("glfwSetMonitorCallback");
table->glfwGetVideoModes = (const GLFWvidmode* (*)(GLFWmonitor*, int*))glfwGetProcAddress("glfwGetVideoModes");
table->glfwGetVideoMode = (const GLFWvidmode* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetVideoMode");
table->glfwSetGamma = (void (*)(GLFWmonitor*, float))glfwGetProcAddress("glfwSetGamma");
table->glfwGetGammaRamp = (const GLFWgammaramp* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetGammaRamp");
table->glfwSetGammaRamp = (void (*)(GLFWmonitor*, const GLFWgammaramp*))glfwGetProcAddress("glfwSetGammaRamp");
table->glfwDefaultWindowHints = (void (*)(void))glfwGetProcAddress("glfwDefaultWindowHints");
table->glfwWindowHint = (void (*)(int, int))glfwGetProcAddress("glfwWindowHint");
table->glfwWindowHintString = (void (*)(int, const char*))glfwGetProcAddress("glfwWindowHintString");
table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow");
table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow");
table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose");
table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose");
table->glfwSetWindowTitle = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetWindowTitle");
table->glfwSetWindowIcon = (void (*)(GLFWwindow*, int, const GLFWimage*))glfwGetProcAddress("glfwSetWindowIcon");
table->glfwGetWindowPos = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowPos");
table->glfwSetWindowPos = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowPos");
table->glfwGetWindowSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowSize");
table->glfwSetWindowSizeLimits = (void (*)(GLFWwindow*, int, int, int, int))glfwGetProcAddress("glfwSetWindowSizeLimits");
table->glfwSetWindowAspectRatio = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAspectRatio");
table->glfwSetWindowSize = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowSize");
table->glfwGetFramebufferSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetFramebufferSize");
table->glfwGetWindowFrameSize = (void (*)(GLFWwindow*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetWindowFrameSize");
table->glfwGetWindowContentScale = (void (*)(GLFWwindow*, float*, float*))glfwGetProcAddress("glfwGetWindowContentScale");
table->glfwGetWindowOpacity = (float (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowOpacity");
table->glfwSetWindowOpacity = (void (*)(GLFWwindow*, float))glfwGetProcAddress("glfwSetWindowOpacity");
table->glfwIconifyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwIconifyWindow");
table->glfwRestoreWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRestoreWindow");
table->glfwMaximizeWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMaximizeWindow");
table->glfwShowWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwShowWindow");
table->glfwHideWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwHideWindow");
table->glfwFocusWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwFocusWindow");
table->glfwRequestWindowAttention = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRequestWindowAttention");
table->glfwGetWindowMonitor = (GLFWmonitor* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowMonitor");
table->glfwSetWindowMonitor = (void (*)(GLFWwindow*, GLFWmonitor*, int, int, int, int, int))glfwGetProcAddress("glfwSetWindowMonitor");
table->glfwGetWindowAttrib = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetWindowAttrib");
table->glfwSetWindowAttrib = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAttrib");
table->glfwSetWindowUserPointer = (void (*)(GLFWwindow*, void*))glfwGetProcAddress("glfwSetWindowUserPointer");
table->glfwGetWindowUserPointer = (void* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowUserPointer");
table->glfwSetWindowPosCallback = (GLFWwindowposfun (*)(GLFWwindow*, GLFWwindowposfun))glfwGetProcAddress("glfwSetWindowPosCallback");
table->glfwSetWindowSizeCallback = (GLFWwindowsizefun (*)(GLFWwindow*, GLFWwindowsizefun))glfwGetProcAddress("glfwSetWindowSizeCallback");
table->glfwSetWindowCloseCallback = (GLFWwindowclosefun (*)(GLFWwindow*, GLFWwindowclosefun))glfwGetProcAddress("glfwSetWindowCloseCallback");
table->glfwSetWindowRefreshCallback = (GLFWwindowrefreshfun (*)(GLFWwindow*, GLFWwindowrefreshfun))glfwGetProcAddress("glfwSetWindowRefreshCallback");
table->glfwSetWindowFocusCallback = (GLFWwindowfocusfun (*)(GLFWwindow*, GLFWwindowfocusfun))glfwGetProcAddress("glfwSetWindowFocusCallback");
table->glfwSetWindowIconifyCallback = (GLFWwindowiconifyfun (*)(GLFWwindow*, GLFWwindowiconifyfun))glfwGetProcAddress("glfwSetWindowIconifyCallback");
table->glfwSetWindowMaximizeCallback = (GLFWwindowmaximizefun (*)(GLFWwindow*, GLFWwindowmaximizefun))glfwGetProcAddress("glfwSetWindowMaximizeCallback");
table->glfwSetFramebufferSizeCallback = (GLFWframebuffersizefun (*)(GLFWwindow*, GLFWframebuffersizefun))glfwGetProcAddress("glfwSetFramebufferSizeCallback");
table->glfwSetWindowContentScaleCallback = (GLFWwindowcontentscalefun (*)(GLFWwindow*, GLFWwindowcontentscalefun))glfwGetProcAddress("glfwSetWindowContentScaleCallback");
table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents");
table->glfwWaitEvents = (void (*)(void))glfwGetProcAddress("glfwWaitEvents");
table->glfwWaitEventsTimeout = (void (*)(double))glfwGetProcAddress("glfwWaitEventsTimeout");
table->glfwPostEmptyEvent = (void (*)(void))glfwGetProcAddress("glfwPostEmptyEvent");
table->glfwGetInputMode = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetInputMode");
table->glfwSetInputMode = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetInputMode");
table->glfwRawMouseMotionSupported = (int (*)(void))glfwGetProcAddress("glfwRawMouseMotionSupported");
table->glfwGetKeyName = (const char* (*)(int, int))glfwGetProcAddress("glfwGetKeyName");
table->glfwGetKeyScancode = (int (*)(int))glfwGetProcAddress("glfwGetKeyScancode");
table->glfwGetKey = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetKey");
table->glfwGetMouseButton = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetMouseButton");
table->glfwGetCursorPos = (void (*)(GLFWwindow*, double*, double*))glfwGetProcAddress("glfwGetCursorPos");
table->glfwSetCursorPos = (void (*)(GLFWwindow*, double, double))glfwGetProcAddress("glfwSetCursorPos");
table->glfwCreateCursor = (GLFWcursor* (*)(const GLFWimage*, int, int))glfwGetProcAddress("glfwCreateCursor");
table->glfwCreateStandardCursor = (GLFWcursor* (*)(int))glfwGetProcAddress("glfwCreateStandardCursor");
table->glfwDestroyCursor = (void (*)(GLFWcursor*))glfwGetProcAddress("glfwDestroyCursor");
table->glfwSetCursor = (void (*)(GLFWwindow*, GLFWcursor*))glfwGetProcAddress("glfwSetCursor");
table->glfwSetKeyCallback = (GLFWkeyfun (*)(GLFWwindow*, GLFWkeyfun))glfwGetProcAddress("glfwSetKeyCallback");
table->glfwSetCharCallback = (GLFWcharfun (*)(GLFWwindow*, GLFWcharfun))glfwGetProcAddress("glfwSetCharCallback");
table->glfwSetCharModsCallback = (GLFWcharmodsfun (*)(GLFWwindow*, GLFWcharmodsfun))glfwGetProcAddress("glfwSetCharModsCallback");
table->glfwSetMouseButtonCallback = (GLFWmousebuttonfun (*)(GLFWwindow*, GLFWmousebuttonfun))glfwGetProcAddress("glfwSetMouseButtonCallback");
table->glfwSetCursorPosCallback = (GLFWcursorposfun (*)(GLFWwindow*, GLFWcursorposfun))glfwGetProcAddress("glfwSetCursorPosCallback");
table->glfwSetCursorEnterCallback = (GLFWcursorenterfun (*)(GLFWwindow*, GLFWcursorenterfun))glfwGetProcAddress("glfwSetCursorEnterCallback");
table->glfwSetScrollCallback = (GLFWscrollfun (*)(GLFWwindow*, GLFWscrollfun))glfwGetProcAddress("glfwSetScrollCallback");
table->glfwSetDropCallback = (GLFWdropfun (*)(GLFWwindow*, GLFWdropfun))glfwGetProcAddress("glfwSetDropCallback");
table->glfwJoystickPresent = (int (*)(int))glfwGetProcAddress("glfwJoystickPresent");
table->glfwGetJoystickAxes = (const float* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickAxes");
table->glfwGetJoystickButtons = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickButtons");
table->glfwGetJoystickHats = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickHats");
table->glfwGetJoystickName = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickName");
table->glfwGetJoystickGUID = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickGUID");
table->glfwSetJoystickUserPointer = (void (*)(int, void*))glfwGetProcAddress("glfwSetJoystickUserPointer");
table->glfwGetJoystickUserPointer = (void* (*)(int))glfwGetProcAddress("glfwGetJoystickUserPointer");
table->glfwJoystickIsGamepad = (int (*)(int))glfwGetProcAddress("glfwJoystickIsGamepad");
table->glfwSetJoystickCallback = (GLFWjoystickfun (*)(GLFWjoystickfun))glfwGetProcAddress("glfwSetJoystickCallback");
table->glfwUpdateGamepadMappings = (int (*)(const char*))glfwGetProcAddress("glfwUpdateGamepadMappings");
table->glfwGetGamepadName = (const char* (*)(int))glfwGetProcAddress("glfwGetGamepadName");
table->glfwGetGamepadState = (int (*)(int, GLFWgamepadstate*))glfwGetProcAddress("glfwGetGamepadState");
table->glfwSetClipboardString = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetClipboardString");
table->glfwGetClipboardString = (const char* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetClipboardString");
table->glfwGetTime = (double (*)(void))glfwGetProcAddress("glfwGetTime");
table->glfwSetTime = (void (*)(double))glfwGetProcAddress("glfwSetTime");
table->glfwGetTimerValue = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerValue");
table->glfwGetTimerFrequency = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerFrequency");
table->glfwMakeContextCurrent = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMakeContextCurrent");
table->glfwGetCurrentContext = (GLFWwindow* (*)(void))glfwGetProcAddress("glfwGetCurrentContext");
table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers");
table->glfwSwapInterval = (void (*)(int))glfwGetProcAddress("glfwSwapInterval");
table->glfwExtensionSupported = (int (*)(const char*))glfwGetProcAddress("glfwExtensionSupported");
table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress");
table->glfwVulkanSupported = (int (*)(void))glfwGetProcAddress("glfwVulkanSupported");
table->glfwGetRequiredInstanceExtensions = (const char** (*)(uint32_t*))glfwGetProcAddress("glfwGetRequiredInstanceExtensions");
}
@@ -0,0 +1,133 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "glfw3_no_comments.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
int (*glfwInit)(void);
void (*glfwTerminate)(void);
void (*glfwInitHint)(int hint, int value);
const char* (*glfwGetVersionString)(void);
int (*glfwGetError)(const char** description);
GLFWmonitor** (*glfwGetMonitors)(int* count);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void (*glfwDefaultWindowHints)(void);
void (*glfwWindowHint)(int hint, int value);
void (*glfwWindowHintString)(int hint, const char* value);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDestroyWindow)(GLFWwindow* window);
int (*glfwWindowShouldClose)(GLFWwindow* window);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
void (*glfwIconifyWindow)(GLFWwindow* window);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwShowWindow)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwPollEvents)(void);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
void (*glfwPostEmptyEvent)(void);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value);
int (*glfwRawMouseMotionSupported)(void);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
int (*glfwGetKey)(GLFWwindow* window, int key);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
int (*glfwJoystickPresent)(int jid);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
const char* (*glfwGetJoystickGUID)(int jid);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwJoystickIsGamepad)(int jid);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
int (*glfwUpdateGamepadMappings)(const char* string);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
double (*glfwGetTime)(void);
void (*glfwSetTime)(double time);
uint64_t (*glfwGetTimerValue)(void);
uint64_t (*glfwGetTimerFrequency)(void);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
int (*glfwExtensionSupported)(const char* extension);
GLFWglproc (*glfwGetProcAddress)(const char* procname);
int (*glfwVulkanSupported)(void);
const char** (*glfwGetRequiredInstanceExtensions)(uint32_t* count);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,57 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunctionTable
{
public delegate* unmanaged[Cdecl]<int, int, byte*, IntPtr, IntPtr, IntPtr> glfwCreateWindow;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwDestroyWindow;
public delegate* unmanaged[Cdecl]<byte**, int> glfwGetError;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetMonitorPos;
public delegate* unmanaged[Cdecl]<int*, IntPtr*> glfwGetMonitors;
public delegate* unmanaged[Cdecl]<IntPtr> glfwGetPrimaryMonitor;
public delegate* unmanaged[Cdecl]<byte*, IntPtr> glfwGetProcAddress;
public delegate* unmanaged[Cdecl]<byte*> glfwGetVersionString;
public delegate* unmanaged[Cdecl]<int> glfwInit;
public delegate* unmanaged[Cdecl]<int, int, void> glfwInitHint;
public delegate* unmanaged[Cdecl]<void> glfwPollEvents;
public delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowShouldClose;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwSwapBuffers;
public delegate* unmanaged[Cdecl]<void> glfwTerminate;
public delegate* unmanaged[Cdecl]<IntPtr, int> glfwWindowShouldClose;
}
}
@@ -0,0 +1,3 @@
#include "StgSharpNative.h"
#include "glfw_function_table.h"
#include <string.h>
@@ -0,0 +1,57 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunctionTable
{
public delegate* unmanaged[Cdecl]<int, int, byte*, IntPtr, IntPtr, IntPtr> glfwCreateWindow;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwDestroyWindow;
public delegate* unmanaged[Cdecl]<byte**, int> glfwGetError;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetMonitorPos;
public delegate* unmanaged[Cdecl]<int*, IntPtr*> glfwGetMonitors;
public delegate* unmanaged[Cdecl]<IntPtr> glfwGetPrimaryMonitor;
public delegate* unmanaged[Cdecl]<byte*, IntPtr> glfwGetProcAddress;
public delegate* unmanaged[Cdecl]<byte*> glfwGetVersionString;
public delegate* unmanaged[Cdecl]<int> glfwInit;
public delegate* unmanaged[Cdecl]<int, int, void> glfwInitHint;
public delegate* unmanaged[Cdecl]<void> glfwPollEvents;
public delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowShouldClose;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwSwapBuffers;
public delegate* unmanaged[Cdecl]<void> glfwTerminate;
public delegate* unmanaged[Cdecl]<IntPtr, int> glfwWindowShouldClose;
}
}
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,20 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit");
table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate");
table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint");
table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString");
table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError");
table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors");
table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor");
table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos");
table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow");
table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow");
table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose");
table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose");
table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents");
table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers");
table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress");
}
@@ -0,0 +1,486 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
[LibraryImport(NativeLibName, EntryPoint = "glfwInit")]
internal static unsafe partial int glfwInit();
[LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")]
internal static unsafe partial void glfwTerminate();
[LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")]
internal static unsafe partial void glfwInitHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")]
internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")]
internal static unsafe partial byte* glfwGetVersionString();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetError")]
internal static unsafe partial int glfwGetError(byte** description);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")]
internal static unsafe partial delegate*<int,byte*,void> glfwSetErrorCallback(
delegate*<int,byte*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")]
internal static unsafe partial IntPtr* glfwGetMonitors(int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")]
internal static unsafe partial IntPtr glfwGetPrimaryMonitor();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")]
internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")]
internal static unsafe partial void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")]
internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")]
internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")]
internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")]
internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")]
internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetMonitorCallback(
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")]
internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")]
internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")]
internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")]
internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")]
internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp);
[LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")]
internal static unsafe partial void glfwDefaultWindowHints();
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")]
internal static unsafe partial void glfwWindowHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")]
internal static unsafe partial void glfwWindowHintString(int hint, byte* value);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")]
internal static unsafe partial IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")]
internal static unsafe partial void glfwDestroyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")]
internal static unsafe partial int glfwWindowShouldClose(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")]
internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")]
internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")]
internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")]
internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")]
internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")]
internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")]
internal static unsafe partial void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")]
internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")]
internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")]
internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")]
internal static unsafe partial void glfwGetWindowFrameSize(
IntPtr window,
int* left,
int* top,
int* right,
int* bottom);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")]
internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")]
internal static unsafe partial float glfwGetWindowOpacity(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")]
internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity);
[LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")]
internal static unsafe partial void glfwIconifyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")]
internal static unsafe partial void glfwRestoreWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")]
internal static unsafe partial void glfwMaximizeWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")]
internal static unsafe partial void glfwShowWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")]
internal static unsafe partial void glfwHideWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")]
internal static unsafe partial void glfwFocusWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")]
internal static unsafe partial void glfwRequestWindowAttention(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")]
internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")]
internal static unsafe partial void glfwSetWindowMonitor(
IntPtr window,
IntPtr monitor,
int xpos,
int ypos,
int width,
int height,
int refreshRate);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")]
internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")]
internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")]
internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")]
internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")]
internal static unsafe partial delegate*<glfwWindow*,void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")]
internal static unsafe partial delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")]
internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")]
internal static unsafe partial delegate*<glfwWindow*, float,float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float,float> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")]
internal static unsafe partial void glfwPollEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")]
internal static unsafe partial void glfwWaitEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")]
internal static unsafe partial void glfwWaitEventsTimeout(double timeout);
[LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")]
internal static unsafe partial void glfwPostEmptyEvent();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")]
internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")]
internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")]
internal static unsafe partial int glfwRawMouseMotionSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")]
internal static unsafe partial byte* glfwGetKeyName(int key, int scancode);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")]
internal static unsafe partial int glfwGetKeyScancode(int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")]
internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")]
internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")]
internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")]
internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")]
internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")]
internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")]
internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")]
internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,int,void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")]
internal static unsafe partial delegate*<glfwWindow*,uint,void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*,uint,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,byte**,void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*,int,byte**,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")]
internal static unsafe partial int glfwJoystickPresent(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")]
internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")]
internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")]
internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")]
internal static unsafe partial byte* glfwGetJoystickName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")]
internal static unsafe partial byte* glfwGetJoystickGUID(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")]
internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")]
internal static unsafe partial void* glfwGetJoystickUserPointer(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")]
internal static unsafe partial int glfwJoystickIsGamepad(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")]
internal static unsafe partial delegate*<int,int,void> glfwSetJoystickCallback(delegate*<int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")]
internal static unsafe partial int glfwUpdateGamepadMappings(byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")]
internal static unsafe partial byte* glfwGetGamepadName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")]
internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")]
internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")]
internal static unsafe partial byte* glfwGetClipboardString(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")]
internal static unsafe partial double glfwGetTime();
[LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")]
internal static unsafe partial void glfwSetTime(double time);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")]
internal static unsafe partial ulong* glfwGetTimerValue();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")]
internal static unsafe partial ulong* glfwGetTimerFrequency();
[LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")]
internal static unsafe partial void glfwMakeContextCurrent(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")]
internal static unsafe partial IntPtr glfwGetCurrentContext();
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")]
internal static unsafe partial void glfwSwapBuffers(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")]
internal static unsafe partial void glfwSwapInterval(int interval);
[LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")]
internal static unsafe partial int glfwExtensionSupported(byte* extension);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)]
internal static unsafe partial IntPtr glfwGetProcAddress(string procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")]
internal static unsafe partial int glfwVulkanSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")]
internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,156 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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]<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]<int, 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;
}
}
@@ -0,0 +1,156 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunctionTable
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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, 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]<int, 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]<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, 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, 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 delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>, delegate* unmanaged<Cdecl]<IntPtr,
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>, delegate* unmanaged<Cdecl]<IntPtr,
int, int, void>> glfwSetWindowPosCallback;
int, int, void>> glfwSetWindowSizeCallback;
}
}
@@ -0,0 +1,120 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "glfw3_no_comments.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
void (*glfwDefaultWindowHints)(void);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwDestroyWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
int (*glfwGetError)(const char** description);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwGetKey)(GLFWwindow* window, int key);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
GLFWmonitor** (*glfwGetMonitors)(int* count);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
double (*glfwGetTime)(void);
uint64_t (*glfwGetTimerFrequency)(void);
uint64_t (*glfwGetTimerValue)(void);
const char* (*glfwGetVersionString)(void);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwIconifyWindow)(GLFWwindow* window);
int (*glfwInit)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwPollEvents)(void);
void (*glfwPostEmptyEvent)(void);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
int (*glfwRawMouseMotionSupported)(void);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
void (*glfwSetTime)(double time);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
void (*glfwTerminate)(void);
int (*glfwUpdateGamepadMappings)(const char* string);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
int (*glfwVulkanSupported)(void);
int (*glfwWindowShouldClose)(GLFWwindow* window);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,123 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "glfw3_no_comments.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
void (*glfwCreateCursor)(GLFWimage* image, int xhot, int yhot);
GLFWcursor* (*glfwCreateStandardCursor)(int shape);
GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void (*glfwDefaultWindowHints)(void);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwDestroyWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
int (*glfwGetError)(const char** description);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwGetKey)(GLFWwindow* window, int key);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
GLFWmonitor** (*glfwGetMonitors)(int* count);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
double (*glfwGetTime)(void);
uint64_t (*glfwGetTimerFrequency)(void);
uint64_t (*glfwGetTimerValue)(void);
const char* (*glfwGetVersionString)(void);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwIconifyWindow)(GLFWwindow* window);
int (*glfwInit)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwPollEvents)(void);
void (*glfwPostEmptyEvent)(void);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
int (*glfwRawMouseMotionSupported)(void);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
void (*glfwSetTime)(double time);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
void (*glfwTerminate)(void);
int (*glfwUpdateGamepadMappings)(const char* string);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
int (*glfwVulkanSupported)(void);
int (*glfwWindowShouldClose)(GLFWwindow* window);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,158 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunctionTable
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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, 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]<int, 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]<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 delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>, delegate* unmanaged<Cdecl]<IntPtr,
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void>, delegate* unmanaged<Cdecl]<IntPtr,
double, double, void>> glfwSetScrollCallback;
int, byte**, void>> glfwSetDropCallback;
}
}
@@ -0,0 +1,107 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwDefaultWindowHints = glfwDefaultWindowHints;
table->glfwDestroyCursor = glfwDestroyCursor;
table->glfwDestroyWindow = glfwDestroyWindow;
table->glfwFocusWindow = glfwFocusWindow;
table->glfwGetClipboardString = glfwGetClipboardString;
table->glfwGetCurrentContext = glfwGetCurrentContext;
table->glfwGetCursorPos = glfwGetCursorPos;
table->glfwGetError = glfwGetError;
table->glfwGetFramebufferSize = glfwGetFramebufferSize;
table->glfwGetGamepadName = glfwGetGamepadName;
table->glfwGetGamepadState = glfwGetGamepadState;
table->glfwGetGammaRamp = glfwGetGammaRamp;
table->glfwGetInputMode = glfwGetInputMode;
table->glfwGetJoystickAxes = glfwGetJoystickAxes;
table->glfwGetJoystickButtons = glfwGetJoystickButtons;
table->glfwGetJoystickGUID = glfwGetJoystickGUID;
table->glfwGetJoystickHats = glfwGetJoystickHats;
table->glfwGetJoystickName = glfwGetJoystickName;
table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer;
table->glfwGetKey = glfwGetKey;
table->glfwGetKeyName = glfwGetKeyName;
table->glfwGetKeyScancode = glfwGetKeyScancode;
table->glfwGetMonitorContentScale = glfwGetMonitorContentScale;
table->glfwGetMonitorName = glfwGetMonitorName;
table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize;
table->glfwGetMonitorPos = glfwGetMonitorPos;
table->glfwGetMonitors = glfwGetMonitors;
table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer;
table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea;
table->glfwGetMouseButton = glfwGetMouseButton;
table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor;
table->glfwGetTime = glfwGetTime;
table->glfwGetTimerFrequency = glfwGetTimerFrequency;
table->glfwGetTimerValue = glfwGetTimerValue;
table->glfwGetVersionString = glfwGetVersionString;
table->glfwGetVideoMode = glfwGetVideoMode;
table->glfwGetVideoModes = glfwGetVideoModes;
table->glfwGetWindowAttrib = glfwGetWindowAttrib;
table->glfwGetWindowContentScale = glfwGetWindowContentScale;
table->glfwGetWindowFrameSize = glfwGetWindowFrameSize;
table->glfwGetWindowMonitor = glfwGetWindowMonitor;
table->glfwGetWindowOpacity = glfwGetWindowOpacity;
table->glfwGetWindowPos = glfwGetWindowPos;
table->glfwGetWindowSize = glfwGetWindowSize;
table->glfwGetWindowUserPointer = glfwGetWindowUserPointer;
table->glfwHideWindow = glfwHideWindow;
table->glfwIconifyWindow = glfwIconifyWindow;
table->glfwInit = glfwInit;
table->glfwInitHint = glfwInitHint;
table->glfwMakeContextCurrent = glfwMakeContextCurrent;
table->glfwMaximizeWindow = glfwMaximizeWindow;
table->glfwPollEvents = glfwPollEvents;
table->glfwPostEmptyEvent = glfwPostEmptyEvent;
table->glfwRequestWindowAttention = glfwRequestWindowAttention;
table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported;
table->glfwRestoreWindow = glfwRestoreWindow;
table->glfwSetClipboardString = glfwSetClipboardString;
table->glfwSetCharCallback = glfwSetCharCallback;
table->glfwSetCharModsCallback = glfwSetCharModsCallback;
table->glfwSetCursor = glfwSetCursor;
table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback;
table->glfwSetCursorPos = glfwSetCursorPos;
table->glfwSetCursorPosCallback = glfwSetCursorPosCallback;
table->glfwSetDropCallback = glfwSetDropCallback;
table->glfwSetGammaRamp = glfwSetGammaRamp;
table->glfwSetJoystickCallback = glfwSetJoystickCallback;
table->glfwSetJoystickUserPointer = glfwSetJoystickUserPointer;
table->glfwSetKeyCallback = glfwSetKeyCallback;
table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer;
table->glfwSetMonitorCallback = glfwSetMonitorCallback;
table->glfwSetTime = glfwSetTime;
table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio;
table->glfwSetWindowAttrib = glfwSetWindowAttrib;
table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback;
table->glfwSetWindowIcon = glfwSetWindowIcon;
table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback;
table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback;
table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback;
table->glfwSetWindowMonitor = glfwSetWindowMonitor;
table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback;
table->glfwSetWindowOpacity = glfwSetWindowOpacity;
table->glfwSetWindowPosCallback = glfwSetWindowPosCallback;
table->glfwSetWindowPos = glfwSetWindowPos;
table->glfwSetScrollCallback = glfwSetScrollCallback;
table->glfwSetWindowShouldClose = glfwSetWindowShouldClose;
table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits;
table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback;
table->glfwSetWindowSize = glfwSetWindowSize;
table->glfwSetWindowTitle = glfwSetWindowTitle;
table->glfwSetWindowUserPointer = glfwSetWindowUserPointer;
table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback;
table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback;
table->glfwSwapBuffers = glfwSwapBuffers;
table->glfwSwapInterval = glfwSwapInterval;
table->glfwTerminate = glfwTerminate;
table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings;
table->glfwWaitEvents = glfwWaitEvents;
table->glfwWaitEventsTimeout = glfwWaitEventsTimeout;
table->glfwVulkanSupported = glfwVulkanSupported;
table->glfwWindowShouldClose = glfwWindowShouldClose;
}
@@ -0,0 +1,3 @@
#include "StgSharpNative.h"
#include "glfw_function_table.h"
#include <string.h>
@@ -0,0 +1,158 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunctionTable
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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, 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]<int, 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]<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 delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>, delegate* unmanaged<Cdecl]<IntPtr,
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void>, delegate* unmanaged<Cdecl]<IntPtr,
double, double, void>> glfwSetScrollCallback;
int, byte**, void>> glfwSetDropCallback;
}
}
@@ -0,0 +1,120 @@
#ifndef GLFW_FUNCTION_TABLE_H
#define GLFW_FUNCTION_TABLE_H
#include "glfw3_no_comments.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GLFWFunctionTable {
void (*glfwDefaultWindowHints)(void);
void (*glfwDestroyCursor)(GLFWcursor* cursor);
void (*glfwDestroyWindow)(GLFWwindow* window);
void (*glfwFocusWindow)(GLFWwindow* window);
const char* (*glfwGetClipboardString)(GLFWwindow* window);
GLFWwindow* (*glfwGetCurrentContext)(void);
void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos);
int (*glfwGetError)(const char** description);
void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height);
const char* (*glfwGetGamepadName)(int jid);
int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state);
const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor);
int (*glfwGetInputMode)(GLFWwindow* window, int mode);
const float* (*glfwGetJoystickAxes)(int jid, int* count);
const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count);
const char* (*glfwGetJoystickGUID)(int jid);
const unsigned char* (*glfwGetJoystickHats)(int jid, int* count);
const char* (*glfwGetJoystickName)(int jid);
void* (*glfwGetJoystickUserPointer)(int jid);
int (*glfwGetKey)(GLFWwindow* window, int key);
const char* (*glfwGetKeyName)(int key, int scancode);
int (*glfwGetKeyScancode)(int key);
void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale);
const char* (*glfwGetMonitorName)(GLFWmonitor* monitor);
void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM);
void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos);
GLFWmonitor** (*glfwGetMonitors)(int* count);
void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor);
void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
int (*glfwGetMouseButton)(GLFWwindow* window, int button);
GLFWmonitor* (*glfwGetPrimaryMonitor)(void);
double (*glfwGetTime)(void);
uint64_t (*glfwGetTimerFrequency)(void);
uint64_t (*glfwGetTimerValue)(void);
const char* (*glfwGetVersionString)(void);
const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor);
const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count);
int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib);
void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale);
void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window);
float (*glfwGetWindowOpacity)(GLFWwindow* window);
void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos);
void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height);
void* (*glfwGetWindowUserPointer)(GLFWwindow* window);
void (*glfwHideWindow)(GLFWwindow* window);
void (*glfwIconifyWindow)(GLFWwindow* window);
int (*glfwInit)(void);
void (*glfwInitHint)(int hint, int value);
void (*glfwMakeContextCurrent)(GLFWwindow* window);
void (*glfwMaximizeWindow)(GLFWwindow* window);
void (*glfwPollEvents)(void);
void (*glfwPostEmptyEvent)(void);
void (*glfwRequestWindowAttention)(GLFWwindow* window);
int (*glfwRawMouseMotionSupported)(void);
void (*glfwRestoreWindow)(GLFWwindow* window);
void (*glfwSetClipboardString)(GLFWwindow* window, const char* string);
GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback);
GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback);
void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor);
GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback);
void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos);
GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback);
GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback);
void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback);
void (*glfwSetJoystickUserPointer)(int jid, void* pointer);
GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback);
void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer);
GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback);
void (*glfwSetTime)(double time);
void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom);
void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value);
GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback);
void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images);
GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback);
GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback);
void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback);
void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity);
GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback);
void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos);
GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback);
void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value);
void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback);
void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height);
void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title);
void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer);
GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback);
void (*glfwSwapBuffers)(GLFWwindow* window);
void (*glfwSwapInterval)(int interval);
void (*glfwTerminate)(void);
int (*glfwUpdateGamepadMappings)(const char* string);
void (*glfwWaitEvents)(void);
void (*glfwWaitEventsTimeout)(double timeout);
int (*glfwVulkanSupported)(void);
int (*glfwWindowShouldClose)(GLFWwindow* window);
} GLFWFunctionTable;
void LoadGLFWFunctions(GLFWFunctionTable* table);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,123 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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
{
internal const string SS_errorLog =
"SS_errorlog.log";
internal const string NativeLibName =
"StgSharp.C";
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 SemaphoreSlim(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)
{
logSyncSemaphore.Wait();
if (!File.Exists(SS_errorLog))
{
FileStream stream = File.Create(SS_errorLog);
stream.Close();
}
using (StreamWriter logStream = File.AppendText(SS_errorLog))
{
logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = 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($"{logType}\t@\t{DateTime.Now.ToString("o")}");
logStream.WriteLine(logLine);
}
_ = logSyncSemaphore.Release(1);
}
}
}
@@ -0,0 +1,107 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwDefaultWindowHints = glfwDefaultWindowHints;
table->glfwDestroyCursor = glfwDestroyCursor;
table->glfwDestroyWindow = glfwDestroyWindow;
table->glfwFocusWindow = glfwFocusWindow;
table->glfwGetClipboardString = glfwGetClipboardString;
table->glfwGetCurrentContext = glfwGetCurrentContext;
table->glfwGetCursorPos = glfwGetCursorPos;
table->glfwGetError = glfwGetError;
table->glfwGetFramebufferSize = glfwGetFramebufferSize;
table->glfwGetGamepadName = glfwGetGamepadName;
table->glfwGetGamepadState = glfwGetGamepadState;
table->glfwGetGammaRamp = glfwGetGammaRamp;
table->glfwGetInputMode = glfwGetInputMode;
table->glfwGetJoystickAxes = glfwGetJoystickAxes;
table->glfwGetJoystickButtons = glfwGetJoystickButtons;
table->glfwGetJoystickGUID = glfwGetJoystickGUID;
table->glfwGetJoystickHats = glfwGetJoystickHats;
table->glfwGetJoystickName = glfwGetJoystickName;
table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer;
table->glfwGetKey = glfwGetKey;
table->glfwGetKeyName = glfwGetKeyName;
table->glfwGetKeyScancode = glfwGetKeyScancode;
table->glfwGetMonitorContentScale = glfwGetMonitorContentScale;
table->glfwGetMonitorName = glfwGetMonitorName;
table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize;
table->glfwGetMonitorPos = glfwGetMonitorPos;
table->glfwGetMonitors = glfwGetMonitors;
table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer;
table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea;
table->glfwGetMouseButton = glfwGetMouseButton;
table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor;
table->glfwGetTime = glfwGetTime;
table->glfwGetTimerFrequency = glfwGetTimerFrequency;
table->glfwGetTimerValue = glfwGetTimerValue;
table->glfwGetVersionString = glfwGetVersionString;
table->glfwGetVideoMode = glfwGetVideoMode;
table->glfwGetVideoModes = glfwGetVideoModes;
table->glfwGetWindowAttrib = glfwGetWindowAttrib;
table->glfwGetWindowContentScale = glfwGetWindowContentScale;
table->glfwGetWindowFrameSize = glfwGetWindowFrameSize;
table->glfwGetWindowMonitor = glfwGetWindowMonitor;
table->glfwGetWindowOpacity = glfwGetWindowOpacity;
table->glfwGetWindowPos = glfwGetWindowPos;
table->glfwGetWindowSize = glfwGetWindowSize;
table->glfwGetWindowUserPointer = glfwGetWindowUserPointer;
table->glfwHideWindow = glfwHideWindow;
table->glfwIconifyWindow = glfwIconifyWindow;
table->glfwInit = glfwInit;
table->glfwInitHint = glfwInitHint;
table->glfwMakeContextCurrent = glfwMakeContextCurrent;
table->glfwMaximizeWindow = glfwMaximizeWindow;
table->glfwPollEvents = glfwPollEvents;
table->glfwPostEmptyEvent = glfwPostEmptyEvent;
table->glfwRequestWindowAttention = glfwRequestWindowAttention;
table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported;
table->glfwRestoreWindow = glfwRestoreWindow;
table->glfwSetClipboardString = glfwSetClipboardString;
table->glfwSetCharCallback = glfwSetCharCallback;
table->glfwSetCharModsCallback = glfwSetCharModsCallback;
table->glfwSetCursor = glfwSetCursor;
table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback;
table->glfwSetCursorPos = glfwSetCursorPos;
table->glfwSetCursorPosCallback = glfwSetCursorPosCallback;
table->glfwSetDropCallback = glfwSetDropCallback;
table->glfwSetGammaRamp = glfwSetGammaRamp;
table->glfwSetJoystickCallback = glfwSetJoystickCallback;
table->glfwSetJoystickUserPointer = glfwSetJoystickUserPointer;
table->glfwSetKeyCallback = glfwSetKeyCallback;
table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer;
table->glfwSetMonitorCallback = glfwSetMonitorCallback;
table->glfwSetTime = glfwSetTime;
table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio;
table->glfwSetWindowAttrib = glfwSetWindowAttrib;
table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback;
table->glfwSetWindowIcon = glfwSetWindowIcon;
table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback;
table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback;
table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback;
table->glfwSetWindowMonitor = glfwSetWindowMonitor;
table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback;
table->glfwSetWindowOpacity = glfwSetWindowOpacity;
table->glfwSetWindowPosCallback = glfwSetWindowPosCallback;
table->glfwSetWindowPos = glfwSetWindowPos;
table->glfwSetScrollCallback = glfwSetScrollCallback;
table->glfwSetWindowShouldClose = glfwSetWindowShouldClose;
table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits;
table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback;
table->glfwSetWindowSize = glfwSetWindowSize;
table->glfwSetWindowTitle = glfwSetWindowTitle;
table->glfwSetWindowUserPointer = glfwSetWindowUserPointer;
table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback;
table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback;
table->glfwSwapBuffers = glfwSwapBuffers;
table->glfwSwapInterval = glfwSwapInterval;
table->glfwTerminate = glfwTerminate;
table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings;
table->glfwWaitEvents = glfwWaitEvents;
table->glfwWaitEventsTimeout = glfwWaitEventsTimeout;
table->glfwVulkanSupported = glfwVulkanSupported;
table->glfwWindowShouldClose = glfwWindowShouldClose;
}
@@ -0,0 +1,486 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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.InteropServices;
using System.Text;
namespace StgSharp.Internal
{
internal unsafe partial class InternalIO
{
private static GLFWFunction _glfw;
[LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")]
internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context);
internal static unsafe void LoadGlfw()
{
_glfw = new GLFWFunction();
fixed (GLFWFunction* func = &_glfw) { }
}
#region api call
[LibraryImport(NativeLibName, EntryPoint = "glfwInit")]
internal static unsafe partial int glfwInit();
[LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")]
internal static unsafe partial void glfwTerminate();
[LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")]
internal static unsafe partial void glfwInitHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")]
internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")]
internal static unsafe partial byte* glfwGetVersionString();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetError")]
internal static unsafe partial int glfwGetError(byte** description);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")]
internal static unsafe partial delegate*<int,byte*,void> glfwSetErrorCallback(
delegate*<int,byte*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")]
internal static unsafe partial IntPtr* glfwGetMonitors(int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")]
internal static unsafe partial IntPtr glfwGetPrimaryMonitor();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")]
internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")]
internal static unsafe partial void glfwGetMonitorWorkarea(
IntPtr monitor,
int* xpos,
int* ypos,
int* width,
int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")]
internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")]
internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")]
internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")]
internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")]
internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetMonitorCallback(
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")]
internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")]
internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")]
internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")]
internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")]
internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp);
[LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")]
internal static unsafe partial void glfwDefaultWindowHints();
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")]
internal static unsafe partial void glfwWindowHint(int hint, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")]
internal static unsafe partial void glfwWindowHintString(int hint, byte* value);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")]
internal static unsafe partial IntPtr glfwCreateWindow(
int width,
int height,
byte[] title,
IntPtr monitor,
IntPtr share);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")]
internal static unsafe partial void glfwDestroyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")]
internal static unsafe partial int glfwWindowShouldClose(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")]
internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")]
internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")]
internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")]
internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")]
internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")]
internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")]
internal static unsafe partial void glfwSetWindowSizeLimits(
IntPtr window,
int minwidth,
int minheight,
int maxwidth,
int maxheight);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")]
internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")]
internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")]
internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")]
internal static unsafe partial void glfwGetWindowFrameSize(
IntPtr window,
int* left,
int* top,
int* right,
int* bottom);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")]
internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")]
internal static unsafe partial float glfwGetWindowOpacity(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")]
internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity);
[LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")]
internal static unsafe partial void glfwIconifyWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")]
internal static unsafe partial void glfwRestoreWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")]
internal static unsafe partial void glfwMaximizeWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")]
internal static unsafe partial void glfwShowWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")]
internal static unsafe partial void glfwHideWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")]
internal static unsafe partial void glfwFocusWindow(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")]
internal static unsafe partial void glfwRequestWindowAttention(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")]
internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")]
internal static unsafe partial void glfwSetWindowMonitor(
IntPtr window,
IntPtr monitor,
int xpos,
int ypos,
int width,
int height,
int refreshRate);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")]
internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")]
internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")]
internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")]
internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowPosCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetWindowSizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")]
internal static unsafe partial delegate*<glfwWindow*,void> glfwSetWindowCloseCallback(
IntPtr window,
delegate*<glfwWindow*,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")]
internal static unsafe partial delegate*<glfwWindow*, void> glfwSetWindowRefreshCallback(
IntPtr window,
delegate*<glfwWindow*, void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowFocusCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowIconifyCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetWindowMaximizeCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")]
internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback(
IntPtr window,
IntPtr callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")]
internal static unsafe partial delegate*<glfwWindow*, float,float> glfwSetWindowContentScaleCallback(
IntPtr window,
delegate*<glfwWindow*, float,float> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")]
internal static unsafe partial void glfwPollEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")]
internal static unsafe partial void glfwWaitEvents();
[LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")]
internal static unsafe partial void glfwWaitEventsTimeout(double timeout);
[LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")]
internal static unsafe partial void glfwPostEmptyEvent();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")]
internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")]
internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value);
[LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")]
internal static unsafe partial int glfwRawMouseMotionSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")]
internal static unsafe partial byte* glfwGetKeyName(int key, int scancode);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")]
internal static unsafe partial int glfwGetKeyScancode(int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")]
internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")]
internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")]
internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")]
internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")]
internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")]
internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape);
[LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")]
internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")]
internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,int,void> glfwSetKeyCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")]
internal static unsafe partial delegate*<glfwWindow*,uint,void> glfwSetCharCallback(
IntPtr window,
delegate*<glfwWindow*,uint,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,void> glfwSetCharModsCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,int,int,void> glfwSetMouseButtonCallback(
IntPtr window,
delegate*<glfwWindow*,int,int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetCursorPosCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,void> glfwSetCursorEnterCallback(
IntPtr window,
delegate*<glfwWindow*,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")]
internal static unsafe partial delegate*<glfwWindow*,double,double,void> glfwSetScrollCallback(
IntPtr window,
delegate*<glfwWindow*,double,double,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")]
internal static unsafe partial delegate*<glfwWindow*,int,byte**,void> glfwSetDropCallback(
IntPtr window,
delegate*<glfwWindow*,int,byte**,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")]
internal static unsafe partial int glfwJoystickPresent(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")]
internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")]
internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")]
internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")]
internal static unsafe partial byte* glfwGetJoystickName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")]
internal static unsafe partial byte* glfwGetJoystickGUID(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")]
internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")]
internal static unsafe partial void* glfwGetJoystickUserPointer(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")]
internal static unsafe partial int glfwJoystickIsGamepad(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")]
internal static unsafe partial delegate*<int,int,void> glfwSetJoystickCallback(delegate*<int,int,void> callback);
[LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")]
internal static unsafe partial int glfwUpdateGamepadMappings(byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")]
internal static unsafe partial byte* glfwGetGamepadName(int jid);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")]
internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
[LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")]
internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")]
internal static unsafe partial byte* glfwGetClipboardString(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")]
internal static unsafe partial double glfwGetTime();
[LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")]
internal static unsafe partial void glfwSetTime(double time);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")]
internal static unsafe partial ulong* glfwGetTimerValue();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")]
internal static unsafe partial ulong* glfwGetTimerFrequency();
[LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")]
internal static unsafe partial void glfwMakeContextCurrent(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")]
internal static unsafe partial IntPtr glfwGetCurrentContext();
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")]
internal static unsafe partial void glfwSwapBuffers(IntPtr window);
[LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")]
internal static unsafe partial void glfwSwapInterval(int interval);
[LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")]
internal static unsafe partial int glfwExtensionSupported(byte* extension);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)]
internal static unsafe partial IntPtr glfwGetProcAddress(string procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")]
internal static unsafe partial int glfwVulkanSupported();
[LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")]
internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count);
/*
[LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate*<void> glfwGetInstanceProcAddress(
VkInstance instance,
byte* procname);
[LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport(
VkInstance instance,
VkPhysicalDevice device,
uint* queuefamily);
[LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface(
VkInstance instance,
glfwWindow* window,
VkAllocationCallbacks* _allocator,
VkSurfaceKHR* surface);
/**/
#endregion api call
}
}
@@ -0,0 +1,110 @@
#include "glfw_function_table.h"
#include <string.h>
void LoadGLFWFunctions(GLFWFunctionTable* table) {
memset(table, 0, sizeof(GLFWFunctionTable));
table->glfwCreateCursor = glfwCreateCursor;
table->glfwCreateStandardCursor = glfwCreateStandardCursor;
table->glfwCreateWindow = glfwCreateWindow;
table->glfwDefaultWindowHints = glfwDefaultWindowHints;
table->glfwDestroyCursor = glfwDestroyCursor;
table->glfwDestroyWindow = glfwDestroyWindow;
table->glfwFocusWindow = glfwFocusWindow;
table->glfwGetClipboardString = glfwGetClipboardString;
table->glfwGetCurrentContext = glfwGetCurrentContext;
table->glfwGetCursorPos = glfwGetCursorPos;
table->glfwGetError = glfwGetError;
table->glfwGetFramebufferSize = glfwGetFramebufferSize;
table->glfwGetGamepadName = glfwGetGamepadName;
table->glfwGetGamepadState = glfwGetGamepadState;
table->glfwGetGammaRamp = glfwGetGammaRamp;
table->glfwGetInputMode = glfwGetInputMode;
table->glfwGetJoystickAxes = glfwGetJoystickAxes;
table->glfwGetJoystickButtons = glfwGetJoystickButtons;
table->glfwGetJoystickGUID = glfwGetJoystickGUID;
table->glfwGetJoystickHats = glfwGetJoystickHats;
table->glfwGetJoystickName = glfwGetJoystickName;
table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer;
table->glfwGetKey = glfwGetKey;
table->glfwGetKeyName = glfwGetKeyName;
table->glfwGetKeyScancode = glfwGetKeyScancode;
table->glfwGetMonitorContentScale = glfwGetMonitorContentScale;
table->glfwGetMonitorName = glfwGetMonitorName;
table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize;
table->glfwGetMonitorPos = glfwGetMonitorPos;
table->glfwGetMonitors = glfwGetMonitors;
table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer;
table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea;
table->glfwGetMouseButton = glfwGetMouseButton;
table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor;
table->glfwGetTime = glfwGetTime;
table->glfwGetTimerFrequency = glfwGetTimerFrequency;
table->glfwGetTimerValue = glfwGetTimerValue;
table->glfwGetVersionString = glfwGetVersionString;
table->glfwGetVideoMode = glfwGetVideoMode;
table->glfwGetVideoModes = glfwGetVideoModes;
table->glfwGetWindowAttrib = glfwGetWindowAttrib;
table->glfwGetWindowContentScale = glfwGetWindowContentScale;
table->glfwGetWindowFrameSize = glfwGetWindowFrameSize;
table->glfwGetWindowMonitor = glfwGetWindowMonitor;
table->glfwGetWindowOpacity = glfwGetWindowOpacity;
table->glfwGetWindowPos = glfwGetWindowPos;
table->glfwGetWindowSize = glfwGetWindowSize;
table->glfwGetWindowUserPointer = glfwGetWindowUserPointer;
table->glfwHideWindow = glfwHideWindow;
table->glfwIconifyWindow = glfwIconifyWindow;
table->glfwInit = glfwInit;
table->glfwInitHint = glfwInitHint;
table->glfwMakeContextCurrent = glfwMakeContextCurrent;
table->glfwMaximizeWindow = glfwMaximizeWindow;
table->glfwPollEvents = glfwPollEvents;
table->glfwPostEmptyEvent = glfwPostEmptyEvent;
table->glfwRequestWindowAttention = glfwRequestWindowAttention;
table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported;
table->glfwRestoreWindow = glfwRestoreWindow;
table->glfwSetClipboardString = glfwSetClipboardString;
table->glfwSetCharCallback = glfwSetCharCallback;
table->glfwSetCharModsCallback = glfwSetCharModsCallback;
table->glfwSetCursor = glfwSetCursor;
table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback;
table->glfwSetCursorPos = glfwSetCursorPos;
table->glfwSetCursorPosCallback = glfwSetCursorPosCallback;
table->glfwSetDropCallback = glfwSetDropCallback;
table->glfwSetGammaRamp = glfwSetGammaRamp;
table->glfwSetJoystickCallback = glfwSetJoystickCallback;
table->glfwSetJoystickUserPointer = glfwSetJoystickUserPointer;
table->glfwSetKeyCallback = glfwSetKeyCallback;
table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer;
table->glfwSetMonitorCallback = glfwSetMonitorCallback;
table->glfwSetTime = glfwSetTime;
table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio;
table->glfwSetWindowAttrib = glfwSetWindowAttrib;
table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback;
table->glfwSetWindowIcon = glfwSetWindowIcon;
table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback;
table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback;
table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback;
table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback;
table->glfwSetWindowMonitor = glfwSetWindowMonitor;
table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback;
table->glfwSetWindowOpacity = glfwSetWindowOpacity;
table->glfwSetWindowPosCallback = glfwSetWindowPosCallback;
table->glfwSetWindowPos = glfwSetWindowPos;
table->glfwSetScrollCallback = glfwSetScrollCallback;
table->glfwSetWindowShouldClose = glfwSetWindowShouldClose;
table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits;
table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback;
table->glfwSetWindowSize = glfwSetWindowSize;
table->glfwSetWindowTitle = glfwSetWindowTitle;
table->glfwSetWindowUserPointer = glfwSetWindowUserPointer;
table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback;
table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback;
table->glfwSwapBuffers = glfwSwapBuffers;
table->glfwSwapInterval = glfwSwapInterval;
table->glfwTerminate = glfwTerminate;
table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings;
table->glfwWaitEvents = glfwWaitEvents;
table->glfwWaitEventsTimeout = glfwWaitEventsTimeout;
table->glfwVulkanSupported = glfwVulkanSupported;
table->glfwWindowShouldClose = glfwWindowShouldClose;
}
@@ -0,0 +1,156 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw_function_table.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.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, 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, int> 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]<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]<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]<int, 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;
}
}
@@ -0,0 +1,202 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// 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 Microsoft.Extensions.Logging;
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.C";
internal const string SS_errorLog =
"SS_errorlog.log";
private static ILogger? _logger;
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 SemaphoreSlim(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);
}
/// <summary>
/// Sets an external logger for logging purposes.
/// </summary>
/// <param name="logger">
/// The logger to use.
/// </param>
public static void SetLogger(ILogger logger)
{
_logger = logger;
}
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);
}
/// <summary>
/// Logs a message using the external logger if available, otherwise falls back to the
/// internal logging system.
/// </summary>
/// <param name="logLine">
/// The log message.
/// </param>
/// <param name="logType">
/// The type of the log.
/// </param>
internal static void Log(string logLine, LogType logType)
{
if (_logger != null)
{
switch (logType)
{
case LogType.Error:
_logger.LogError(logLine);
break;
case LogType.Warning:
_logger.LogWarning(logLine);
break;
case LogType.Info:
_logger.LogInformation(logLine);
break;
default:
_logger.LogDebug(logLine);
break;
}
} else
{
InternalWriteLog(logLine, logType);
}
}
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,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.C";
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 SemaphoreSlim(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,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.C";
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 SemaphoreSlim(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,143 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="HLSFAllocator.Alloc.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.Threading;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle;
namespace StgSharp.HighPerformance.Memory
{
public unsafe partial class HybridLayerSegregatedFitAllocator
{
private BufferExpansionLock _spareLock = new();
public hlsfHandle Alloc(uint size)
{
ArgumentOutOfRangeException.ThrowIfGreaterThan<nuint>(size, (nuint)levelSize[^1] * 2);
int level = GetLevelFromSize(size);
int segmentIndex = DetermineSegmentIndex(size, level);
int i = level, s = segmentIndex;
if (TryPopLevel(i, s, out Entry* handle))
{
handle->State = EntryState.Allocated;
return new hlsfHandle(handle, size);
}
fallback:
i = level;
s = segmentIndex;
while (!TryPopLevel(i, s, out handle))
{
if (++s >= 3)
{
s = 0;
i++;
}
if (i >= levelSize.Length)
{
if (TryAllocateNew16MBBlock(out handle))
{
break;
}
Thread.Sleep(0);
goto fallback;
}
}
if (handle != null)
{
SliceMemory(handle, (segmentIndex + 1) * levelSize[level]);
handle->State = EntryState.Allocated;
}
return new hlsfHandle(handle, size);
}
private void SliceMemory(Entry* e, int offset) { }
/// <summary>
/// Try to allocate a new 16MB block when all buckets are empty
/// </summary>
/// <param name="handle">
/// Output handle to the allocated Entry
/// </param>
/// <returns>
/// True if allocation succeeded
/// </returns>
private bool TryAllocateNew16MBBlock(out Entry* handle)
{
nuint pos = Volatile.Read(ref _spareMemory->Position);
nuint blockSize = (nuint)levelSize[^1]; // Use last level size (16MB)
nuint newPos = pos + blockSize;
// Check if we have enough space
if (newPos > ((nuint)m_Buffer) + _size)
{
handle = null;
return false; // Out of memory
}
// Try to allocate new Entry from slab allocator
try
{
handle = (Entry*)_nodes.Allocate();
handle->Position = pos;
handle->BlockSize = (uint)blockSize;
handle->State = EntryState.ThreadOccupied;
handle->NextNear = EmptyHandle;
handle->PreviousNear = EmptyHandle;
handle->SpinLock = 0;
// Update spare memory position
_spareMemory->Position = newPos;
return true;
}
catch
{
handle = null;
return false;
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More