1
0
Fork 0
forked from aly/qstbak

qstcompanion v1.0.1

This commit is contained in:
alydev 2025-12-04 04:39:08 +10:00
parent 3e10cbbbf2
commit 44c67ab71b
79 changed files with 21148 additions and 0 deletions

View file

@ -0,0 +1,22 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui;
namespace QuestionableCompanion.Helpers;
public static class ImGuiDragDrop
{
public static void SetDragDropPayload<T>(string type, T data, ImGuiCond cond = ImGuiCond.None) where T : struct
{
ReadOnlySpan<byte> span = MemoryMarshal.AsBytes(MemoryMarshal.CreateReadOnlySpan(in data, 1));
ImGui.SetDragDropPayload(type, span, cond);
}
public unsafe static bool AcceptDragDropPayload<T>(string type, out T payload, ImGuiDragDropFlags flags = ImGuiDragDropFlags.None) where T : struct
{
ImGuiPayload* pload = ImGui.AcceptDragDropPayload(type, flags);
payload = ((pload != null) ? Unsafe.Read<T>(pload->Data) : default(T));
return pload != null;
}
}