-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to create .NET csharp example illustrating the use case below? #1
Comments
Thanks for the feature request. This should be done probably with this: https://github.com/raulsntos/godot-dotnet |
@raulsntos We understand that you wish that further discussions will only take place after this project is merged to the main. Our question, what is the time line for the merge. During this time, how can we coordinate as godot 4 .NET community to speed up the merge? What are the TODOLIst for this repos so we can estimate how much more we need to coordinate This is a feedback because we really care that the .NET extension part is not too far from other extensions. https://github.com/raulsntos/godot-dotnet @Repiteo Latest Updatehttps://github.com/Delsin-Yu/CSharp-Wrapper-Generator-for-GDExtension |
Proposal: 3D ModelViewer Control godotengine/godot#90510 (comment) D3D12:: rendering_native_surface_windows.cpp
Sample project that works in Windowshttps://github.com/V-Sekai/libgodot_project/tree/groups-4.3 Related issues and ideas
AvaloniaUI@MrJul @abenedik |
Original proposal: godotengine/godot-proposals#6267 |
[WIP] Windows platform: libgodot.dllThe libgodot.dll comes from
bin\ godot.windows.template_debug.dev.x86_64.dll
bin\ godot.windows.editor.dev.x86_64.exe --dump-extension-api With this, provide the json and the dll to the godot-dotnet project.
The output will be c# wrappers for the godot.windows.template_debug.dev.x86_64.dll Users can then write c# applications to embed godot as a library in .NET applications Very similar to: LibGodotSharp |
Does this example enable web export? Is there a way to use WASM / Emscripten on NET 9.0 + LibGodot to make something that can run in Firefox? |
JiepengTan/libgodot_llgo_demo#1 (comment) using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello Libgodot-csharp ! ");
string program = "";
string projectPath = "../../Summator/Game";
if (args.Length > 0)
{
projectPath = args[0];
Console.WriteLine("Project path: " + projectPath);
}
List<string> arguments = new List<string> { program, "--path", projectPath, "--rendering-method", "gl_compatibility", "--rendering-driver", "opengl3" };
IntPtr instance = LibGodot.libgodot_create_godot_instance(arguments.Count, arguments.ToArray(), IntPtr.Zero);
if (instance == IntPtr.Zero)
{
Console.Error.WriteLine("Error creating Godot instance");
Environment.Exit(1);
}
bool success = LibGodot.libgodot_start_godot_instance(instance);
while (LibGodot.libgodot_iteration_godot_instance(instance))
{
}
LibGodot.libgodot_destroy_godot_instance(instance);
Environment.Exit(0);
}
} The essential c# interopt with Windows: libgodot.dll using System;
using System.Runtime.InteropServices;
public enum GDExtensionInitializationLevel
{
GDEXTENSION_INITIALIZATION_CORE,
GDEXTENSION_INITIALIZATION_SERVERS,
GDEXTENSION_INITIALIZATION_SCENE,
GDEXTENSION_INITIALIZATION_EDITOR,
GDEXTENSION_MAX_INITIALIZATION_LEVEL
}
[StructLayout(LayoutKind.Sequential)]
public struct GDExtensionInitialization
{
public GDExtensionInitializationLevel minimum_initialization_level;
public IntPtr userdata;
public Action<IntPtr, GDExtensionInitializationLevel> initialize;
public Action<IntPtr, GDExtensionInitializationLevel> deinitialize;
}
public class LibGodot
{
const string LIBGODOT_LIBRARY_NAME = "libgodot.dll";
[DllImport(LIBGODOT_LIBRARY_NAME)]
public static extern IntPtr libgodot_create_godot_instance(int argc, string[] argv, IntPtr handle);
[DllImport(LIBGODOT_LIBRARY_NAME)]
public static extern void libgodot_destroy_godot_instance(IntPtr instance);
[DllImport(LIBGODOT_LIBRARY_NAME)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool libgodot_start_godot_instance(IntPtr instance);
[DllImport(LIBGODOT_LIBRARY_NAME)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool libgodot_iteration_godot_instance(IntPtr instance);
} |
Launcher with (Windows) libgodot.dllhttps://github.com/JiepengTan/libgodot_llgo_demo/tree/main/samples/cs_sample/Launcher "Launcher.exe" "../../Summator/Game"
Hello Libgodot-csharp !
Project path: ../../Summator/Game
Godot Engine v4.3.beta.custom_build - https://godotengine.org
WARNING: Unable to initialize Windows common controls. Native dialogs may not work properly.
at: DisplayServerWindows::DisplayServerWindows (platform\windows\display_server_windows.cpp:5725)
OpenGL API 3.3.0 NVIDIA 538.18 - Compatibility - Using Device: NVIDIA
60 <=== right answer
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
at: ObjectDB::cleanup (core\object\object.cpp:2284) https://github.com/JiepengTan/libgodot_llgo_demo/tree/main/samples/project "Launcher.exe" "project"
Hello Libgodot-csharp !
Project path: ../../project
Godot Engine v4.3.beta.custom_build - https://godotengine.org
WARNING: Unable to initialize Windows common controls. Native dialogs may not work properly.
at: DisplayServerWindows::DisplayServerWindows (platform\windows\display_server_windows.cpp:5725) |
@kisg |
Woah! I had no idea this much progress had been made towards running the godotlib in .NET; kudos to all involved! Are there plans to write hostbuilder extensions for configuring and running the Godot instance or is it much too early to be discussing that? |
The text was updated successfully, but these errors were encountered: