mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
- Also fixed non generic GetComponent - Use UUID as Drag-Drop value for entities - Removed unused methods from ComponentEditWindow - Started a marginally type-safe version of ImGui.Payload
39 lines
807 B
Beef
39 lines
807 B
Beef
using System;
|
|
|
|
namespace ImGui;
|
|
|
|
enum DragDropPayloadType
|
|
{
|
|
case ContentBrowserItem;
|
|
case Entity;
|
|
|
|
public String GetName()
|
|
{
|
|
switch (this)
|
|
{
|
|
case .ContentBrowserItem:
|
|
return "CONTENT_BROWSER_ITEM";
|
|
case .Entity:
|
|
return "ENTITY";
|
|
}
|
|
}
|
|
}
|
|
|
|
extension ImGui
|
|
{
|
|
public static Payload<T>? AcceptDragDropPayload<T>(ImGui.DragDropPayloadType type, DragDropFlags flags = .None) where T : struct
|
|
{
|
|
return AcceptDragDropPayload<T>(type.GetName(), flags);
|
|
}
|
|
|
|
public static Payload* AcceptDragDropPayload(DragDropPayloadType type, DragDropFlags flags = .None)
|
|
{
|
|
return AcceptDragDropPayload(type.GetName(), flags);
|
|
}
|
|
|
|
public static bool SetDragDropPayload(DragDropPayloadType type, void* data, size sz, Cond cond = .None)
|
|
{
|
|
return SetDragDropPayload(type.GetName(), data, sz, cond);
|
|
}
|
|
}
|