简体   繁体   English

imgui 在 window 的根目录中不能有空 ID。如果您需要一个空的 label,请使用 ## 并阅读有关 ID 堆栈工作原理的常见问题解答

[英]imgui Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works

So, i get following error if you try to initialize imgui element without label.因此,如果您尝试在没有 label 的情况下初始化 imgui 元素,我会收到以下错误。

ui.slider("", 10, 40, &mut input_font_size)
Assertion failed: (id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!"), function ItemAdd, file imgui.cpp, line 7793.

To create imgui element without a visible label, just place要创建没有可见 label 的 imgui 元素,只需放置

## ##

at the start of it like so:在它的开始是这样的:

ui.slider("##slider1", 10, 40, &mut input_font_size)

The example made with rust tweak of imgui - imgui-rs, for c++ solution is similar.使用 imgui - imgui-rs 的 rust 调整制作的示例,对于 c++ 解决方案是类似的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM