Skip to content

STATIC UNIQUE #66

Description

@osullivj

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions