Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
run node example from repo to draw a native imgui window from node

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?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda