Skip to content

Instantly share code, notes, and snippets.

@dextercd
Created December 10, 2022 19:23
Show Gist options
  • Save dextercd/2ca7a63b221e47160fa3f5bb656db6fc to your computer and use it in GitHub Desktop.
Save dextercd/2ca7a63b221e47160fa3f5bb656db6fc to your computer and use it in GitHub Desktop.
local imgui = load_imgui({version="1.0.0", name="test"})
local valuea = 0
function OnWorldPreUpdate()
if imgui.Begin("Main Window Title") then
imgui.Button("Drag start element")
if imgui.BeginDragDropSource() then
imgui.SetDragDropPayload("TEST", valuea)
imgui.Text("Testing")
imgui.EndDragDropSource()
end
imgui.SameLine()
_, valuea = imgui.SliderFloat("Value", valuea, 0, 1000)
end
if imgui.Begin("Destination") then
imgui.Button("Drag destination")
if imgui.BeginDragDropTarget() then
local payload = imgui.AcceptDragDropPayload("TEST")
if payload ~= nil then
print("Received " .. tostring(payload) .. " " .. type(payload))
end
imgui.EndDragDropTarget()
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment