Extending ScriptGlue now possible

This commit is contained in:
Simon Lübeß
2025-07-27 17:43:00 +02:00
parent 566d39d928
commit 72e87ee9ad
4 changed files with 64 additions and 52 deletions
@@ -19,15 +19,6 @@ namespace GlitchyEditor.EditWindows
{
private static uint32 TableId;
public static this()
{
/*ScriptGlue.OnRegisterNativeCalls.Add(new () => {
// TODO: Implement
Runtime.NotImplemented();
//ScriptGlue.RegisterCall<function bool(ref AssetHandle)>("ScriptGlue::ImGuiExtension_ShowAssetDropTarget", => ShowAssetDropTarget);
});*/
}
public static void ShowComponents(Entity entity, Type componentType = null)
{
float cellPaddingY = ImGui.GetTextLineHeight() / 3.0f;
@@ -0,0 +1,24 @@
using System;
using GlitchyEditor.EditWindows;
using GlitchyEngine.Content;
namespace GlitchyEngine.Scripting;
extension ScriptGlue
{
static this()
{
OnRegisterNativeCalls.Add(new => RegisterExtensionCalls);
}
private static void RegisterExtensionCalls()
{
EngineFunctions.[Friend]_functions.ImGuiExtension_ShowAssetDropTarget = => ImGuiExtension_ShowAssetDropTarget;
}
[RegisterCall(EngineResultAsBool = true, IsExtension = true)]
public static EngineResult ImGuiExtension_ShowAssetDropTarget(ref AssetHandle assetHandle)
{
return ComponentEditWindow.ShowAssetDropTarget(ref assetHandle) ? .Ok : .False;
}
}