UI
The UI is Dear ImGui. You redraw it every frame from frame.onFrame.
import { frame, ui } from "wraith";
let speed = 1;
frame.onFrame(() => { ui.window("Speed", () => { speed = ui.sliderFloat("Speed", speed, 0.5, 5); if (ui.button("Reset")) speed = 1; });});Autocomplete on ui. shows every widget there is. Keys and the mouse are on Keybinds and input.
Tweaks
Section titled “Tweaks”A plugin can add tweaks to the overlay’s Tweaks menu, with fields players can change.
import { tweaks } from "wraith";
tweaks.add( { id: "speed", title: "Speed", key: "F8", fields: [{ name: "x", type: "f32", value: 2, min: 1, max: 5 }] }, { on: (values) => { /* turned on */ }, off: () => { /* turned off */ }, changed: (field, value) => { /* a field changed */ }, },);Toasts
Section titled “Toasts”overlay.toast pops up a short message in the corner.
Screen size
Section titled “Screen size”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.
const [w, h] = ui.getDisplaySize();const [x, y] = ui.getMainViewportPos();ui.drawList.addLine([x, y], [x + w, y + h], ui.rgba(255, 0, 0, 255), 2);Both give 0,0 outside a frame.
Made with ♥ by Asgard
