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

STATIC UNIQUE #66

Open
osullivj opened this issue Nov 19, 2024 · 0 comments
Open

STATIC UNIQUE #66

osullivj opened this issue Nov 19, 2024 · 0 comments

Comments

@osullivj
Copy link

Just a design philosophy question on the STATIC and UNIQUE definitions in imgui_demo.ts: comparing imgui_demo.ts:2576 and imgui_demo.cpp:2543 we find these two lines immediately below the multiline comment // Demonstrate a few extra things

            const offset_x = STATIC<int>(UNIQUE("offset_x#22c5d833"), 0);

            static int offset_x = 0;

Where does the TS port hex value come from eg 22c5d833? The use of UNIQUE makes me think of imgui's ##unique_id. But the code is not using UNIQUE to generate explicit imgui IDs, it's using them to provide unique keys for imgui_demo.ts:_static_map and _static_array_map. In other words, STATIC and UNIQUE are there to emulate C++ static behaviour?

How did you generate the hex IDs in the TS port? Did you run a hacked C++ version that dumped the imgui widget IDs as a convenient way to generate UNIQUE keys for the C++ statics?

Thanks!

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