Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run native imgui window from node #49

Open
LuisMerinoP opened this issue Feb 12, 2022 · 0 comments
Open

run native imgui window from node #49

LuisMerinoP opened this issue Feb 12, 2022 · 0 comments

Comments

@LuisMerinoP
Copy link

LuisMerinoP commented Feb 12, 2022

Hello,
Not an issue but a question.
Sorry I am not very familiar with node.

Built and ran the project example and everything works fine.
I run the node example with: npm run-cript start-example-node and the script runs but nothing is drawn (there are logs in the terminal).
I expect a native imgui window drawn form node script call.

I would like to run the example

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();
    }
}

from node.

Is this possible? Is there anything that needs to be done in the example/index.js script?
Thanks in advanced.

Edit1: There is an error Cannot find name 'System'.ts(2304) error obtained at System.import("main") in the index.js script.
Node version: v17.5.0
Edit2: 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant