qstcompanion v1.0.1
This commit is contained in:
parent
3e10cbbbf2
commit
44c67ab71b
79 changed files with 21148 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue