I downloaded imgui-js repo. Built it and ran the example, everything works fine.
In the package.json there is a command to run a node example:
"start-example-node": "node example/index.js" that obviously runs the example/index.js script.
So the index.js scripts runs, but nothing happens after. I expect a native example window to be drawn.
I would like to draw the sample script provide in the readme:
import * as ImGui from "imgui-js";
let show: boolean = true;
function draw(): void {
if (ImGui.Button("Toggle")) { show = !show; }
if (show) {
ImGui.Begin("My Window", (_ = show) => show = _, ImGui.WindowFlags.AlwaysAutoResize));
ImGui.Text("Hello, World!");
ImGui.End();
}
}
Is there any thing that needs to be done for a native imgui window to be drawn from node in the index.js script?
Its sure that the example/index.js script runs because there is info of this kind logged to the terminal
....
ElemCount 255
ClipRect 625 0 15 422
TextureId { foo: 'bar' }
i: pos.x pos.y uv.x uv.y col
0: 621.00 39.00 0.12793 0.00195 f00f0f0f
1: 1171.00 39.00 0.12793 0.00195 f00f0f0f
2: 1171.00 700.00 0.12793 0.00195 f00f0f0f
ImDrawList { native: ImDrawList {} }
VtxBuffer.length 28680
IdxBuffer.length 4458
ImDrawCmd {
native: ImDrawCmd {},
UserCallback: null,
UserCallbackData: null
}
.....
Edit: Seems that window is undefined at the main.ts render loop:
if (typeof(window) !== "undefined") {
window.requestAnimationFrame(done ? _done : _loop);
}
Which makes sense if method is being called from node and node within the browser. However what is the purpose of the node example then?