在 ImGui 中创建弹出模式时,我注意到在应用程序的其余部分出现了一个灰色叠加层(我认为将焦点放在弹出窗口上)。
但是,我想知道是否有办法让我删除那个灰色的覆盖屏幕,这样即使弹出该模式,我仍然可以与应用程序的其余部分进行交互。因此,模式会弹出,但不会干扰应用程序的其余部分 - 只是弹出一个信息以反映当前速度,直到用户单击“确定”以使弹出窗口消失。
这是我用于创建模态窗口的代码:
if (ImGui::BeginPopupModal("Speed Adjustment")) {
std::string speed_text = "You're adjusting the speed";
speed_text += "\n";
ImGui::Text(speed_text.c_str());
//list the current speed
std::string currSpeed= "This is the current speed: " + std::to_string(databse->camSpeed);
ImGui::Text(currSpeed.c_str());
ImGui::Spacing();
ImGui::NextColumn();
ImGui::Columns(1);
ImGui::Separator();
ImGui::NewLine();
ImGui::SameLine(GetWindowWidth() - 270);
//click ok when finished adjusting
if (ImGui::Button("OK finished adjusting", ImVec2(200, 0))) {
speedpopup= false;
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
我是否需要为 beginPopupModal 部分添加某些标志?如果是这样,我应该使用什么标志?
谢谢,任何帮助表示赞赏!