Skip to content

UI

The UI is Dear ImGui. You redraw it every frame from frame.onFrame.

local wraith = require("wraith")
local frame, ui = wraith.frame, wraith.ui
local speed = 1
frame.onFrame(function()
ui.window("Speed", function()
speed = ui.sliderFloat("Speed", speed, 0.5, 5)
if ui.button("Reset") then speed = 1 end
end)
end)

It’s the same set of widgets JS plugins get. Keys and the mouse are on Keybinds and input.

A plugin can add tweaks to the overlay’s Tweaks menu, with fields players can change.

wraith.tweaks.add(
{ id = "speed", title = "Speed", key = "F8", fields = { { name = "x", type = "f32", value = 2, min = 1, max = 5 } } },
{
on = function(values) --[[ turned on ]] end,
off = function() --[[ turned off ]] end,
changed = function(field, value) --[[ a field changed ]] end,
}
)

wraith.overlay.toast pops up a short message in the corner.

ui.getDisplaySize() is { w, h }, the game window in the overlay. Draw lists work in screen pixels that start at ui.getMainViewportPos(), which is 0,0 in the overlay but the main window’s corner in the Workbench, so add it when you place things yourself.

local size, corner = ui.getDisplaySize(), ui.getMainViewportPos()
ui.drawList.addLine(corner, { corner[1] + size[1], corner[2] + size[2] }, ui.rgba(255, 0, 0, 255), 2)

Both give 0, 0 outside a frame.

Made with ♥ by Asgard