|
@@ -6,16 +6,16 @@ public static class PixiEditorApiLinkerExtensions
|
|
|
{
|
|
|
public static void DefinePixiEditorApi(this Linker linker, WasmExtensionInstance instance)
|
|
|
{
|
|
|
- linker.DefineFunction("env", "log_message",(int messageOffset) =>
|
|
|
+ linker.DefineFunction("env", "log_message",(int messageOffset, int messageLength) =>
|
|
|
{
|
|
|
- string messageString = MemoryUtility.GetStringFromWasmMemory(messageOffset, instance.Instance.GetMemory("memory"));
|
|
|
+ string messageString = MemoryUtility.GetStringFromWasmMemory(messageOffset, messageLength, instance.Instance.GetMemory("memory"));
|
|
|
Console.WriteLine(messageString.ReplaceLineEndings());
|
|
|
});
|
|
|
|
|
|
- linker.DefineFunction("env", "create_popup_window",(int titleOffset, int bodyOffset) =>
|
|
|
+ linker.DefineFunction("env", "create_popup_window",(int titleOffset, int titleLength, int bodyOffset, int bodyLength) =>
|
|
|
{
|
|
|
- string title = MemoryUtility.GetStringFromWasmMemory(titleOffset, instance.Instance.GetMemory("memory"));
|
|
|
- string body = MemoryUtility.GetStringFromWasmMemory(bodyOffset, instance.Instance.GetMemory("memory"));
|
|
|
+ string title = MemoryUtility.GetStringFromWasmMemory(titleOffset, titleLength, instance.Instance.GetMemory("memory"));
|
|
|
+ string body = MemoryUtility.GetStringFromWasmMemory(bodyOffset, bodyLength, instance.Instance.GetMemory("memory"));
|
|
|
instance.Api.WindowProvider.CreatePopupWindow(title, body).ShowDialog();
|
|
|
});
|
|
|
}
|